Mercurial > public > ostc4
comparison Small_CPU/Inc/uartProtocol_Co2.h @ 798:e9eba334b942
Migrated CO2 protocol implementation to new format:
The previous implementation was a monolithic protocol implementation which was not usable together with the multiplexer. The new implementation moves the CO2 implementation into a separate C file and decoubles the upper layer external interface, which is not able to handle DiveO2 and CO2 sensors in parallel without restriction to port assignments.
author | Ideenmodellierer |
---|---|
date | Mon, 07 Aug 2023 20:29:44 +0200 |
parents | |
children | c3dd461ca3f9 |
comparison
equal
deleted
inserted
replaced
797:acf6614dc396 | 798:e9eba334b942 |
---|---|
1 /** | |
2 ****************************************************************************** | |
3 * @file uartProtocol_Co2.h | |
4 * @author heinrichs weikamp gmbh | |
5 * @version V0.0.1 | |
6 * @date 31-Jul-2023 | |
7 * @brief Interface functionality to handle external, UART based CO2 sensors | |
8 * | |
9 @verbatim | |
10 ============================================================================== | |
11 ##### How to use ##### | |
12 ============================================================================== | |
13 @endverbatim | |
14 ****************************************************************************** | |
15 * @attention | |
16 * | |
17 * <h2><center>© COPYRIGHT(c) 2014 heinrichs weikamp</center></h2> | |
18 * | |
19 ****************************************************************************** | |
20 */ | |
21 | |
22 /* Define to prevent recursive inclusion -------------------------------------*/ | |
23 #ifndef UART_PROTOCOL_CO2_H | |
24 #define UART_PROTOCOL_CO2_H | |
25 | |
26 #ifdef __cplusplus | |
27 extern "C" { | |
28 #endif | |
29 | |
30 /* Includes ------------------------------------------------------------------*/ | |
31 #include "configuration.h" | |
32 #include "stm32f4xx_hal.h" | |
33 | |
34 typedef enum | |
35 { | |
36 UART_CO2_INIT = 0, /* Default Status for every sensor type */ | |
37 UART_CO2_IDLE, /* sensor detected and no communication pending */ | |
38 UART_CO2_ERROR, | |
39 UART_CO2_SETUP = 10, /* collecting data needed to be read out of the sensor once at startup */ | |
40 UART_CO2_OPERATING, /* normal operation */ | |
41 UART_CO2_CALIBRATE /* request calibration */ | |
42 } uartCO2Status_t; | |
43 | |
44 typedef enum | |
45 { | |
46 RX_Ready= 0, /* Initial state */ | |
47 RX_DetectStart, /* validate start byte */ | |
48 RX_SelectData, /* Data contained in this frame */ | |
49 RX_Data0, /* Process incoming data */ | |
50 RX_Data1, | |
51 RX_Data2, | |
52 RX_Data3, | |
53 RX_Data4, | |
54 RX_Data5, | |
55 RX_Data6, | |
56 RX_Data7, | |
57 RX_Data8, | |
58 RX_Data9, | |
59 RX_Data10, | |
60 RX_Data11, | |
61 RX_Data12, | |
62 RX_DataComplete | |
63 } receiveState_t; | |
64 | |
65 | |
66 typedef enum | |
67 { | |
68 CO2CMD_MODE_POLL, /* Set operation mode of sensor to polling => only send data if requested */ | |
69 CO2CMD_MODE_STREAM, /* Set operation mode of sensor to streaming => send data every two seconds */ | |
70 CO2CMD_CALIBRATE, /* Calibrate sensor */ | |
71 CO2CMD_GETSCALE, /* Get scaling factor */ | |
72 CO2CMD_GETDATA /* Read sensor data */ | |
73 } co2SensorCmd_t; | |
74 | |
75 | |
76 void uartCo2_Control(void); | |
77 void uartCo2_ProcessData(uint8_t data); | |
78 void uartCo2_SendCmd(uint8_t CO2Cmd, uint8_t *cmdString, uint8_t *cmdLength); | |
79 uint8_t uartCo2_isSensorConnected(); | |
80 | |
81 #endif /* UART_PROTOCOL_CO2_H */ |