#ifndef __SENSOR_H #define __SENSOR_H #include "main.h" #include "fifo.h" #include "usart_user.h" #define SENSOR_DATA_LENGTH 64 #define NH3_DATA_LENGTH 9 #define H2S_DATA_LENGTH 9 #define PM2D5_DATA_LENGTH 32 #define CH2O_DATA_LENGTH 9 #define CO2_DATA_LENGTH 9 #define O3_DATA_LENGTH 9 enum DEVICE_TYPE { NH3_TYPE = 0, H2S_TYPE, PM25_TYPE, CH2O_TYPE, CO2_TYPE, O3_TYPE }; typedef struct sensor_parse_control_st{ //osSemaphoreId recvBinarySemHandle; uint8_t type; RingBuff_t recvRingBuff; uint8_t sensorData[SENSOR_DATA_LENGTH]; uint8_t data_length; void (*function) (RingBuff_t *ringBuff); }sensor_parse_ctrl_t; typedef struct { float temperature; float humidity; float nh3; float h2s; float ch2o; int o3; int co2; int tvoc; int pm25; int pm10; uint8_t symbol; uint8_t temperature1; uint8_t temperature2; uint8_t humidity1; uint8_t humidity2; uint8_t nh31; uint8_t nh32; uint8_t h2s1; uint8_t h2s2; uint8_t ch2o1; uint8_t ch2o2; uint8_t co21; uint8_t co22; uint8_t o31; uint8_t o32; uint8_t tvoca; uint8_t tvocb; uint8_t pm251; uint8_t pm252; uint8_t pm101; uint8_t pm102; }SensorDataTypeDef; extern sensor_parse_ctrl_t nh3; extern sensor_parse_ctrl_t h2s; extern sensor_parse_ctrl_t co2; extern sensor_parse_ctrl_t pm25; extern sensor_parse_ctrl_t ch2o; extern sensor_parse_ctrl_t o3; extern SensorDataTypeDef sensorData; void InitSonsorData(SensorDataTypeDef *sensorData); void InitSonsorCtrlData(sensor_parse_ctrl_t *sensor_parse_ctrl, uint8_t data_length, uint8_t type); void SensorModeInitSet(void); void GetSensorData(void); void ReadSensorData(sensor_parse_ctrl_t *sensor_parse_ctrl); void AnalysisSensorData(sensor_parse_ctrl_t *sensor_parse_ctrl); #endif /* __FIFO_H */