diff Small_CPU/Src/externalInterface.c @ 932:effadaa3a1f7 Evo_2_23

Cleanup Gnss UART implementation: The first draft of the internal UART implementation was just a copy of the external UART handling. To avoid duplicated code and maintainance issue both UARTs (external/internal 6/1) share the same functions. To enable this a control structure has to be used as function input which defines the none shared resources like DMA control and rx/tx buffers
author Ideenmodellierer
date Sat, 07 Dec 2024 21:28:08 +0100
parents eb4109d7d1e9
children
line wrap: on
line diff
--- a/Small_CPU/Src/externalInterface.c	Tue Dec 03 20:32:51 2024 +0100
+++ b/Small_CPU/Src/externalInterface.c	Sat Dec 07 21:28:08 2024 +0100
@@ -39,6 +39,7 @@
 
 extern SGlobal global;
 extern UART_HandleTypeDef huart1;
+extern sUartComCtrl Uart1Ctrl;
 
 #define ADC_ANSWER_LENGTH		(5u)		/* 3424 will provide addr + 4 data bytes */
 #define ADC_TIMEOUT				(10u)		/* conversion stuck for unknown reason => restart */
@@ -936,7 +937,7 @@
 										tmpSensorMap[EXT_INTERFACE_MUX_OFFSET] = SENSOR_SENTINEL;
 										externalInterface_SwitchUART(EXT_INTERFACE_UART_SENTINEL);
 										externalInterface_CheckBaudrate(SENSOR_SENTINEL);
-										UART_StartDMA_Receiption();
+										UART_StartDMA_Receiption(&Uart1Ctrl);
 									}
 				break;
 
@@ -1144,7 +1145,7 @@
 		if(externalInterface_SensorState[activeSensorId] != UART_COMMON_INIT)
 		{
 			UART_ReadData(pmap[activeSensorId]);
-			UART_WriteData();
+			UART_WriteData(&Uart1Ctrl);
 		}
 		if(externalInterface_SensorState[activeSensorId] == UART_COMMON_INIT)
 		{
@@ -1175,7 +1176,8 @@
 			if((externalInterface_SensorState[activeSensorId] == UART_O2_REQ_O2)		/* timeout */
 					|| (externalInterface_SensorState[activeSensorId] == UART_O2_REQ_RAW)
 					|| (externalInterface_SensorState[activeSensorId] == UART_CO2_OPERATING)
-					|| (externalInterface_SensorState[activeSensorId] == UART_GNSS_GET_PVT))
+					|| (externalInterface_SensorState[activeSensorId] == UART_GNSS_GET_PVT)
+					|| (externalInterface_SensorState[activeSensorId] == UART_GNSS_GET_SAT))
 			{
 				forceMuxChannel = 1;
 				externalInterface_SensorState[activeSensorId] = UART_O2_IDLE;