Mercurial > public > ostc4
annotate Small_CPU/Inc/uart.h @ 797:acf6614dc396
Use mirror sensortype for visualization:
The visualization of O2 sensor data is still based on the three slots. To make the usage of these slots more transparent and easy "mirror" sensortypes have been introduced. These types may be used within the refresh to switch the source. E.g. if only one or two slots are used for O2 values the the third may be used for CO2 data. By using the mirror the datastream does no longer need to be manipulated (copying Co2data in variables named O2xyz).
author | Ideenmodellierer |
---|---|
date | Mon, 31 Jul 2023 20:10:27 +0200 |
parents | bb37d4f3e50e |
children | e9eba334b942 |
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 |
794 | 28 #define BUFFER_NODATA (7u) /* The read function needs a byte which indecated that no data for processing is available.*/ |
29 /* This byte shall never appear in a normal data steam */ | |
30 | |
31 typedef enum | |
32 { | |
33 UART_CO2_INIT = 0, | |
34 UART_CO2_SETUP, /* collecting data needed to be read out of the sensor once at startup */ | |
35 UART_CO2_OPERATING, /* normal operation */ | |
36 } uartCO2Status_t; | |
37 | |
662 | 38 typedef enum |
39 { | |
40 RX_Ready= 0, /* Initial state */ | |
690 | 41 RX_DetectStart, /* validate start byte */ |
42 RX_SelectData, /* Data contained in this frame */ | |
662 | 43 RX_Data0, /* Process incoming data */ |
44 RX_Data1, | |
45 RX_Data2, | |
46 RX_Data3, | |
47 RX_Data4, | |
690 | 48 RX_Data5, |
49 RX_Data6, | |
50 RX_Data7, | |
51 RX_Data8, | |
52 RX_Data9, | |
53 RX_Data10, | |
54 RX_Data11, | |
55 RX_Data12, | |
662 | 56 RX_DataComplete |
57 } receiveState_t; | |
58 | |
704
f1b40364b0af
Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents:
690
diff
changeset
|
59 |
794 | 60 typedef enum |
61 { | |
62 CO2CMD_MODE_POLL, /* Set operation mode of sensor to polling => only send data if requested */ | |
63 CO2CMD_MODE_STREAM, /* Set operation mode of sensor to streaming => send data every two seconds */ | |
64 CO2CMD_CALIBRATE, /* Calibrate sensor */ | |
65 CO2CMD_GETSCALE, /* Get scaling factor */ | |
66 CO2CMD_GETDATA /* Read sensor data */ | |
67 } co2SensorCmd_t; | |
729
d646a0f724a7
Added auto detection functionality for sensors connected to the external interface:
Ideenmodellierer
parents:
721
diff
changeset
|
68 |
662 | 69 void MX_USART1_UART_Init(void); |
70 void MX_USART1_UART_DeInit(void); | |
71 void MX_USART1_DMA_Init(void); | |
38 | 72 uint8_t UART_ButtonAdjust(uint8_t *array); |
742 | 73 void UART_StartDMA_Receiption(void); |
690 | 74 #ifdef ENABLE_CO2_SUPPORT |
729
d646a0f724a7
Added auto detection functionality for sensors connected to the external interface:
Ideenmodellierer
parents:
721
diff
changeset
|
75 void UART_HandleCO2Data(void); |
794 | 76 void DigitalCO2_SendCmd(uint8_t CO2Cmd, uint8_t *cmdString, uint8_t *cmdLength); |
690 | 77 #endif |
78 #ifdef ENABLE_SENTINEL_MODE | |
729
d646a0f724a7
Added auto detection functionality for sensors connected to the external interface:
Ideenmodellierer
parents:
721
diff
changeset
|
79 void UART_HandleSentinelData(void); |
690 | 80 #endif |
729
d646a0f724a7
Added auto detection functionality for sensors connected to the external interface:
Ideenmodellierer
parents:
721
diff
changeset
|
81 uint8_t UART_isCO2Connected(); |
742 | 82 uint8_t UART_isSentinelConnected(); |
729
d646a0f724a7
Added auto detection functionality for sensors connected to the external interface:
Ideenmodellierer
parents:
721
diff
changeset
|
83 void UART_setTargetChannel(uint8_t channel); |
794 | 84 void UART_MUX_SelectAddress(uint8_t muxAddress); |
85 void UART_SendCmdString(uint8_t *cmdString); | |
86 void UART_ReadData(uint8_t sensorType); | |
87 void UART_FlushRxBuffer(void); | |
729
d646a0f724a7
Added auto detection functionality for sensors connected to the external interface:
Ideenmodellierer
parents:
721
diff
changeset
|
88 |
d646a0f724a7
Added auto detection functionality for sensors connected to the external interface:
Ideenmodellierer
parents:
721
diff
changeset
|
89 |
794 | 90 void StringToInt(char *pstr, uint32_t *puInt32); |
91 void StringToUInt64(char *pstr, uint64_t *puint64); | |
704
f1b40364b0af
Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents:
690
diff
changeset
|
92 |
38 | 93 #ifdef __cplusplus |
94 } | |
95 #endif | |
96 | |
97 #endif /* UART_H */ | |
98 | |
99 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/ |