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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 * @file uart.h
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 * @author heinrichs weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 * @version V0.0.1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 * @date 27-March-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 * @brief button control
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 * @attention
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 * <h2><center>&copy; COPYRIGHT(c) 2015 heinrichs weikamp</center></h2>
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 /* Define to prevent recursive inclusion -------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 #ifndef UART_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19 #define UART_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 #ifdef __cplusplus
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22 extern "C" {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25 #include "stm32f4xx_hal.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
27
794
bb37d4f3e50e Restructure UART based sensor handling:
Ideenmodellierer
parents: 779
diff changeset
28 #define BUFFER_NODATA (7u) /* The read function needs a byte which indecated that no data for processing is available.*/
bb37d4f3e50e Restructure UART based sensor handling:
Ideenmodellierer
parents: 779
diff changeset
29 /* This byte shall never appear in a normal data steam */
bb37d4f3e50e Restructure UART based sensor handling:
Ideenmodellierer
parents: 779
diff changeset
30
bb37d4f3e50e Restructure UART based sensor handling:
Ideenmodellierer
parents: 779
diff changeset
31 typedef enum
bb37d4f3e50e Restructure UART based sensor handling:
Ideenmodellierer
parents: 779
diff changeset
32 {
bb37d4f3e50e Restructure UART based sensor handling:
Ideenmodellierer
parents: 779
diff changeset
33 UART_CO2_INIT = 0,
bb37d4f3e50e Restructure UART based sensor handling:
Ideenmodellierer
parents: 779
diff changeset
34 UART_CO2_SETUP, /* collecting data needed to be read out of the sensor once at startup */
bb37d4f3e50e Restructure UART based sensor handling:
Ideenmodellierer
parents: 779
diff changeset
35 UART_CO2_OPERATING, /* normal operation */
bb37d4f3e50e Restructure UART based sensor handling:
Ideenmodellierer
parents: 779
diff changeset
36 } uartCO2Status_t;
bb37d4f3e50e Restructure UART based sensor handling:
Ideenmodellierer
parents: 779
diff changeset
37
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
38 typedef enum
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
39 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
40 RX_Ready= 0, /* Initial state */
690
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
41 RX_DetectStart, /* validate start byte */
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
42 RX_SelectData, /* Data contained in this frame */
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
43 RX_Data0, /* Process incoming data */
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
44 RX_Data1,
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
45 RX_Data2,
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
46 RX_Data3,
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
47 RX_Data4,
690
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
48 RX_Data5,
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
49 RX_Data6,
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
50 RX_Data7,
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
51 RX_Data8,
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
52 RX_Data9,
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
53 RX_Data10,
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
54 RX_Data11,
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
55 RX_Data12,
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
56 RX_DataComplete
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
57 } receiveState_t;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
58
704
f1b40364b0af Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents: 690
diff changeset
59
794
bb37d4f3e50e Restructure UART based sensor handling:
Ideenmodellierer
parents: 779
diff changeset
60 typedef enum
bb37d4f3e50e Restructure UART based sensor handling:
Ideenmodellierer
parents: 779
diff changeset
61 {
bb37d4f3e50e Restructure UART based sensor handling:
Ideenmodellierer
parents: 779
diff changeset
62 CO2CMD_MODE_POLL, /* Set operation mode of sensor to polling => only send data if requested */
bb37d4f3e50e Restructure UART based sensor handling:
Ideenmodellierer
parents: 779
diff changeset
63 CO2CMD_MODE_STREAM, /* Set operation mode of sensor to streaming => send data every two seconds */
bb37d4f3e50e Restructure UART based sensor handling:
Ideenmodellierer
parents: 779
diff changeset
64 CO2CMD_CALIBRATE, /* Calibrate sensor */
bb37d4f3e50e Restructure UART based sensor handling:
Ideenmodellierer
parents: 779
diff changeset
65 CO2CMD_GETSCALE, /* Get scaling factor */
bb37d4f3e50e Restructure UART based sensor handling:
Ideenmodellierer
parents: 779
diff changeset
66 CO2CMD_GETDATA /* Read sensor data */
bb37d4f3e50e Restructure UART based sensor handling:
Ideenmodellierer
parents: 779
diff changeset
67 } co2SensorCmd_t;
729
d646a0f724a7 Added auto detection functionality for sensors connected to the external interface:
Ideenmodellierer
parents: 721
diff changeset
68
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
69 void MX_USART1_UART_Init(void);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
70 void MX_USART1_UART_DeInit(void);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 38
diff changeset
71 void MX_USART1_DMA_Init(void);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 uint8_t UART_ButtonAdjust(uint8_t *array);
742
e23fe82cbf8c Update Sentinel protocol:
Ideenmodellierer
parents: 729
diff changeset
73 void UART_StartDMA_Receiption(void);
690
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
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
bb37d4f3e50e Restructure UART based sensor handling:
Ideenmodellierer
parents: 779
diff changeset
76 void DigitalCO2_SendCmd(uint8_t CO2Cmd, uint8_t *cmdString, uint8_t *cmdLength);
690
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
77 #endif
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
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
fca2bd25e6e2 Added Sentinel protocoll support:
Ideenmodellierer
parents: 662
diff changeset
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
e23fe82cbf8c Update Sentinel protocol:
Ideenmodellierer
parents: 729
diff changeset
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
bb37d4f3e50e Restructure UART based sensor handling:
Ideenmodellierer
parents: 779
diff changeset
84 void UART_MUX_SelectAddress(uint8_t muxAddress);
bb37d4f3e50e Restructure UART based sensor handling:
Ideenmodellierer
parents: 779
diff changeset
85 void UART_SendCmdString(uint8_t *cmdString);
bb37d4f3e50e Restructure UART based sensor handling:
Ideenmodellierer
parents: 779
diff changeset
86 void UART_ReadData(uint8_t sensorType);
bb37d4f3e50e Restructure UART based sensor handling:
Ideenmodellierer
parents: 779
diff changeset
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
bb37d4f3e50e Restructure UART based sensor handling:
Ideenmodellierer
parents: 779
diff changeset
90 void StringToInt(char *pstr, uint32_t *puInt32);
bb37d4f3e50e Restructure UART based sensor handling:
Ideenmodellierer
parents: 779
diff changeset
91 void StringToUInt64(char *pstr, uint64_t *puint64);
704
f1b40364b0af Added protocol functions for UART DiveO2 sensor:
Ideenmodellierer
parents: 690
diff changeset
92
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93 #ifdef __cplusplus
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 #endif /* UART_H */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/