My code is:
#define qty 2
typedef struct { uint8_t ID;
uint8_t tagbyte[5];
} cards;
const cards eecollcards[qty] EEMEM ={
{0x01, {0x2A, 0x00, 0x24, 0x91, 0xFD}},
{0x02, {0x4F, 0x00, 0x88, 0x59, 0xB0}},
};
int main (void)
while (1)
{
switch (<what goes here?>)
{
case 0x01: .....
break;
case 0x02: .....
break;
}
}
I want to check the values stored in structby distinguishing between the values 0x01 and 0x02, but I am having problems with the formation of the operator switchshown above. I tried cards.uint8_t IDand eecollcards[qty] EEMEM, but they generate errors such as:
error: excepted expression before struct...
I know that cardsthis is just a type name, not a variable. 0x01 refers to a IDtype variable uint8_t, and the remaining hexadecimal values are for initializing the array tagbyte[5].
source
share