I am working on an embedded C project. I have an LCD display and for each character there is a 5x7 dot matrix. To display a specific character you have to shift in 5 bytes that correlate with the dots to turn on. So I need to make some kind of look-up table with a key where I can pass in an ASCII character, and get an array of 5 bytes returned... For example, a call to this function like this,
GetDisplayBytes('A');
should return `an array like this...
C[0] = 0x7E : C[1] = 0x90 : C[2] = 0x90 : C[3] = 0x90 : C[4] = 0x7E
What would be the best way to do this in C?
I would make arrays for the contiguous ASCII blocks you want to use. data. Something like this:
Then your
GetDisplayBytes()
is something like:Pass the returned pointer to whatever function outputs the data:
This is basically making an array of arrays.