This is a very basic question I simply do not know the answer to, and searches keep giving me unrelated answers. I need to reference some specific peripheral registers in my Infineon PSoC4 microcontroller. The library support files include a header file that lists all the different registers. However, my IDE is balking at my references to them.
Here is one example define for an I2C register:
#define SCB_I2C_CTRL(base) (((CySCB_Type*) (base))->I2C_CTRL)
I want to dump this register to a UART for debugging purposes. Like so:
debug_putHexUINT32(SCB_I2C_CTRL);
With the line written as above, the compiler balks that SCB_I2C_CTRL is undeclared. Which makes sense; the define name includes (base). But if I change the call to:
debug_putHexUINT32(SCB_I2C_CTRL(base));
The compiler complains that “base” is undeclared. I don’t understand what (base) is meant to be doing: it’s clearly not simply part of the define name. How do I properly refer to this register?