ESPHome 2026.5.0b1
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::apds9306 {
11
20static const uint8_t MEASUREMENT_BIT_WIDTH_VALUES[] = {20, 19, 18, 17, 16, 13};
21
31static const uint16_t MEASUREMENT_RATE_VALUES[] = {25, 50, 100, 200, 500, 1000, 2000};
32
40static const uint8_t AMBIENT_LIGHT_GAIN_VALUES[] = {1, 3, 6, 9, 18};
41
43 public:
44 void setup() override;
45 float get_setup_priority() const override { return setup_priority::BUS; }
46 void dump_config() override;
47 void update() override;
48 void set_bit_width(MeasurementBitWidth bit_width) { this->bit_width_ = bit_width; }
49 void set_measurement_rate(MeasurementRate measurement_rate) { this->measurement_rate_ = measurement_rate; }
51
52 protected:
58
62};
63
64} // namespace esphome::apds9306
This class simplifies creating components that periodically check a state.
Definition component.h:602
float get_setup_priority() const override
Definition apds9306.h:45
MeasurementBitWidth bit_width_
Definition apds9306.h:59
void set_measurement_rate(MeasurementRate measurement_rate)
Definition apds9306.h:49
AmbientLightGain gain_
Definition apds9306.h:61
void set_bit_width(MeasurementBitWidth bit_width)
Definition apds9306.h:48
void set_ambient_light_gain(AmbientLightGain gain)
Definition apds9306.h:50
void dump_config() override
Definition apds9306.cpp:88
enum esphome::apds9306::APDS9306::ErrorCode NONE
MeasurementRate measurement_rate_
Definition apds9306.h:60
This Class provides the methods to read/write bytes from/to an i2c device.
Definition i2c.h:132
Base-class for all sensors.
Definition sensor.h:47
AlsGain501 gain
constexpr float BUS
For communication buses like i2c/spi.
Definition component.h:37