Mercurial > public > ostc4
annotate Small_CPU/Inc/uartProtocol_Sentinel.h @ 1046:1d7c7a36df15 GasConsumption
Bugfix OSTC5 BT and enabling fast mode:
The OSTC5 BT was operating at default speed of 115200. To enable the faster communication some init steps have been added to set speed to 460800. Having the UART enabled while the module was shut down caused problems during initialisation. To avoid these the BT UART is now initialized after the the module is powered on and deinitialized while the module is switched off.
| author | Ideenmodellierer |
|---|---|
| date | Fri, 14 Nov 2025 18:54:20 +0100 |
| parents | c3dd461ca3f9 |
| 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 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
34 typedef enum |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
35 { |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
36 UART_SENTINEL_INIT = 0, /* Default Status for every sensor type */ |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
37 UART_SENTINEL_IDLE, /* sensor detected and no communication pending */ |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
38 UART_SENTINEL_ERROR, |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
39 UART_SENTINEL_OPERATING, /* normal operation */ |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
40 } uartSentinelStatus_t; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
41 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
42 typedef enum |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
43 { |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
44 SENTRX_Ready= 0, /* Initial state */ |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
45 SENTRX_DetectStart, /* validate start byte */ |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
46 SENTRX_SelectData, /* Data contained in this frame */ |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
47 SENTRX_Data0, /* Process incoming data */ |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
48 SENTRX_Data1, |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
49 SENTRX_Data2, |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
50 SENTRX_Data3, |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
51 SENTRX_Data4, |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
52 SENTRX_Data5, |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
53 SENTRX_Data6, |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
54 SENTRX_Data7, |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
55 SENTRX_Data8, |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
56 SENTRX_Data9, |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
57 SENTRX_Data10, |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
58 SENTRX_Data11, |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
59 SENTRX_Data12, |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
60 SENTRX_DataComplete |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
61 } receiveStateSentinel_t; |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
62 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
63 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
64 void uartSentinel_Control(void); |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
65 void uartSentinel_ProcessData(uint8_t data); |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
66 uint8_t uartSentinel_isSensorConnected(); |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
67 |
|
c3dd461ca3f9
Migrated Sentinel protocol to new UART structure:
Ideenmodellierer
parents:
diff
changeset
|
68 #endif /* UART_PROTOCOL_SENTINEL_H */ |
