I have a function called ADS_Transmit, declared as follows
void ADS_Transmit(uint8_t* data, uint16_t size);
The function is supposed to take arrays of uint8_t as parameter, but in some conditions, I'd like to send macros when calling the function. Like this
#define ADS_CMD_RST 0x06U
ADS_Transmit(ADS_CMD_RST, 1); // Does not work
uint8_t data = ADS_CMD_RST;
ADS_Transmit(&data, 1); // Works
Now perhaps obvious to many, sending the macro in the parameter doesn't work, since the function will use what's on register 0x06. But is there a way that I could send the macro in the parameter without changing the function?
Thank you in advance!
ADS_CMD_RSTrepresents characters that make up the number 0x06U. So you should be asking "how do I send a number to a function that expect an address without storing the number in a variable and sending the address of the variable". You actually can do that, macros only muddle the water.