795
+ − 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>© 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
798
+ − 34 typedef enum
+ − 35 {
+ − 36 UART_COMMON_INIT = 0, /* Default Status for every sensor type */
+ − 37 UART_COMMON_IDLE, /* sensor detected and no communication pending */
+ − 38 UART_COMMON_ERROR, /* Error message received from sensor */
+ − 39 } uartCommonStatus_t;
795
+ − 40
+ − 41 typedef enum
+ − 42 {
798
+ − 43 UART_O2_INIT = UART_COMMON_INIT, /* Default Status for every sensor type */
+ − 44 UART_O2_IDLE = UART_COMMON_IDLE, /* sensor detected and no communication pending */
+ − 45 UART_O2_ERROR = UART_COMMON_ERROR, /* Error message received from sensor */
+ − 46 UART_O2_CHECK, /* send blink command and check if sensor answers */
+ − 47 UART_O2_REQ_INFO, /* request information about available internal sensors of sensor */
+ − 48 UART_O2_REQ_ID, /* request ID of sensor */
+ − 49 UART_O2_REQ_O2, /* O2 value has been requested and is in receiption progress */
+ − 50 UART_O2_REQ_RAW, /* Request O2 and extended raw data */
795
+ − 51 } uartO2Status_t;
+ − 52
+ − 53
+ − 54 typedef enum
+ − 55 {
+ − 56 O2RX_IDLE = 0, /* no reception pending */
+ − 57 O2RX_CONFIRM, /* check the command echo */
+ − 58 O2RX_GETNR, /* extract the sensor number */
+ − 59 O2RX_GETO2, /* extract the ppo2 */
+ − 60 O2RX_GETTEMP, /* extract the temperature */
+ − 61 O2RX_GETSTATUS, /* extract the sensor status */
+ − 62 O2RX_GETTYPE, /* extract the sensor type (should be 8) */
+ − 63 O2RX_GETCHANNEL, /* extract the number of sensor channels (should be 1) */
+ − 64 O2RX_GETVERSION, /* extract the sensor version */
+ − 65 O2RX_GETSUBSENSORS, /* extract the available measures (O2, temperature, humidity etc) */
+ − 66 O2RX_GETDPHI, /* extract phase shift */
+ − 67 O2RX_INTENSITY, /* extract intensity of signal */
+ − 68 O2RX_AMBIENTLIGHT, /* extract the intensity of the ambient light */
+ − 69 O2RX_PRESSURE, /* extract pressure within the sensor housing */
+ − 70 O2RX_HUMIDITY /* extract humidity within the sensor housing */
+ − 71 } uartO2RxState_t;
+ − 72
+ − 73 void uartO2_Control(void);
+ − 74 void uartO2_ProcessData(uint8_t data);
+ − 75 void uartO2_SetChannel(uint8_t channel);
+ − 76 uint8_t uartO2_isSensorConnected();
+ − 77
+ − 78
+ − 79
+ − 80
+ − 81 #endif /* EXTERNAL_INTERFACE_H */