Mercurial > public > ostc4
annotate Small_CPU/Inc/uartProtocol_Sentinel.h @ 1065:1f2067cad41b Icon_Integration
Mixed sensor operation improvment:
A peak detector has been added to the adc measurement to avoid interferance while UART sensor are taking measurement while adc is active. The previous approach to shift adc into time windows where no UART were active had to be replaced because for the CO2 sensor is continously taking samples without providing a sync signal.
In addition the UART MUX switching behavior has been improved (potential rx data received from previous sensor is discarded during channel switch etc.)
| author | Ideenmodellierer |
|---|---|
| date | Mon, 16 Feb 2026 21:27:26 +0100 |
| parents | 785772303f9c |
| children |
| rev | line source |
|---|---|
|
842
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
1 /** |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
2 ****************************************************************************** |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
3 * @file uartProtocol_Sentinel.h |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
4 * @author heinrichs weikamp gmbh |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
5 * @version V0.0.1 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
6 * @date 15-Jan-2024 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
7 * @brief Interface functionality read data from Sentinel rebreather |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
8 * |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
9 @verbatim |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
10 ============================================================================== |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
11 ##### How to use ##### |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
12 ============================================================================== |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
13 @endverbatim |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
14 ****************************************************************************** |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
15 * @attention |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
16 * |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
17 * <h2><center>© COPYRIGHT(c) 2014 heinrichs weikamp</center></h2> |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
18 * |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
19 ****************************************************************************** |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
20 */ |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
21 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
22 /* Define to prevent recursive inclusion -------------------------------------*/ |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
23 #ifndef UART_PROTOCOL_SENTINEL_H |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
24 #define UART_PROTOCOL_SENTINEL_H |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
25 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
26 #ifdef __cplusplus |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
27 extern "C" { |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
28 #endif |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
29 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
30 /* Includes ------------------------------------------------------------------*/ |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
31 #include "configuration.h" |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
32 #include "stm32f4xx_hal.h" |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
33 |
| 1062 | 34 /* Bit flags for different sensor types provided by Sentinel or Red Head/Bare */ |
| 35 | |
| 36 #define SENTINEL_O2 0x01 | |
| 37 #define SENTINEL_CO2 0x02 | |
| 38 #define SENTINEL_PRESSURE 0x04 | |
| 39 #define SENTINEL_TEMPSTICK 0x08 | |
| 40 | |
| 41 | |
| 42 | |
| 43 #define UART_SENTINEL_O2_P 'T' /* Primary O2 sensor */ | |
| 44 #define UART_SENTINEL_O2_S 'S' /* Secondary O2 sensor */ | |
| 45 #define UART_SENTINEL_PRESSURE_O2 'I' /* O2 pressure */ | |
| 46 #define UART_SENTINEL_PRESSURE_D 'J' /* Diluent pressure */ | |
| 47 #define UART_SENTINEL_TEMPSTICK 'Y' /* Sector value of the tempstick */ | |
| 48 | |
|
842
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
49 typedef enum |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
50 { |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
51 UART_SENTINEL_INIT = 0, /* Default Status for every sensor type */ |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
52 UART_SENTINEL_IDLE, /* sensor detected and no communication pending */ |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
53 UART_SENTINEL_ERROR, |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
54 UART_SENTINEL_OPERATING, /* normal operation */ |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
55 } uartSentinelStatus_t; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
56 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
57 typedef enum |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
58 { |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
59 SENTRX_Ready= 0, /* Initial state */ |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
60 SENTRX_DetectStart, /* validate start byte */ |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
61 SENTRX_SelectData, /* Data contained in this frame */ |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
62 SENTRX_Data0, /* Process incoming data */ |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
63 SENTRX_Data1, |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
64 SENTRX_Data2, |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
65 SENTRX_Data3, |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
66 SENTRX_Data4, |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
67 SENTRX_Data5, |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
68 SENTRX_Data6, |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
69 SENTRX_Data7, |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
70 SENTRX_Data8, |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
71 SENTRX_Data9, |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
72 SENTRX_Data10, |
| 1062 | 73 SENTRX_CheckSum, |
|
842
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
74 SENTRX_DataComplete |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
75 } receiveStateSentinel_t; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
76 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
77 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
78 void uartSentinel_Control(void); |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
79 void uartSentinel_ProcessData(uint8_t data); |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
80 uint8_t uartSentinel_isSensorConnected(); |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
81 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
82 #endif /* UART_PROTOCOL_SENTINEL_H */ |
