ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
veml6040.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace esphome::veml6040 {
8
9// Register values for the IT bits of the configuration register, taken from the VEML6040 datasheet.
10// Each step doubles the integration time and halves the lux per count.
19
21 public:
23 float color_temperature_offset)
24 : glass_attenuation_factor_(glass_attenuation_factor),
25 color_temperature_offset_(color_temperature_offset),
27
28 void setup() override;
29 void dump_config() override;
30 void update() override;
31
32 SUB_SENSOR(red)
33 SUB_SENSOR(green)
34 SUB_SENSOR(blue)
35 SUB_SENSOR(white)
36 SUB_SENSOR(illuminance)
37 SUB_SENSOR(color_temperature)
38
39 protected:
40 uint32_t integration_time_ms_() const { return 40u << this->integration_time_; }
41
42 const float glass_attenuation_factor_;
45 bool data_ready_{false};
46};
47
48} // namespace esphome::veml6040
This class simplifies creating components that periodically check a state.
Definition component.h:532
This Class provides the methods to read/write bytes from/to an i2c device.
Definition i2c.h:144
SUB_SENSOR(red) SUB_SENSOR(green) SUB_SENSOR(blue) SUB_SENSOR(white) SUB_SENSOR(illuminance) SUB_SENSOR(color_temperature) protected const float color_temperature_offset_
Definition veml6040.h:32
VEML6040Component(VEML6040IntegrationTime integration_time, float glass_attenuation_factor, float color_temperature_offset)
Definition veml6040.h:22
const VEML6040IntegrationTime integration_time_
Definition veml6040.h:44
IntegrationTime501 integration_time
@ VEML6040_INTEGRATION_TIME_1280MS
Definition veml6040.h:17
@ VEML6040_INTEGRATION_TIME_160MS
Definition veml6040.h:14
@ VEML6040_INTEGRATION_TIME_80MS
Definition veml6040.h:13
@ VEML6040_INTEGRATION_TIME_40MS
Definition veml6040.h:12
@ VEML6040_INTEGRATION_TIME_320MS
Definition veml6040.h:15
@ VEML6040_INTEGRATION_TIME_640MS
Definition veml6040.h:16
static void uint32_t