STM32CubeIDE-Workshop-2019 icon indicating copy to clipboard operation
STM32CubeIDE-Workshop-2019 copied to clipboard

Code error on section "Hands-on: printf over Virtual COMport (UART1)"

Open oliverdding opened this issue 4 years ago • 0 comments

I find this error on Hands-on: printf over Virtual COMport (UART1):

The code below

Inside USER CODE Block 4:

/* USER CODE BEGIN 4 */
#ifdef __GNUC__
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
#else
  #define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
#endif /* __GNUC__ */
{
  HAL_UART_Transmit(&huart1, (uint8_t *)&ch, 1, 0xFFFF);
  return ch;
}
/* USER CODE END 4 */

should be changed to

Inside USER CODE Block 4:

/* USER CODE BEGIN 4 */
#ifdef __GNUC__
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
#else
  #define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
#endif /* __GNUC__ */
PUTCHAR_PROTOTYPE {
  HAL_UART_Transmit(&huart1, (uint8_t *)&ch, 1, 0xFFFF);
  return ch;
}
/* USER CODE END 4 */

oliverdding avatar Mar 12 '20 04:03 oliverdding