ESPHome  2024.10.2
tsl2561.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 namespace esphome {
8 namespace tsl2561 {
9 
18 };
19 
27 };
28 
31  public:
45 
56 
63  void set_is_cs_package(bool package_cs);
64 
65  // ========== INTERNAL METHODS ==========
66  // (In most use cases you won't need these)
67  void setup() override;
68  void dump_config() override;
69  void update() override;
70  float get_setup_priority() const override;
71 
72  bool tsl2561_read_byte(uint8_t a_register, uint8_t *value);
73  bool tsl2561_read_uint(uint8_t a_register, uint16_t *value);
74  bool tsl2561_write_byte(uint8_t a_register, uint8_t value);
75 
76  protected:
78  void read_data_();
79  float calculate_lx_(uint16_t ch0, uint16_t ch1);
80 
83  bool package_cs_{false};
84 };
85 
86 } // namespace tsl2561
87 } // namespace esphome
void set_integration_time(TSL2561IntegrationTime integration_time)
Set the time that sensor values should be accumulated for.
Definition: tsl2561.cpp:141
float calculate_lx_(uint16_t ch0, uint16_t ch1)
Definition: tsl2561.cpp:66
void set_gain(TSL2561Gain gain)
Set the internal gain of the sensor.
Definition: tsl2561.cpp:144
bool tsl2561_read_byte(uint8_t a_register, uint8_t *value)
Definition: tsl2561.cpp:159
void set_is_cs_package(bool package_cs)
The "CS" package of this sensor has a slightly different formula for converting the raw values...
Definition: tsl2561.cpp:145
This class simplifies creating components that periodically check a state.
Definition: component.h:283
AlsGain501 gain
This class includes support for the TSL2561 i2c ambient light sensor.
Definition: tsl2561.h:30
TSL2561IntegrationTime integration_time_
Definition: tsl2561.h:81
bool tsl2561_write_byte(uint8_t a_register, uint8_t value)
Definition: tsl2561.cpp:147
TSL2561IntegrationTime
Enum listing all conversion/integration time settings for the TSL2561.
Definition: tsl2561.h:14
TSL2561Gain
Enum listing all gain settings for the TSL2561.
Definition: tsl2561.h:24
IntegrationTime501 integration_time
float get_setup_priority() const override
Definition: tsl2561.cpp:146
void dump_config() override
Definition: tsl2561.cpp:39
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
bool tsl2561_read_uint(uint8_t a_register, uint16_t *value)
Definition: tsl2561.cpp:150
Base-class for all sensors.
Definition: sensor.h:57
This Class provides the methods to read/write bytes from/to an i2c device.
Definition: i2c.h:133