Hi, I'm Devon.
I'm working with a graphic lcd where I have defined my own font and character placement function. What I want to do is store all of the font support data into PROGMEM so that it's not wasting my precious RAM. I've searched everywhere for help and i can't find anything related to my specific situation. I've even asked on stackoverflow and they couldn't help me.
Here's how I have the arrays defined:
prog_uchar fontLookUp[265] PROGMEM = {....}; //Converts ascii code to character location in font array.
prog_uchar font[96][8] PROGMEM = {...}; //contains character code. 96 characters at 8 bytes per character.
My placement function loads each byte of a character into a small buffer and then dumps the buffer to the display. To read a single byte of a character my function calls this line:
int pixels = font[fontLookUp[character][x]; //where character is the character being placed and x is the byte of the character being read.
I can't seem to get my program to read in from flash correctly. Here's what I've tried:
pgm_read_byte_near(font + pgm_read_byte_near(fontLookUp + character) * 8 + x);
This just outputs garbage to my display... Can anyone please help me out with what i'm doing wrong?