Function
Code: Select all
void usart_send_char(uint8_t Data)
{
/* Transmit Data */
while((USART2->SR & USART_FLAG_TXE) == 0);
USART2->DR = Data;
}
Now i try to implement eprintf as explained in eprintf.c file:
Code: Select all
int consolePutc(int c)
{
usart_send_char((uint8_t)c);
return (unsigned char)c;
}
#define consolePrintf(FMT, ...) eprintf(consolePutc, FMT, ## __VA_ARGS__)
Code: Select all
consolePrintf("%s, %d, %f\r\n", "asd", 777, 2.2 );
Code: Select all
asd, 777, 0.0
Code: Select all
num = va_arg(ap, double);
Where i am mistaken?