avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-dev] Creating a table of numbers with different types


From: Volkmar Dierkes
Subject: [avr-libc-dev] Creating a table of numbers with different types
Date: Sat, 19 Mar 2011 00:20:16 +0100

Hello,

I want to create a table like this:

unsigned char lcd_display_function[] PROGMEM = {
        CLCD_FIFO_CMD_FILLRECT, LOK_FCT0_POSX, LOK_FCT0_POSY, LOK_FCT0_ENDX, 
LOK_FCT0_POSY, SOFTKEY_BORDER0_COLOR,
        CLCD_FIFO_CMD_SUBEND};

Each value is a constant in a range of 0<=x<=255 defined with #define.

This works fine so far, but I am in the need to add also an address of
another table in PROGMEM, like this:

unsigned char foo[] PROGMEM = {0, 1, 2};

I tried several ways to add this to the list above, like this:

#define lo8(x) (((int)(x)&0xff))
#define hi8(x) (((int)(x)>>8))

unsigned char lcd_display_function[] PROGMEM = {
        CLCD_FIFO_CMD_FILLRECT, LOK_FCT0_POSX, LOK_FCT0_POSY, LOK_FCT0_ENDX, 
LOK_FCT0_POSY, SOFTKEY_BORDER0_COLOR,
        lo8(foo), hi8(foo),
        CLCD_FIFO_CMD_SUBEND};

but it results always in an error:
error: initializer element is not constant

Do you have any idea how this could be solved?

Thanks
Volkmar





reply via email to

[Prev in Thread] Current Thread [Next in Thread]