函数声明和串口重定向:
- /* USER CODE BEGIN PFP */
- void uart1_data(void); //接收函数
- #ifdef __GNUC__ //串口重定向
- #define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
- #else
- #define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
- #endif
- PUTCHAR_PROTOTYPE
- {
- HAL_UART_Transmit(&huart1 , (uint8_t *)&ch, 1, 0xFFFF);
- return ch;
- }
- /* USER CODE END PFP */
|