Cerbuino bee With Seed Oled problem

How do I display text on OLED using this method?

Use DrawText method:

There’s now also the “low memory” section of GHI Electronics – Where Hardware Meets Software that talks about graphics.

@ GMod(Errol) - Thanks!

With this code I get “Hello world” on the OLED, but how can I clear the lower part of the OLED (see image)?

Bitmap bitmap = new Bitmap(100, 20);
            byte[] framebuffer = new byte[100 * 20 * 2];
            bitmap.DrawText("Hello world!",Resources.GetFont(Resources.FontResources.small), GT.Color.Magenta, 10, 0);
            Util.BitmapConvertBPP(bitmap.GetBitmap(), framebuffer, Util.BPP_Type.BPP16_RGB_BE); 
            oledDisplay.FlushRawBitmap(0, 0, 100, 20, framebuffer);

This code tells it where to put the image:

oledDisplay.FlushRawBitmap(0, 0, 100, 20, framebuffer);

So if you change it to:

oledDisplay.FlushRawBitmap(0, 20, 100, 20, framebuffer);

Then it will place the image lower on the screen. So, to clear the screen you need to empty the framebuffer and write it, consecutively, to the screen, starting at the top and working down in blocks of 20 pixels…

@ GMod(Errol) - That worked, thanks!

I also need the new version. I bought several Cerbuino and several Seed Oled…

I got my first Cerberus board and the OLED screen and of course ran into the same issues…
I couldn’t get it to work correctly with the

oledDisplay.FlushRawBitmap(0, 0, 100, 20, framebuffer);

I would always end up with weird artifacts and could not get it to clear the screen correctly.
I ended up downloading all the source code and modifying the OledDisplay.cs this worked great in case anyone is interested. According to the spec for SSD1351 there are several modes for the display: 256?? (is that even true?) , 65K and 262K. Here’s how you can enable the different modes:

Comment out the following in “InitializeDisplay” and replace the parameter for

//vram = new byte[Width * Height * 2];
SendParams2(Cmd.SetRemapAndColorDepth1, CmdValue.RemapColor_262K_16bit); // This will set 262K colors
//SendParams(Cmd.WriteRAMCommand0, vram);
ClearScreen(); // new method

Add a new enum:

        private enum CmdValue {
            RemapColor_65K_16bit = 0x74,
            RemapColor_256 = 0x34,
            RemapColor_262K_16bit = 0xF4,
            RemapColor_262K_18bit = 0xB4

Add a new method to allow for the above enum values, makes it cleaner:

        private void SendParams2(Cmd cmd, CmdValue value) {
            byte[] args = { (byte)value };
            Send((byte)cmd, args);

…And finally the method that will clear the screen with a color

        public void ClearScreen() {
            byte[] vram = new byte[256];
            for (int i = 0; i < vram.Length; i++) {
                vram[i] = 127; // this is just a random color set it to whatever you want or zero/remove to clear to black

            for (int i = 0; i < 128; i++) {
                SendParams(Cmd.WriteRAMCommand0, vram);

By setting the background to a color you can really see the difference between the different modes 65K and 262K. It also clears the screen properly.

Have you tried using this? http://www.tinyclr.com/codeshare/entry/520

Looks very interesting, will give it a try. At a first glance though, doesn’t look like it has any specific handling for the low-memory situation that occurs with the Cerberus?
That’s primarily what I was looking for.

Btw, do you happen to know the pin numbers for the SSD1351? I’m looking for the RW pin number to allow reading back from the OLED memory.
There are two pins already defined:

            _rst = new GTI.DigitalOutput(socket, Socket.Pin.Four, true, this);
            _dc = new GTI.DigitalOutput(socket, Socket.Pin.Three, true, this);

I need this:

            _rw = new GTI.DigitalOutput(socket, Socket.Pin.????, true, this); 

The OLED is SPI based, so no RW pin. The SPI port has an input for reading data, but the OLED display doesn’t have a output to connect to the input, so you can’t read back. I was trying to use the OLED’s ram as the frame buffer, doing a Read from display/Modify data/Write data back to display, but found there is no way of reading the data off the display…

Thanks, you’re right it’s write-only. I guess the only way you can do any sort of alpha blending would be by simultaneously sending the data to the display and to some sort of RAM cache that can be read back for processing.

@ Marcin - The link I provided was developed specifically for Cerb40 w/ OLED. You can have multiple full screen PicoBitmaps on the Cerb at once, and since you have access to the pixels in RAM you can then use them for alpha-blending.

Here it is running GPS, Keypad, Snake, Etc

Just saw this thread - bring it back from the dead!

@ Skewworks what project box is that? Mind shooting me an email about how you have things mounted inside (or some inside shots)?

@ Skewworks - forgot I had your email (where’s the PM function :wink: ), will shoot you a note in case you aren’t following this thread for some reason.