I have a large amount of constant data that I need to store in a header file. Due to the nature of the data (how its nested), I decided to use a structure that is initialized by the preprocessor.
I am trying to initialize these structs like so:
typedef struct s_PWM {
uint8_t muxmode;
char *name;
char *path;
} PWM;
typedef struct s_PIN {
char *name;
uint8_t gpio;
char *mux;
uint8_t eeprom;
PWM *pwm;
} PIN;
This would allow me to do something like
PIN p1 = P8_19;
to, in a sense, assemble a struct with the proper attributes.
Basically, you can send a pin into a function
pinMode(P8_19, OUTPUT)
This is the line in question
#define P8_19 ((PIN){"EHRPWM2A", 22, "gpmc_ad8", 14, (PWM*){4, "EHRPWM2A", "ehrpwm.2:0"}})
This is the warning
src/gpio.c:50:2: warning: excess elements in scalar initializer
src/gpio.c:50:2: warning: (near initialization for '(anonymous)')
src/gpio.c:50:2: warning: excess elements in scalar initializer
src/gpio.c:50:2: warning: (near initialization for '(anonymous)')
Does anyone have any ideas why this is happening? Am I incorrectly nesting the PWM* struct into the PIN struct?