Hi
I am from hardware background and not very good in C programming
Can any one help me to understand this preprocessor related code PIC C programming
Code:
Header file part
// No Rx I/P Tx O/P Baud rate 103=9600
// ena pin ena pin divisor 25=38400
#define UART_DEFS \
U(1, C7, C6, 103) \
U(2, G2, G1, 25)
void UartPowerOnInit();
void UartEnableWakeup();
bit UartCanSleep();
void UartsSetWakeTrigger();
#define U(N,R,T,B) \
void Uart##N##TxChar(uint8_t Char); \
void Uart##N##SetRxCharEvent(enum EVENT_RECIPIENT Recipient,uint8_t Event);
UART_DEFS
#undef U
C File
Code:
// Data definitions
#define U(N,R,T,B) \
\
static TX_PTR Tx##N##In; \
static TX_PTR Tx##N##Out; \
static uint8_t Tx##N##Buff[TX_BUFF_SIZE]; \
\
static enum EVENT_RECIPIENT Rx##N##Recipient; \
static uint8_t Rx##N##Event; \
UART_DEFS
#undef U
I am trying to understand use of token, why ## is used before and after identifier
how and why U is defined twice in same macro
Over explanation of macro use in this piece of code
Thanks in advance
mmuj