comparison Small_CPU/Inc/uartProtocol_O2.h @ 795:d4083ac09b5d

Moved DiveO2 sensor specific funtionality into separated file: Having the protocol functions of all sensors within one file made the code hard to ready and created aa risk of interference between the protocols. In furture every (new) sensor should be maintained in its own source file. The ols UART.c does only contain the function which are used by all UART protocols (common functions).
author Ideenmodellierer
date Mon, 31 Jul 2023 19:50:36 +0200
parents
children e9eba334b942
comparison
equal deleted inserted replaced
794:bb37d4f3e50e 795:d4083ac09b5d
1 /**
2 ******************************************************************************
3 * @file uartProtocol_O2.h
4 * @author heinrichs weikamp gmbh
5 * @version V0.0.1
6 * @date 18-Jun-2023
7 * @brief Interface functionality to handle external, UART based O2 sensors
8 *
9 @verbatim
10 ==============================================================================
11 ##### How to use #####
12 ==============================================================================
13 @endverbatim
14 ******************************************************************************
15 * @attention
16 *
17 * <h2><center>&copy; COPYRIGHT(c) 2014 heinrichs weikamp</center></h2>
18 *
19 ******************************************************************************
20 */
21
22 /* Define to prevent recursive inclusion -------------------------------------*/
23 #ifndef UART_PROTOCOL_O2_H
24 #define UART_PROTOCOL_O2_H
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 /* Includes ------------------------------------------------------------------*/
31 #include "configuration.h"
32 #include "stm32f4xx_hal.h"
33
34
35 typedef enum
36 {
37 UART_O2_INIT = 0,
38 UART_O2_CHECK, /* send blink command and check if sensor answers */
39 UART_O2_REQ_INFO, /* request information about available internal sensors of sensor */
40 UART_O2_REQ_ID, /* request ID of sensor */
41 UART_O2_IDLE, /* sensor detected and no communication pending */
42 UART_O2_REQ_O2, /* O2 value has been requested and is in receiption progress */
43 UART_O2_REQ_RAW, /* Request O2 and extended raw data */
44 UART_O2_ERROR /* Error message received from sensor */
45 } uartO2Status_t;
46
47
48 typedef enum
49 {
50 O2RX_IDLE = 0, /* no reception pending */
51 O2RX_CONFIRM, /* check the command echo */
52 O2RX_GETNR, /* extract the sensor number */
53 O2RX_GETO2, /* extract the ppo2 */
54 O2RX_GETTEMP, /* extract the temperature */
55 O2RX_GETSTATUS, /* extract the sensor status */
56 O2RX_GETTYPE, /* extract the sensor type (should be 8) */
57 O2RX_GETCHANNEL, /* extract the number of sensor channels (should be 1) */
58 O2RX_GETVERSION, /* extract the sensor version */
59 O2RX_GETSUBSENSORS, /* extract the available measures (O2, temperature, humidity etc) */
60 O2RX_GETDPHI, /* extract phase shift */
61 O2RX_INTENSITY, /* extract intensity of signal */
62 O2RX_AMBIENTLIGHT, /* extract the intensity of the ambient light */
63 O2RX_PRESSURE, /* extract pressure within the sensor housing */
64 O2RX_HUMIDITY /* extract humidity within the sensor housing */
65 } uartO2RxState_t;
66
67 void uartO2_Control(void);
68 void uartO2_ProcessData(uint8_t data);
69 void uartO2_SetChannel(uint8_t channel);
70 uint8_t uartO2_isSensorConnected();
71
72
73
74
75 #endif /* EXTERNAL_INTERFACE_H */