annotate Small_CPU/Inc/uartProtocol_Co2.h @ 903:0f2e5a166d40 Evo_2_23

Disable GNSS operations using compile switch: GNSS IO operation caused the RTE to not switch into sleep mode in case of wrong HW version => Operations have been disabled by inactive ENABLE_GNSS compile switch
author Ideenmodellierer
date Thu, 03 Oct 2024 20:25:49 +0200
parents c3dd461ca3f9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
798
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
1 /**
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
2 ******************************************************************************
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
3 * @file uartProtocol_Co2.h
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
4 * @author heinrichs weikamp gmbh
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
5 * @version V0.0.1
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
6 * @date 31-Jul-2023
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
7 * @brief Interface functionality to handle external, UART based CO2 sensors
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
8 *
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
9 @verbatim
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
10 ==============================================================================
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
11 ##### How to use #####
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
12 ==============================================================================
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
13 @endverbatim
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
14 ******************************************************************************
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
15 * @attention
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
16 *
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
17 * <h2><center>&copy; COPYRIGHT(c) 2014 heinrichs weikamp</center></h2>
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
18 *
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
19 ******************************************************************************
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
20 */
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
21
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
22 /* Define to prevent recursive inclusion -------------------------------------*/
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
23 #ifndef UART_PROTOCOL_CO2_H
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
24 #define UART_PROTOCOL_CO2_H
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
25
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
26 #ifdef __cplusplus
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
27 extern "C" {
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
28 #endif
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
29
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
30 /* Includes ------------------------------------------------------------------*/
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
31 #include "configuration.h"
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
32 #include "stm32f4xx_hal.h"
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
33
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
34 typedef enum
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
35 {
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
36 UART_CO2_INIT = 0, /* Default Status for every sensor type */
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
37 UART_CO2_IDLE, /* sensor detected and no communication pending */
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
38 UART_CO2_ERROR,
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
39 UART_CO2_SETUP = 10, /* collecting data needed to be read out of the sensor once at startup */
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
40 UART_CO2_OPERATING, /* normal operation */
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
41 UART_CO2_CALIBRATE /* request calibration */
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
42 } uartCO2Status_t;
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
43
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
44 typedef enum
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
45 {
842
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents: 798
diff changeset
46 CO2RX_Ready= 0, /* Initial state */
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents: 798
diff changeset
47 CO2RX_DetectStart, /* validate start byte */
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents: 798
diff changeset
48 CO2RX_SelectData, /* Data contained in this frame */
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents: 798
diff changeset
49 CO2RX_Data0, /* Process incoming data */
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents: 798
diff changeset
50 CO2RX_Data1,
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents: 798
diff changeset
51 CO2RX_Data2,
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents: 798
diff changeset
52 CO2RX_Data3,
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents: 798
diff changeset
53 CO2RX_Data4,
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents: 798
diff changeset
54 CO2RX_Data5,
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents: 798
diff changeset
55 CO2RX_Data6,
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents: 798
diff changeset
56 CO2RX_Data7,
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents: 798
diff changeset
57 CO2RX_Data8,
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents: 798
diff changeset
58 CO2RX_Data9,
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents: 798
diff changeset
59 CO2RX_Data10,
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents: 798
diff changeset
60 CO2RX_Data11,
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents: 798
diff changeset
61 CO2RX_Data12,
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents: 798
diff changeset
62 CO2RX_DataComplete
c3dd461ca3f9 Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents: 798
diff changeset
63 } receiveStateCO2_t;
798
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
64
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
65
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
66 typedef enum
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
67 {
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
68 CO2CMD_MODE_POLL, /* Set operation mode of sensor to polling => only send data if requested */
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
69 CO2CMD_MODE_STREAM, /* Set operation mode of sensor to streaming => send data every two seconds */
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
70 CO2CMD_CALIBRATE, /* Calibrate sensor */
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
71 CO2CMD_GETSCALE, /* Get scaling factor */
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
72 CO2CMD_GETDATA /* Read sensor data */
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
73 } co2SensorCmd_t;
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
74
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
75
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
76 void uartCo2_Control(void);
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
77 void uartCo2_ProcessData(uint8_t data);
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
78 void uartCo2_SendCmd(uint8_t CO2Cmd, uint8_t *cmdString, uint8_t *cmdLength);
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
79 uint8_t uartCo2_isSensorConnected();
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
80
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
81 #endif /* UART_PROTOCOL_CO2_H */