ESPHome 2026.6.0-dev
Loading...
Searching...
No Matches
tsl2561.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace esphome::tsl2561 {
8
18
27
30 public:
44
55
62 void set_is_cs_package(bool package_cs);
63
64 // ========== INTERNAL METHODS ==========
65 // (In most use cases you won't need these)
66 void setup() override;
67 void dump_config() override;
68 void update() override;
69
70 bool tsl2561_read_byte(uint8_t a_register, uint8_t *value);
71 bool tsl2561_read_uint(uint8_t a_register, uint16_t *value);
72 bool tsl2561_write_byte(uint8_t a_register, uint8_t value);
73
74 protected:
76 void read_data_();
77 float calculate_lx_(uint16_t ch0, uint16_t ch1);
78
81 bool package_cs_{false};
82};
83
84} // namespace esphome::tsl2561
This class simplifies creating components that periodically check a state.
Definition component.h:585
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
This class includes support for the TSL2561 i2c ambient light sensor.
Definition tsl2561.h:29
TSL2561IntegrationTime integration_time_
Definition tsl2561.h:79
bool tsl2561_write_byte(uint8_t a_register, uint8_t value)
Definition tsl2561.cpp:151
bool tsl2561_read_uint(uint8_t a_register, uint16_t *value)
Definition tsl2561.cpp:154
float calculate_lx_(uint16_t ch0, uint16_t ch1)
Definition tsl2561.cpp:66
bool tsl2561_read_byte(uint8_t a_register, uint8_t *value)
Definition tsl2561.cpp:163
void set_gain(TSL2561Gain gain)
Set the internal gain of the sensor.
Definition tsl2561.cpp:148
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:149
void set_integration_time(TSL2561IntegrationTime integration_time)
Set the time that sensor values should be accumulated for.
Definition tsl2561.cpp:145
AlsGain501 gain
IntegrationTime501 integration_time
TSL2561IntegrationTime
Enum listing all conversion/integration time settings for the TSL2561.
Definition tsl2561.h:13
@ TSL2561_INTEGRATION_14MS
Definition tsl2561.h:14
@ TSL2561_INTEGRATION_402MS
Definition tsl2561.h:16
@ TSL2561_INTEGRATION_101MS
Definition tsl2561.h:15
TSL2561Gain
Enum listing all gain settings for the TSL2561.
Definition tsl2561.h:23