ESPHome 2025.5.0
Loading...
Searching...
No Matches
apds9306.h
Go to the documentation of this file.
1// Based on this datasheet:
2// https://www.mouser.ca/datasheet/2/678/AVGO_S_A0002854364_1-2574547.pdf
3
4#pragma once
5
9
10namespace esphome {
11namespace apds9306 {
12
21static const uint8_t MEASUREMENT_BIT_WIDTH_VALUES[] = {20, 19, 18, 17, 16, 13};
22
32static const uint16_t MEASUREMENT_RATE_VALUES[] = {25, 50, 100, 200, 500, 1000, 2000};
33
41static const uint8_t AMBIENT_LIGHT_GAIN_VALUES[] = {1, 3, 6, 9, 18};
42
44 public:
45 void setup() override;
46 float get_setup_priority() const override { return setup_priority::BUS; }
47 void dump_config() override;
48 void update() override;
49 void set_bit_width(MeasurementBitWidth bit_width) { this->bit_width_ = bit_width; }
50 void set_measurement_rate(MeasurementRate measurement_rate) { this->measurement_rate_ = measurement_rate; }
52
53 protected:
59
63};
64
65} // namespace apds9306
66} // namespace esphome
This class simplifies creating components that periodically check a state.
Definition component.h:301
float get_setup_priority() const override
Definition apds9306.h:46
MeasurementBitWidth bit_width_
Definition apds9306.h:60
void set_measurement_rate(MeasurementRate measurement_rate)
Definition apds9306.h:50
AmbientLightGain gain_
Definition apds9306.h:62
void set_bit_width(MeasurementBitWidth bit_width)
Definition apds9306.h:49
void set_ambient_light_gain(AmbientLightGain gain)
Definition apds9306.h:51
void dump_config() override
Definition apds9306.cpp:93
enum esphome::apds9306::APDS9306::ErrorCode NONE
MeasurementRate measurement_rate_
Definition apds9306.h:61
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:57
AlsGain501 gain
const float BUS
For communication buses like i2c/spi.
Definition component.cpp:16
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7