This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to set a charactermap?

Other Parts Discussed in Thread: LM3S6965

Hi,

I'd like to draw text on my oled i²c display but don't now how to implement the charactermap? I've read about using std::map to map values to keys but when I use this in the CCS it gives me an error syntax.

for example:

include <map>
include <iostream>

map<string, char*> charMap;
charMap['!']= {'0x00', '0x00', '0x5F', '0x00', '0x00'};

but this doesn't seem to work.

Any ideas how to approach this would be very appreciated!

  • Hi Bart,

       What Stellaris Kit are you using? Stellarisware for kits that have an OLED, has a graphics sample program. Reviewing the graphics sample program would help.

       If you need to display graphics at your OLED, the OLED bitmap tool attachment in this thread below might help. I have used this to display graphics at the OLED of my LM3S6965 Evaluation Kit successfully.

      http://e2e.ti.com/support/microcontrollers/stellaris_arm/f/471/t/46253.aspx?pi74263=1

    -kel

  • Hi Markel,

    I'm using a Stellaris LM4F120 Eval board.

    Using this approach would only give you the ability to display static data (premade with that sample program)?
    So displaying realtime info (like a clock or sensordata) would not work?

    In Python I made a character map like this:

    charmap = {
            ' ':[0x00, 0x00, 0x00, 0x00, 0x00],
            '!':[0x00, 0x00, 0x5F, 0x00, 0x00],
            '"':[0x00, 0x07, 0x00, 0x07, 0x00],
            ...
    }

    with functions to draw the character:

    def oled_drawChar(c):
            charm = dict(charmap)
            for k in range(0,5):
                    bus.write_byte_data(a, 0x40, charm[c][k])
            bus.write_byte_data(a, 0x40, 0x00)

    def oled_write(word):
            for c in word:
                    oled_drawChar(c)

    With this I could give realtime info on my oled display (clock, ip,...) but on my Stellaris I'm already stuck at translating the Python Dictionary to C++...
    How could I tackle this so that I can keep the same (more or less) approach in displaying characters?

    With kind regards,

    Bart

  • Hi Bart,

    I think what you need is the Stellarisware Graphics Library. See link below. Read the SW-DRL-UG-xxxx.pdf.

    http://www.ti.com/tool/sw-grl

    -kel

  • Hi Markel,

    Ok, I'll have a look at it.

    Thx!

    Also aBUGSworstnightmare his API is of good help it seems!