Mercurial > public > ostc4
annotate Small_CPU/Inc/uartProtocol_Sentinel.h @ 1079:9e1fdb383d86 Icon_Integration
Changed reaction for uart DMA buffer overruns:
In the previous version a DMA was not restarted in case the read pointer is in the chunk which should be filled next. In normal operation this should never happen, in special cases, like debugging, it may occure. In case of an overrun the data may be already outdated and can be discarded. Because of this the new handling of a buffer overflow is to set the read pointer to the start of the chunk => the read function will start with the latest received data. Not yet processed data will be discarded.
| author | Ideenmodellierer |
|---|---|
| date | Sun, 08 Mar 2026 21:04:36 +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 */ |
