crazyflie 2.0 eprintf float values
Posted: Wed Feb 04, 2015 10:51 pm
Hello!I want to log out from quadcopter via expansion board using usart.
Function
work as expected and send characters via TX2 pin on expansion board.
Now i try to implement eprintf as explained in eprintf.c file:
So problem is that consolePrintf don't send correct float values. When i call:
I get output:
It seems like always return zero.
Where i am mistaken?
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?