annotate Small_CPU/Inc/uartProtocol_Co2.h @ 818:40e951cfa443

1.6.4 release
author heinrichsweikamp
date Thu, 14 Sep 2023 13:24:30 +0200
parents e9eba334b942
children c3dd461ca3f9
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 {
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
46 RX_Ready= 0, /* Initial state */
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
47 RX_DetectStart, /* validate start byte */
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
48 RX_SelectData, /* Data contained in this frame */
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
49 RX_Data0, /* Process incoming data */
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
50 RX_Data1,
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
51 RX_Data2,
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
52 RX_Data3,
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
53 RX_Data4,
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
54 RX_Data5,
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
55 RX_Data6,
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
56 RX_Data7,
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
57 RX_Data8,
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
58 RX_Data9,
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
59 RX_Data10,
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
60 RX_Data11,
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
61 RX_Data12,
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
62 RX_DataComplete
e9eba334b942 Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
diff changeset
63 } receiveState_t;
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 */