Mercurial > public > ostc4
annotate Small_CPU/Inc/uart.h @ 782:9a1bb9e7cb61
Sensor status support for multiplexed DiveO2 sensors:
The sensor status is now provided for every DiveO2 sensor connected to the OSTC => The sensor error detection had to be extended to support the bigger data structure.
author | Ideenmodellierer |
---|---|
date | Mon, 29 May 2023 20:22:15 +0200 |
parents | 0b5f45448eb6 |
children | bb37d4f3e50e |
rev | line source |
---|---|
38 | 1 /** |
2 ****************************************************************************** | |
3 * @file uart.h | |
4 * @author heinrichs weikamp gmbh | |
5 * @version V0.0.1 | |
6 * @date 27-March-2014 | |
7 * @brief button control | |
8 * | |
9 ****************************************************************************** | |
10 * @attention | |
11 * | |
12 * <h2><center>© COPYRIGHT(c) 2015 heinrichs weikamp</center></h2> | |
13 * | |
14 ****************************************************************************** | |
15 */ | |
16 | |
17 /* Define to prevent recursive inclusion -------------------------------------*/ | |
18 #ifndef UART_H | |
19 #define UART_H | |
20 | |
21 #ifdef __cplusplus | |
22 extern "C" { | |
23 #endif | |
24 | |
25 #include "stm32f4xx_hal.h" | |
26 | |
662 | 27 |
28 typedef enum | |
29 { | |
30 RX_Ready= 0, /* Initial state */ | |
690 | 31 RX_DetectStart, /* validate start byte */ |
32 RX_SelectData, /* Data contained in this frame */ | |
662 | 33 RX_Data0, /* Process incoming data */ |
34 RX_Data1, | |
35 RX_Data2, | |
36 RX_Data3, | |
37 RX_Data4, | |
690 | 38 RX_Data5, |
39 RX_Data6, | |
40 RX_Data7, | |
41 RX_Data8, | |
42 RX_Data9, | |
43 RX_Data10, | |
44 RX_Data11, | |
45 RX_Data12, | |
662 | 46 RX_DataComplete |
47 } receiveState_t; | |
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 | 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 { |
729
d646a0f724a7
Added auto detection functionality for sensors connected to the external interface:
Ideenmodellierer
parents:
721
diff
changeset
|
64 O2RX_IDLE = 0, /* no reception pending */ |
704
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 | 73 O2RX_GETSUBSENSORS, /* extract the available measures (O2, temperature, humidity etc) */ |
74 O2RX_GETDPHI, /* extract phase shift */ | |
75 O2RX_INTENSITY, /* extract intensity of signal */ | |
76 O2RX_AMBIENTLIGHT, /* extract the intensity of the ambient light */ | |
77 O2RX_PRESSURE, /* extract pressor within the sensor housing */ | |
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 | 80 |
729
d646a0f724a7
Added auto detection functionality for sensors connected to the external interface:
Ideenmodellierer
parents:
721
diff
changeset
|
81 |
d646a0f724a7
Added auto detection functionality for sensors connected to the external interface:
Ideenmodellierer
parents:
721
diff
changeset
|
82 |
662 | 83 void MX_USART1_UART_Init(void); |
84 void MX_USART1_UART_DeInit(void); | |
85 void MX_USART1_DMA_Init(void); | |
38 | 86 uint8_t UART_ButtonAdjust(uint8_t *array); |
742 | 87 void UART_StartDMA_Receiption(void); |
690 | 88 #ifdef ENABLE_CO2_SUPPORT |
729
d646a0f724a7
Added auto detection functionality for sensors connected to the external interface:
Ideenmodellierer
parents:
721
diff
changeset
|
89 void UART_HandleCO2Data(void); |
690 | 90 #endif |
91 #ifdef ENABLE_SENTINEL_MODE | |
729
d646a0f724a7
Added auto detection functionality for sensors connected to the external interface:
Ideenmodellierer
parents:
721
diff
changeset
|
92 void UART_HandleSentinelData(void); |
690 | 93 #endif |
729
d646a0f724a7
Added auto detection functionality for sensors connected to the external interface:
Ideenmodellierer
parents:
721
diff
changeset
|
94 void UART_HandleDigitalO2(void); |
779
0b5f45448eb6
Added UART multiplexer support for DiveO2:
Ideenmodellierer
parents:
742
diff
changeset
|
95 void UART_MapDigO2_Channel(uint8_t channel, uint8_t muxAddress); |
0b5f45448eb6
Added UART multiplexer support for DiveO2:
Ideenmodellierer
parents:
742
diff
changeset
|
96 void UART_SetDigO2_Channel(uint8_t channel); |
729
d646a0f724a7
Added auto detection functionality for sensors connected to the external interface:
Ideenmodellierer
parents:
721
diff
changeset
|
97 uint8_t UART_isDigO2Connected(); |
d646a0f724a7
Added auto detection functionality for sensors connected to the external interface:
Ideenmodellierer
parents:
721
diff
changeset
|
98 uint8_t UART_isCO2Connected(); |
742 | 99 uint8_t UART_isSentinelConnected(); |
729
d646a0f724a7
Added auto detection functionality for sensors connected to the external interface:
Ideenmodellierer
parents:
721
diff
changeset
|
100 void UART_setTargetChannel(uint8_t channel); |
d646a0f724a7
Added auto detection functionality for sensors connected to the external interface:
Ideenmodellierer
parents:
721
diff
changeset
|
101 |
d646a0f724a7
Added auto detection functionality for sensors connected to the external interface:
Ideenmodellierer
parents:
721
diff
changeset
|
102 |
704
f1b40364b0af
Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents:
690
diff
changeset
|
103 |
38 | 104 #ifdef __cplusplus |
105 } | |
106 #endif | |
107 | |
108 #endif /* UART_H */ | |
109 | |
110 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/ |