diff Small_CPU/Src/scheduler.c @ 704:f1b40364b0af

Added protocol functions for UART DiveO2 sensor: The code has been modified to support the handling of several protocols (including baud rate changes). The data is requested by polling and passed via DMA into a ringbuffer which is then parsed by a cyclic function call in the main loop. At the moment only the O2 values are forwarded but because the sensor send several types of data within a signle message already more is extracted but yet discarded.
author Ideenmodellierer
date Fri, 28 Oct 2022 20:49:21 +0200
parents 52d68cf9994c
children 045ff7800501
line wrap: on
line diff
--- a/Small_CPU/Src/scheduler.c	Fri Oct 28 20:32:24 2022 +0200
+++ b/Small_CPU/Src/scheduler.c	Fri Oct 28 20:49:21 2022 +0200
@@ -318,6 +318,10 @@
 		externalInterface_SwitchADC(global.dataSendToSlave.data.externalInterface_Cmd && EXT_INTERFACE_ADC_ON);
 	}
 
+	if(((global.dataSendToSlave.data.externalInterface_Cmd >> 8) & 0x0F) != externalInterface_GetUARTProtocol())
+	{
+		externalInterface_SwitchUART((global.dataSendToSlave.data.externalInterface_Cmd >> 8) & 0x0F);
+	}
 
 	if(global.dataSendToSlave.data.externalInterface_Cmd & 0x00FF)	/* lowest nibble for commands */
 	{
@@ -523,7 +527,10 @@
 			HandleUARTSentinelData();
 		}
 #endif
-
+		if(global.dataSendToSlave.data.externalInterface_Cmd & EXT_INTERFACE_UART_O2)
+		{
+			HandleUARTDigitalO2();
+		}
 
 		if(ticksdiff >= Scheduler.counterSPIdata100msec * 100 + 10)
 		{
@@ -843,6 +850,11 @@
 		}
 #endif
 
+		if(global.dataSendToSlave.data.externalInterface_Cmd & EXT_INTERFACE_UART_O2)
+		{
+			HandleUARTDigitalO2();
+		}
+
 		/* Evaluate received data at 10 ms, 110 ms, 210 ms,... duration ~<1ms */
 		if(ticksdiff >= Scheduler.counterSPIdata100msec * 100 + 10)
 		{