mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-19 08:17:36 +00:00
Add support for Bh1750 Light Sensor (#8376)
* regenerate protobuf with bh1750 TelemetrySensorType * Added wollewald/BH1750_WE@^1.1.10 dependecy * Added support for BH1750 during i2C detection * Create new BH1750Sensor and added in EnvironmentTelemetry * clean code * Attempt to fix protobuf include --------- Co-authored-by: Tom Fifield <tom@tomfifield.net>
This commit is contained in:
21
src/modules/Telemetry/Sensor/BH1750Sensor.h
Normal file
21
src/modules/Telemetry/Sensor/BH1750Sensor.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
#include "configuration.h"
|
||||
|
||||
#if !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && __has_include(<BH1750_WE.h>)
|
||||
|
||||
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
||||
#include "TelemetrySensor.h"
|
||||
#include <BH1750_WE.h>
|
||||
|
||||
class BH1750Sensor : public TelemetrySensor
|
||||
{
|
||||
private:
|
||||
BH1750_WE bh1750;
|
||||
|
||||
public:
|
||||
BH1750Sensor();
|
||||
virtual bool getMetrics(meshtastic_Telemetry *measurement) override;
|
||||
virtual bool initDevice(TwoWire *bus, ScanI2C::FoundDevice *dev) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user