I want to use a scanf() function in STM32F401RE_NUCLEO with IAR compiler.
This is my overloaded fgetc function.
int fgetc(FILE *f) {
char ch;
while (__HAL_UART_GET_FLAG(&UartHandle, UART_FLAG_RXNE) == RESET);
HAL_UART_Receive(&UartHandle, (uint8_t*)&ch, 1, 0xFFFF);
return ch;
}
And I use scanf in main function like below.
int n;
printf("[DBG] Input: ");
scanf("%d", &n);
printf("[DBG] Output: %d\n", n);
If I type a "123" from terminal, then printed "23".
%d, %u, %f was same.
But, only %c works correctly.
How can I solve this problem?