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.
45 lines
1.0 KiB
45 lines
1.0 KiB
//
|
|
// Created by zwsd
|
|
//
|
|
|
|
#pragma once
|
|
#include "sdk/hal/zhal.hpp"
|
|
//
|
|
#include "sdk\components\vaisala_sensor\hpp272.hpp"
|
|
#include "sdk\components\zcanreceiver\zcanreceiver.hpp"
|
|
|
|
#ifdef HAL_CAN_MODULE_ENABLED
|
|
namespace iflytop {
|
|
|
|
class H2O2Sensor : public ZCanRceiverListener {
|
|
private:
|
|
ZCanReceiver* m_zcanReceiver;
|
|
uint8_t txbuff[sizeof(hpp272_data_t) + 10];
|
|
int32_t m_sensorId = -1;
|
|
int32_t m_modbusid = -1;
|
|
|
|
hpp272_data_t sensordatacache;
|
|
|
|
ModbusBlockHost modbusBlockHost;
|
|
|
|
public:
|
|
H2O2Sensor(/* args */) {}
|
|
~H2O2Sensor() {}
|
|
|
|
public:
|
|
void initialize(ZCanReceiver* zcanReceiver);
|
|
void regSubmodule(int id, UART_HandleTypeDef* huart, uint8_t modbusid);
|
|
virtual hpp272_data_t* readSensorData();
|
|
|
|
public:
|
|
virtual void onRceivePacket(CanPacketRxBuffer* rxbuf, uint8_t* packet, size_t len);
|
|
virtual void onRceivePacket(Cmdheader_t* cmdheader, int sensorId);
|
|
|
|
private:
|
|
void loop();
|
|
uint32_t readAdcVal();
|
|
uint32_t readAvgAdcVal();
|
|
};
|
|
} // namespace iflytop
|
|
|
|
#endif
|