You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
2.1 KiB
81 lines
2.1 KiB
#include <stddef.h>
|
|
#include <stdio.h>
|
|
|
|
#include "base/config_service.hpp"
|
|
#include "base/device_info.hpp"
|
|
#include "usart.h"
|
|
#include "zsdk/hmp110/hmp110.hpp"
|
|
#include "zsdk/hpp272/hpp272.hpp"
|
|
#include "zsdk/modbus/modbus_block_host.hpp"
|
|
#include "zsdk/pxx_pressure_sensor_driver/pxx_pressure_sensor_bus.hpp"
|
|
#include "zsdk/tmc/ztmc5130.hpp"
|
|
#include "zsdk/zadc.hpp"
|
|
#include "zsdk/zsdk.hpp"
|
|
|
|
#include "transmit_disinfection_protocol_v1/transmit_disinfection_protocol_v1.hpp"
|
|
|
|
void hardware_init();
|
|
|
|
namespace iflytop {
|
|
|
|
typedef enum {
|
|
kdisconnected,
|
|
kconnected,
|
|
kerror,
|
|
} light_state_t;
|
|
|
|
class Hardware {
|
|
public:
|
|
#ifdef H2O2_SENSOR_TYPE_HMP110
|
|
ModbusBlockHost m_H2o2Sensor_ModbusBlockHost; //
|
|
ZADC m_H2o2Sensor_H2O2Adc; // H2O2传感器控制
|
|
HMP110 m_H2o2Sensor_HMP110; // H2O2传感器
|
|
int32_t m_h2o2sensor_detectId = -1;
|
|
|
|
#endif
|
|
|
|
#ifdef H2O2_SENSOR_TYPE_HPP272
|
|
ModbusBlockHost m_H2o2Sensor_ModbusBlockHost; //
|
|
HPP272 m_H2o2Sensor_HPP272; // H2O2传感器
|
|
int32_t m_h2o2sensor_detectId = -1;
|
|
#endif
|
|
|
|
ZGPIO m_alarmLightR;
|
|
ZGPIO m_alarmLightG;
|
|
ZGPIO m_alarmLightY;
|
|
|
|
ZGPIO m_switch_group0; // 拨码开关
|
|
ZGPIO m_switch_group1; // 拨码开关
|
|
ZGPIO m_switch_group2; // 拨码开关
|
|
ZGPIO m_switch_group3; // 拨码开关
|
|
ZGPIO m_switch_group4; // 拨码开关
|
|
|
|
ZGPIO id_from_machine; // 消毒机上的开关
|
|
|
|
light_state_t m_alarmLightState = kdisconnected;
|
|
|
|
public:
|
|
static Hardware& ins() {
|
|
static Hardware ins;
|
|
return ins;
|
|
}
|
|
|
|
void init();
|
|
|
|
int32_t readSwitchGroup();
|
|
|
|
void setAlarmLight(bool r, bool g, bool y);
|
|
void setAlarmLight(light_state_t state);
|
|
|
|
bool h2o2_sensor_is_online();
|
|
int32_t h2o2_sensor_read_calibration_date(int32_t* year, int32_t* month, int32_t* day);
|
|
int32_t h2o2_sensor_read_sub_ic_errorcode();
|
|
int32_t h2o2_sensor_read_sub_ic_reg(int32_t add, uint16_t* val, size_t len);
|
|
int32_t h2o2_sensor_data(report_h2o2_data_t* sensorData);
|
|
|
|
public:
|
|
void onH2O2CaptureThread();
|
|
void onAlarmLightThread();
|
|
};
|
|
|
|
} // namespace iflytop
|