Mercurial > public > ostc4
annotate Small_CPU/Inc/uartProtocol_O2.h @ 858:08ea8e9d6cfe Evo_2_23
Bugfix initialisation of surface pressure:
A reset of the RTE less than one minute before a dive starts may cause problems in the depth calculation because the default pressure is not set yet. To avoid this the first measured pressure value will now be used as stable surface pressure to close the gap till the stable surface pressure is evaluated.
author | Ideenmodellierer |
---|---|
date | Tue, 07 May 2024 21:12:37 +0200 |
parents | e9eba334b942 |
children |
rev | line source |
---|---|
795
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
1 /** |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
2 ****************************************************************************** |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
3 * @file uartProtocol_O2.h |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
4 * @author heinrichs weikamp gmbh |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
5 * @version V0.0.1 |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
6 * @date 18-Jun-2023 |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
7 * @brief Interface functionality to handle external, UART based O2 sensors |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
8 * |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
9 @verbatim |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
10 ============================================================================== |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
11 ##### How to use ##### |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
12 ============================================================================== |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
13 @endverbatim |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
14 ****************************************************************************** |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
15 * @attention |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
16 * |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
17 * <h2><center>© COPYRIGHT(c) 2014 heinrichs weikamp</center></h2> |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
18 * |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
19 ****************************************************************************** |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
20 */ |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
21 |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
22 /* Define to prevent recursive inclusion -------------------------------------*/ |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
23 #ifndef UART_PROTOCOL_O2_H |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
24 #define UART_PROTOCOL_O2_H |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
25 |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
26 #ifdef __cplusplus |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
27 extern "C" { |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
28 #endif |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
29 |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
30 /* Includes ------------------------------------------------------------------*/ |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
31 #include "configuration.h" |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
32 #include "stm32f4xx_hal.h" |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
33 |
798
e9eba334b942
Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
795
diff
changeset
|
34 typedef enum |
e9eba334b942
Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
795
diff
changeset
|
35 { |
e9eba334b942
Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
795
diff
changeset
|
36 UART_COMMON_INIT = 0, /* Default Status for every sensor type */ |
e9eba334b942
Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
795
diff
changeset
|
37 UART_COMMON_IDLE, /* sensor detected and no communication pending */ |
e9eba334b942
Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
795
diff
changeset
|
38 UART_COMMON_ERROR, /* Error message received from sensor */ |
e9eba334b942
Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
795
diff
changeset
|
39 } uartCommonStatus_t; |
795
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
40 |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
41 typedef enum |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
42 { |
798
e9eba334b942
Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
795
diff
changeset
|
43 UART_O2_INIT = UART_COMMON_INIT, /* Default Status for every sensor type */ |
e9eba334b942
Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
795
diff
changeset
|
44 UART_O2_IDLE = UART_COMMON_IDLE, /* sensor detected and no communication pending */ |
e9eba334b942
Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
795
diff
changeset
|
45 UART_O2_ERROR = UART_COMMON_ERROR, /* Error message received from sensor */ |
e9eba334b942
Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
795
diff
changeset
|
46 UART_O2_CHECK, /* send blink command and check if sensor answers */ |
e9eba334b942
Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
795
diff
changeset
|
47 UART_O2_REQ_INFO, /* request information about available internal sensors of sensor */ |
e9eba334b942
Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
795
diff
changeset
|
48 UART_O2_REQ_ID, /* request ID of sensor */ |
e9eba334b942
Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
795
diff
changeset
|
49 UART_O2_REQ_O2, /* O2 value has been requested and is in receiption progress */ |
e9eba334b942
Migrated CO2 protocol implementation to new format:
Ideenmodellierer
parents:
795
diff
changeset
|
50 UART_O2_REQ_RAW, /* Request O2 and extended raw data */ |
795
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
51 } uartO2Status_t; |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
52 |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
53 |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
54 typedef enum |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
55 { |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
56 O2RX_IDLE = 0, /* no reception pending */ |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
57 O2RX_CONFIRM, /* check the command echo */ |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
58 O2RX_GETNR, /* extract the sensor number */ |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
59 O2RX_GETO2, /* extract the ppo2 */ |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
60 O2RX_GETTEMP, /* extract the temperature */ |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
61 O2RX_GETSTATUS, /* extract the sensor status */ |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
62 O2RX_GETTYPE, /* extract the sensor type (should be 8) */ |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
63 O2RX_GETCHANNEL, /* extract the number of sensor channels (should be 1) */ |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
64 O2RX_GETVERSION, /* extract the sensor version */ |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
65 O2RX_GETSUBSENSORS, /* extract the available measures (O2, temperature, humidity etc) */ |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
66 O2RX_GETDPHI, /* extract phase shift */ |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
67 O2RX_INTENSITY, /* extract intensity of signal */ |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
68 O2RX_AMBIENTLIGHT, /* extract the intensity of the ambient light */ |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
69 O2RX_PRESSURE, /* extract pressure within the sensor housing */ |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
70 O2RX_HUMIDITY /* extract humidity within the sensor housing */ |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
71 } uartO2RxState_t; |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
72 |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
73 void uartO2_Control(void); |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
74 void uartO2_ProcessData(uint8_t data); |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
75 void uartO2_SetChannel(uint8_t channel); |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
76 uint8_t uartO2_isSensorConnected(); |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
77 |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
78 |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
79 |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
80 |
d4083ac09b5d
Moved DiveO2 sensor specific funtionality into separated file:
Ideenmodellierer
parents:
diff
changeset
|
81 #endif /* EXTERNAL_INTERFACE_H */ |