2018-07-23 07:54 PM
MCU: Stm32f103c8t6
i want to use Printf in my Code
Currently i am using Hal_Uart_transmit to send data this Data when printed is correctly displayed
I wanted to add printf so i have added the following to my code
But when i use printf to send data the data printed is garbage
How can i fix this?
/****************************************************************************/
#ifdef __GNUC__
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch11)
#else
#define PUTCHAR_PROTOTYPE int fputc(int ch11, FILE *f)
#endif
/****************************************************************************/
PUTCHAR_PROTOTYPE
{
HAL_UART_Transmit(&huart1,(uint8_t*)ch11,1,0xffff);
return ch11;
}
/****************************************************************************/
2018-07-26 06:02 AM
>>How can i fix this?
Do the pointer casting properly
HAL_UART_Transmit(&huart1,(uint8_t*)&ch11,1,0xffff);