ESPHome 2025.5.0
Loading...
Searching...
No Matches
tsl2561.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace esphome {
8namespace tsl2561 {
9
19
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
This class simplifies creating components that periodically check a state.
Definition component.h:301
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
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
bool tsl2561_read_uint(uint8_t a_register, uint16_t *value)
Definition tsl2561.cpp:150
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:159
float get_setup_priority() const override
Definition tsl2561.cpp:146
void set_gain(TSL2561Gain gain)
Set the internal gain of the sensor.
Definition tsl2561.cpp:144
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
void set_integration_time(TSL2561IntegrationTime integration_time)
Set the time that sensor values should be accumulated for.
Definition tsl2561.cpp:141
AlsGain501 gain
IntegrationTime501 integration_time
TSL2561IntegrationTime
Enum listing all conversion/integration time settings for the TSL2561.
Definition tsl2561.h:14
@ TSL2561_INTEGRATION_14MS
Definition tsl2561.h:15
@ TSL2561_INTEGRATION_402MS
Definition tsl2561.h:17
@ TSL2561_INTEGRATION_101MS
Definition tsl2561.h:16
TSL2561Gain
Enum listing all gain settings for the TSL2561.
Definition tsl2561.h:24
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7