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

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. #include <stddef.h>
  2. #include <stdio.h>
  3. #include "base/config_service.hpp"
  4. #include "base/device_info.hpp"
  5. #include "usart.h"
  6. #include "zsdk/hmp110/hmp110.hpp"
  7. #include "zsdk/hpp272/hpp272.hpp"
  8. #include "zsdk/modbus/modbus_block_host.hpp"
  9. #include "zsdk/pxx_pressure_sensor_driver/pxx_pressure_sensor_bus.hpp"
  10. #include "zsdk/tmc/ztmc5130.hpp"
  11. #include "zsdk/zadc.hpp"
  12. #include "zsdk/zsdk.hpp"
  13. #include "transmit_disinfection_protocol_v1/transmit_disinfection_protocol_v1.hpp"
  14. void hardware_init();
  15. namespace iflytop {
  16. typedef enum {
  17. kdisconnected,
  18. kconnected,
  19. kerror,
  20. } light_state_t;
  21. class Hardware {
  22. public:
  23. #ifdef H2O2_SENSOR_TYPE_HMP110
  24. ModbusBlockHost m_H2o2Sensor_ModbusBlockHost; //
  25. ZADC m_H2o2Sensor_H2O2Adc; // H2O2传感器控制
  26. HMP110 m_H2o2Sensor_HMP110; // H2O2传感器
  27. int32_t m_h2o2sensor_detectId = -1;
  28. #endif
  29. #ifdef H2O2_SENSOR_TYPE_HPP272
  30. ModbusBlockHost m_H2o2Sensor_ModbusBlockHost; //
  31. HPP272 m_H2o2Sensor_HPP272; // H2O2传感器
  32. int32_t m_h2o2sensor_detectId = -1;
  33. #endif
  34. ZGPIO m_alarmLightR;
  35. ZGPIO m_alarmLightG;
  36. ZGPIO m_alarmLightY;
  37. ZGPIO m_switch_group0; // 拨码开关
  38. ZGPIO m_switch_group1; // 拨码开关
  39. ZGPIO m_switch_group2; // 拨码开关
  40. ZGPIO m_switch_group3; // 拨码开关
  41. ZGPIO m_switch_group4; // 拨码开关
  42. ZGPIO id_from_machine; // 消毒机上的开关
  43. light_state_t m_alarmLightState = kdisconnected;
  44. public:
  45. static Hardware& ins() {
  46. static Hardware ins;
  47. return ins;
  48. }
  49. void init();
  50. int32_t readSwitchGroup();
  51. void setAlarmLight(bool r, bool g, bool y);
  52. void setAlarmLight(light_state_t state);
  53. bool h2o2_sensor_is_online();
  54. int32_t h2o2_sensor_read_calibration_date(int32_t* year, int32_t* month, int32_t* day);
  55. int32_t h2o2_sensor_read_sub_ic_errorcode();
  56. int32_t h2o2_sensor_read_sub_ic_reg(int32_t add, uint16_t* val, size_t len);
  57. int32_t h2o2_sensor_data(report_h2o2_data_t* sensorData);
  58. public:
  59. void onH2O2CaptureThread();
  60. void onAlarmLightThread();
  61. };
  62. } // namespace iflytop