2024-04-20 16:16:20 +02:00
|
|
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
|
|
|
|
#include "TelemetrySensor.h"
|
2024-04-21 16:35:41 +02:00
|
|
|
#include <Wire.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-21 16:35:41 +02:00
|
|
|
uint8_t _scl;
|
|
|
|
|
uint8_t _sda;
|
|
|
|
|
uint8_t _speed;
|
2024-04-20 16:16:20 +02:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual void setup() override;
|
2024-04-21 16:35:41 +02:00
|
|
|
void begin(TwoWire *wire = &Wire, uint8_t addr = 0x57, uint8_t sda = -1, uint8_t scl = -1, uint32_t speed = 200000L);
|
2024-04-21 14:39:55 +02:00
|
|
|
float getDistance();
|
2024-04-20 16:16:20 +02:00
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
RCWL9620Sensor();
|
|
|
|
|
virtual int32_t runOnce() override;
|
|
|
|
|
virtual bool getMetrics(meshtastic_Telemetry *measurement) override;
|
|
|
|
|
};
|