annotate Small_CPU/Inc/uart.h @ 725:621265ec3d23

Update CO2 sensor implementation: Some updates were needed to get the CO2 sensor code up and running again (menu handling and UART DMA transfer).
author Ideenmodellierer
date Sat, 07 Jan 2023 18:11:52 +0100
parents fceae45b3a69
children d646a0f724a7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 * @file uart.h
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 * @author heinrichs weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 * @version V0.0.1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 * @date 27-March-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 * @brief button control
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 * @attention
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 * <h2><center>&copy; COPYRIGHT(c) 2015 heinrichs weikamp</center></h2>
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 /* Define to prevent recursive inclusion -------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 #ifndef UART_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19 #define UART_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 #ifdef __cplusplus
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22 extern "C" {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25 #include "stm32f4xx_hal.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
27
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
28 typedef enum
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
29 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
30 RX_Ready= 0, /* Initial state */
690
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
31 RX_DetectStart, /* validate start byte */
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
32 RX_SelectData, /* Data contained in this frame */
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
33 RX_Data0, /* Process incoming data */
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
34 RX_Data1,
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
35 RX_Data2,
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
36 RX_Data3,
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
37 RX_Data4,
690
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
38 RX_Data5,
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
39 RX_Data6,
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
40 RX_Data7,
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
41 RX_Data8,
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
42 RX_Data9,
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
43 RX_Data10,
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
44 RX_Data11,
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
45 RX_Data12,
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
46 RX_DataComplete
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
47 } receiveState_t;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
48
704
f1b40364b0af Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents: 690
diff changeset
49 typedef enum
f1b40364b0af Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents: 690
diff changeset
50 {
f1b40364b0af Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents: 690
diff changeset
51 UART_O2_INIT = 0,
f1b40364b0af Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents: 690
diff changeset
52 UART_O2_CHECK, /* send blink command and check if sensor answers */
f1b40364b0af Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents: 690
diff changeset
53 UART_O2_REQ_INFO, /* request information about available internal sensors of sensor */
714
045ff7800501 Added customizable data area for specific sensor data:
Ideenmodellierer
parents: 704
diff changeset
54 UART_O2_REQ_ID, /* request ID of sensor */
704
f1b40364b0af Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents: 690
diff changeset
55 UART_O2_IDLE, /* sensor detected and no communication pending */
f1b40364b0af Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents: 690
diff changeset
56 UART_O2_REQ_O2, /* O2 value has been requested and is in receiption progress */
721
fceae45b3a69 DigO2 added raw data request:
Ideenmodellierer
parents: 714
diff changeset
57 UART_O2_REQ_RAW, /* Request O2 and extended raw data */
704
f1b40364b0af Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents: 690
diff changeset
58 UART_O2_ERROR /* Error state which could not be resolved => only exit via de-/activation cycle */
f1b40364b0af Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents: 690
diff changeset
59 } uartO2Status_t;
f1b40364b0af Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents: 690
diff changeset
60
f1b40364b0af Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents: 690
diff changeset
61
f1b40364b0af Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents: 690
diff changeset
62 typedef enum
f1b40364b0af Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents: 690
diff changeset
63 {
f1b40364b0af Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents: 690
diff changeset
64 O2RX_IDLE = 0, /* no receiption pending */
f1b40364b0af Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents: 690
diff changeset
65 O2RX_CONFIRM, /* check the command echo */
f1b40364b0af Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents: 690
diff changeset
66 O2RX_GETNR, /* extract the sensor number */
f1b40364b0af Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents: 690
diff changeset
67 O2RX_GETO2, /* extract the ppo2 */
f1b40364b0af Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents: 690
diff changeset
68 O2RX_GETTEMP, /* extract the temperature */
f1b40364b0af Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents: 690
diff changeset
69 O2RX_GETSTATUS, /* extract the sensor status */
f1b40364b0af Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents: 690
diff changeset
70 O2RX_GETTYPE, /* extract the sensor type (should be 8) */
f1b40364b0af Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents: 690
diff changeset
71 O2RX_GETCHANNEL, /* extract the number of sensor channels (should be 1) */
f1b40364b0af Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents: 690
diff changeset
72 O2RX_GETVERSION, /* extract the sensor version */
721
fceae45b3a69 DigO2 added raw data request:
Ideenmodellierer
parents: 714
diff changeset
73 O2RX_GETSUBSENSORS, /* extract the available measures (O2, temperature, humidity etc) */
fceae45b3a69 DigO2 added raw data request:
Ideenmodellierer
parents: 714
diff changeset
74 O2RX_GETDPHI, /* extract phase shift */
fceae45b3a69 DigO2 added raw data request:
Ideenmodellierer
parents: 714
diff changeset
75 O2RX_INTENSITY, /* extract intensity of signal */
fceae45b3a69 DigO2 added raw data request:
Ideenmodellierer
parents: 714
diff changeset
76 O2RX_AMBIENTLIGHT, /* extract the intensity of the ambient light */
fceae45b3a69 DigO2 added raw data request:
Ideenmodellierer
parents: 714
diff changeset
77 O2RX_PRESSURE, /* extract pressor within the sensor housing */
fceae45b3a69 DigO2 added raw data request:
Ideenmodellierer
parents: 714
diff changeset
78 O2RX_HUMIDITY /* extract humidity within the sensor housing */
704
f1b40364b0af Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents: 690
diff changeset
79 } uartO2RxState_t;
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
80
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
81 void MX_USART1_UART_Init(void);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
82 void MX_USART1_UART_DeInit(void);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
83 void MX_USART1_DMA_Init(void);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84 uint8_t UART_ButtonAdjust(uint8_t *array);
690
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
85 #ifdef ENABLE_CO2_SUPPORT
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
86 void HandleUARTCO2Data(void);
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
87 #endif
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
88 #ifdef ENABLE_SENTINEL_MODE
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
89 void HandleUARTSentinelData(void);
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
90 #endif
704
f1b40364b0af Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents: 690
diff changeset
91 void HandleUARTDigitalO2(void);
f1b40364b0af Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents: 690
diff changeset
92
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93 #ifdef __cplusplus
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 #endif /* UART_H */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/