2024-04-20 16:16:20 +02:00
|
|
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
|
|
|
|
#include "TelemetrySensor.h"
|
2024-04-21 14:39:55 +02:00
|
|
|
#include <Adafruit_I2CDevice.h>
|
2024-04-20 16:16:20 +02:00
|
|
|
|
|
|
|
|
class RCWL9620Sensor : public TelemetrySensor
|
|
|
|
|
{
|
|
|
|
|
private:
|
2024-04-21 14:39:55 +02:00
|
|
|
uint8_t _addr;
|
|
|
|
|
TwoWire *_wire;
|
2024-04-20 16:16:20 +02:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual void setup() override;
|
2024-04-21 14:39:55 +02:00
|
|
|
bool begin(uint8_t addr = 0x57, TwoWire *wire = &Wire);
|
|
|
|
|
Adafruit_I2CDevice *i2c_dev = NULL;
|
|
|
|
|
float getDistance();
|
2024-04-20 16:16:20 +02:00
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
RCWL9620Sensor();
|
|
|
|
|
virtual int32_t runOnce() override;
|
|
|
|
|
virtual bool getMetrics(meshtastic_Telemetry *measurement) override;
|
|
|
|
|
};
|