I want to make a macro which doesn't use arguments but has predefined integer and string which is used.
I asked before about something similar with macro that has arguments and this is how it is:
#define BUZZER_PIN 1
#define BUZZER_PORT B
#define BUZZER_ALT 1
#define INIT_BUZZER_(PORTX, PIN, ALT) \
do { \
PORT##PORTX##_PCR(PIN) = PORT_PCR_MUX(ALT) | PORT_PCR_DSE_MASK; \
GPIO##PORTX##_PDDR |= (PIN)<<1; \
} while (0)
#define INIT_BUZZER(PORTX, PIN, ALT) \
INIT_BUZZER_(PORTX, PIN, ALT)
but what if I just want to have INIT_BUZZER
that will be referenced to INIT_BUZZER_
and do all above?
I tried to:
#define INIT_BUZZER INIT_BUZZER_(BUZZER_PORT, BUZZER_PIN, BUZZER_ALT)
I am always having problem only with string and I don't understand that part well.
If I call it this way I get BUZZER_PORT
processed as string BUZZER_PORT
not as the value of it = B