ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
apds9930.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace esphome::apds9930 {
8
9class APDS9930Component final : public PollingComponent, public i2c::I2CDevice {
10 SUB_SENSOR(illuminance)
11 SUB_SENSOR(proximity)
12
13 public:
14 void setup() override;
15 void dump_config() override;
16 void update() override;
17
18 void set_led_drive(uint8_t level) { this->led_drive_ = level; }
19 void set_proximity_gain(uint8_t gain) { this->proximity_gain_ = gain; }
20 void set_ambient_gain(uint8_t gain) { this->ambient_gain_ = gain; }
21
22 protected:
23 bool write_reg_(uint8_t reg, uint8_t value);
24
25 uint8_t led_drive_{0};
26 uint8_t proximity_gain_{0};
27 uint8_t ambient_gain_{0};
28};
29
30} // namespace esphome::apds9930
virtual void setup()
Where the component's initialization should happen.
Definition component.cpp:84
This class simplifies creating components that periodically check a state.
Definition component.h:514
bool write_reg_(uint8_t reg, uint8_t value)
Definition apds9930.cpp:64
This Class provides the methods to read/write bytes from/to an i2c device.
Definition i2c.h:132
I2CRegister reg(uint8_t a_register)
calls the I2CRegister constructor
Definition i2c.h:152
AlsGain501 gain