|
|
|
@ -22,7 +22,7 @@ |
|
|
|
|
|
|
|
/* Private includes ----------------------------------------------------------*/ |
|
|
|
/* USER CODE BEGIN Includes */ |
|
|
|
|
|
|
|
#include <stdio.h> |
|
|
|
/* USER CODE END Includes */ |
|
|
|
|
|
|
|
/* Private typedef -----------------------------------------------------------*/ |
|
|
|
@ -89,17 +89,22 @@ int main(void) |
|
|
|
MX_GPIO_Init(); |
|
|
|
MX_USART1_UART_Init(); |
|
|
|
/* USER CODE BEGIN 2 */ |
|
|
|
|
|
|
|
#ifdef __GNUC__ |
|
|
|
/* With GCC, small printf (option LD Linker->Libraries->Small printf
|
|
|
|
set to 'Yes') calls __io_putchar() */ |
|
|
|
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch) |
|
|
|
#else |
|
|
|
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f) |
|
|
|
#endif /* __GNUC__ */ |
|
|
|
/* USER CODE END 2 */ |
|
|
|
|
|
|
|
/* Infinite loop */ |
|
|
|
/* USER CODE BEGIN WHILE */ |
|
|
|
int index = 0; |
|
|
|
while (1) |
|
|
|
{ |
|
|
|
if (HAL_UART_Transmit(&huart1, "TEST ", 6, 100) != HAL_OK) { |
|
|
|
Error_Handler(); |
|
|
|
} |
|
|
|
HAL_Delay(500); |
|
|
|
printf("test %d\n\r", index++); |
|
|
|
HAL_Delay(100); |
|
|
|
/* USER CODE END WHILE */ |
|
|
|
|
|
|
|
/* USER CODE BEGIN 3 */ |
|
|
|
@ -261,7 +266,19 @@ static void MX_GPIO_Init(void) |
|
|
|
} |
|
|
|
|
|
|
|
/* USER CODE BEGIN 4 */ |
|
|
|
/**
|
|
|
|
* @brief Retargets the C library printf function to the USART. |
|
|
|
* @param None |
|
|
|
* @retval None |
|
|
|
*/ |
|
|
|
PUTCHAR_PROTOTYPE |
|
|
|
{ |
|
|
|
/* Place your implementation of fputc here */ |
|
|
|
/* e.g. write a character to the USART1 and Loop until the end of transmission */ |
|
|
|
HAL_UART_Transmit(&huart1, (uint8_t *)&ch, 1, 0xFFFF); |
|
|
|
|
|
|
|
return ch; |
|
|
|
} |
|
|
|
/* USER CODE END 4 */ |
|
|
|
|
|
|
|
/**
|
|
|
|
|