How to map a array of types over a struct with a sequence/list of the same types.
Hi guys, Hope some one can help me with this
I have defined an alarm struct of repeating struct memers that must manage various alarm massages and alarm audio signals.
I want to address these alarm's in the following way, for example
1) alarm.spray.stat
but also as
2) alarmlist[0].stat;
Both the struct and the array are in fact arrays of repeating alarm_t types and it should be possible to map them over eacht other having the same start address
For this I need to assign the alarm struct address to the alarmlist[] array address.
Tricky i know but on a 8bit controller like the ATmega 328 it should not be a problem. I also want to use this technique on STM32 controllers. How can i do this with out having conflicts at compile time.
I did try this :
alarmlist=(alarm_t)&alarm but that gave me a error.
typedef struct alarm_t {
char * msg;
uint8_t prio : 4;
uint8_t stat : 4;
uint8_t Buzzpattern;
uint8_t duration : 4;
uint8_t intermit : 4;
} alarm_t;
struct alarm_state_t {
alarm_t spray;
alarm_t stall;
alarm_t empty;
} alarm = { { },{ },{ } };
alarm_t alarmlist[];
