I am trying to manipulate certain bit( bit 1) using the following nested macros, but I am running into the error lvalue required as left operand of assignment
My code is as follows
#define CONTROL1 (*((unsigned int volatile *) 0x00AA))
#define CONTROL2 (*((unsigned int volatile *) 0x00BB))
#define XC_PIPE(pipe) (unsigned int volatile *)( (pipe) == 0 ? (CONTROL1) : (CONTROL2) )
#define XC_ENABLE(pipe) ( ( XC_PIPE(pipe) ) |= (1<<(1)))
#define XC_DISABLE(pipe) ( ( XC_PIPE(pipe) ) &= ~(1<<(1)))
#define XC_MODULE_TOGGLE(on,pipe) ( (on) == true ? (XC_DISABLE(pipe)) : (XC_ENABLE(pipe)) )
and I call it like this
XC_MODULE_TOGGLE(false,0);
How can I avoid this error?