This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

question on structures

Hi all,

I'm coding graphic LCD routines and I want to include several text fonts.

So, I've defined a structure as :

typedef struct DEF_FONT
{
	U8 u8width;     /* Character width*/
	U8 u8height;  /* Character height*/
	U8 *au8fontTable;       /* Font table start address in memory  */
} DEF_FONT;

then, I've included two fonts and they are declared like this :
struct DEF_FONT code Font_System5x8 = {5, 8, au8font5x8};
struct DEF_FONT code Font_System8x8 = {8, 8, au8font8x8};

Now, I want to print a text with a selected font.

I've tried to send the structure as a parameter in the GLCD_PutChar function as :
void LcdPutchar (U8 u8Char, DEF_FONT stFont)

and then, I've tried to access the elements of the structure in the function like this :

LcdDataWrite (stFont->au8fontTable[(u8Char - 32) * 5 + u8CharColumn]);

There is an error from compiler
***ÿERROR 199 IN LINE 345 OF C:\TRX8051\GLCD.C: left side of '->' requires struct/union pointer

I suppose the solution may be to declare in the function a pointer to the structure like this:
struct DEF_FONT *ptr
I understand how to use it in a single structure, but in this case, how is done the selection of the font between the two structures ?



Regards
Stephane

Parents Reply Children
No data