ESPHome 2026.1.5
Loading...
Searching...
No Matches
bh1750.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace esphome::bh1750 {
8
14
17 public:
18 // ========== INTERNAL METHODS ==========
19 // (In most use cases you won't need these)
20 void setup() override;
21 void dump_config() override;
22 void update() override;
23 void loop() override;
24 float get_setup_priority() const override;
25
26 protected:
27 // State machine states
35
36 // 4-byte aligned members
39
40 // 1-byte members grouped together to minimize padding
43 uint8_t current_mtreg_{31};
45 uint8_t fine_mtreg_{254};
46 uint8_t active_mtreg_{0};
47
48 // Helper methods
49 bool start_measurement_(BH1750Mode mode, uint8_t mtreg, uint32_t now);
50 bool read_measurement_(float &lx_out);
51 void process_coarse_result_(float lx);
52 void fail_and_reset_();
53};
54
55} // namespace esphome::bh1750
BedjetMode mode
BedJet operating mode.
This class simplifies creating components that periodically check a state.
Definition component.h:525
This class implements support for the i2c-based BH1750 ambient light sensor.
Definition bh1750.h:16
bool start_measurement_(BH1750Mode mode, uint8_t mtreg, uint32_t now)
Definition bh1750.cpp:166
void process_coarse_result_(float lx)
Definition bh1750.cpp:238
void dump_config() override
Definition bh1750.cpp:74
float get_setup_priority() const override
Definition bh1750.cpp:268
bool read_measurement_(float &lx_out)
Definition bh1750.cpp:220
This Class provides the methods to read/write bytes from/to an i2c device.
Definition i2c.h:133
Base-class for all sensors.
Definition sensor.h:42