feat: add delayed uart and runtime mac configuration

This commit is contained in:
2026-04-29 04:35:48 +08:00
parent c9ece65182
commit ac0c464910
7 changed files with 93 additions and 15 deletions
+11 -2
View File
@@ -22,6 +22,9 @@
/* USER CODE BEGIN 0 */
static uint32_t g_usart2_baudrate = 115200u;
static uint32_t g_usart3_baudrate = 115200u;
/* USER CODE END 0 */
UART_HandleTypeDef huart1;
@@ -76,7 +79,7 @@ void MX_USART2_UART_Init(void)
/* USER CODE END USART2_Init 1 */
huart2.Instance = USART2;
huart2.Init.BaudRate = 115200;
huart2.Init.BaudRate = g_usart2_baudrate;
huart2.Init.WordLength = UART_WORDLENGTH_8B;
huart2.Init.StopBits = UART_STOPBITS_1;
huart2.Init.Parity = UART_PARITY_NONE;
@@ -105,7 +108,7 @@ void MX_USART3_UART_Init(void)
/* USER CODE END USART3_Init 1 */
huart3.Instance = USART3;
huart3.Init.BaudRate = 115200;
huart3.Init.BaudRate = g_usart3_baudrate;
huart3.Init.WordLength = UART_WORDLENGTH_8B;
huart3.Init.StopBits = UART_STOPBITS_1;
huart3.Init.Parity = UART_PARITY_NONE;
@@ -396,4 +399,10 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle)
/* USER CODE BEGIN 1 */
void USART_SetConfiguredBaudrates(uint32_t usart2_baudrate, uint32_t usart3_baudrate)
{
g_usart2_baudrate = usart2_baudrate;
g_usart3_baudrate = usart3_baudrate;
}
/* USER CODE END 1 */