diff Small_CPU/Inc/uart.h @ 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 fca2bd25e6e2
children 045ff7800501
line wrap: on
line diff
--- a/Small_CPU/Inc/uart.h	Fri Oct 28 20:32:24 2022 +0200
+++ b/Small_CPU/Inc/uart.h	Fri Oct 28 20:49:21 2022 +0200
@@ -46,6 +46,31 @@
 	RX_DataComplete
  } receiveState_t;
 
+ typedef enum
+ {
+ 	UART_O2_INIT = 0,
+ 	UART_O2_CHECK,			/* send blink command and check if sensor answers */
+ 	UART_O2_REQ_INFO,		/* request information about available internal sensors of sensor */
+	UART_O2_REQ_ID,		/* request ID of sensor */
+ 	UART_O2_IDLE,			/* sensor detected and no communication pending */
+ 	UART_O2_REQ_O2,			/* O2 value has been requested and is in receiption progress */
+ 	UART_O2_ERROR			/* Error state which could not be resolved => only exit via de-/activation cycle */
+ } uartO2Status_t;
+
+
+ typedef enum
+  {
+	O2RX_IDLE = 0,			/* no receiption pending */
+	O2RX_CONFIRM,			/* check the command echo */
+	O2RX_GETNR,				/* extract the sensor number */
+	O2RX_GETO2,				/* extract the ppo2 */
+	O2RX_GETTEMP,			/* extract the temperature */
+	O2RX_GETSTATUS,			/* extract the sensor status */
+	O2RX_GETTYPE,			/* extract the sensor type (should be 8) */
+	O2RX_GETCHANNEL,		/* extract the number of sensor channels (should be 1) */
+	O2RX_GETVERSION,		/* extract the sensor version */
+	O2RX_GETSUBSENSORS		/* extract the available measures (O2, temperature, humidity etc) */
+  } uartO2RxState_t;
 
 void MX_USART1_UART_Init(void);
 void MX_USART1_UART_DeInit(void);
@@ -57,6 +82,8 @@
 #ifdef ENABLE_SENTINEL_MODE
 void HandleUARTSentinelData(void);
 #endif
+void HandleUARTDigitalO2(void);
+
 #ifdef __cplusplus
 }
 #endif