diff Small_CPU/Src/uart.c @ 803:96ffad0a4e57

Cleanup initialisation / deinitialization: The UART1 is now deactivated during sleep and will be reactivated with the default baudrate 19200. This avoid unpredicted behavior in case of sleep => awake transitions (always start from scratch)
author Ideenmodellierer
date Thu, 10 Aug 2023 21:30:24 +0200
parents e9eba334b942
children 9602a7338f28
line wrap: on
line diff
--- a/Small_CPU/Src/uart.c	Thu Aug 10 21:27:58 2023 +0200
+++ b/Small_CPU/Src/uart.c	Thu Aug 10 21:30:24 2023 +0200
@@ -55,15 +55,7 @@
 /* regular init */	
 
   huart1.Instance = USART1;
-
-  if(externalInterface_GetUARTProtocol() == 0x04)
-  {
-	  huart1.Init.BaudRate = 19200;
-  }
-  else
-  {
-	  huart1.Init.BaudRate = 9600;
-  }
+  huart1.Init.BaudRate = 19200;
   huart1.Init.WordLength = UART_WORDLENGTH_8B;
   huart1.Init.StopBits = UART_STOPBITS_1;
   huart1.Init.Parity = UART_PARITY_NONE;
@@ -90,6 +82,7 @@
 	HAL_DMA_Abort(&hdma_usart1_rx);
 	HAL_DMA_DeInit(&hdma_usart1_rx);
 	HAL_UART_DeInit(&huart1);
+	dmaActive = 0;
 }
 
 void  MX_USART1_DMA_Init()