ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
lp5562_output.h
Go to the documentation of this file.
1#pragma once
2
3#include <array>
4
9
10namespace esphome::lp5562 {
11
12class LP5562Output;
13
14class LP5562Channel final : public output::FloatOutput, public Parented<LP5562Output> {
15 public:
16 void set_channel(uint8_t channel) { this->channel_ = channel; }
17
18 protected:
19 void write_state(float state) override;
20
21 uint8_t channel_{0};
22};
23
25class LP5562Output final : public Component, public i2c::I2CDevice {
26 public:
27 void setup() override;
28 void dump_config() override;
29 float get_setup_priority() const override { return setup_priority::HARDWARE; }
30
31 void set_logarithmic_dimming(bool logarithmic_dimming) { this->logarithmic_dimming_ = logarithmic_dimming; }
33 void set_channel_current(uint8_t channel, uint8_t current) { this->currents_[channel] = current; }
34
35 protected:
36 friend class LP5562Channel;
37
38 void set_channel_value_(uint8_t channel, uint8_t value);
39
40 // 17.5 mA, the chip's reset value
41 std::array<uint8_t, 4> currents_{175, 175, 175, 175};
43};
44
45} // namespace esphome::lp5562
Helper class to easily give an object a parent of type T.
Definition helpers.h:1997
This Class provides the methods to read/write bytes from/to an i2c device.
Definition i2c.h:132
void set_channel(uint8_t channel)
void write_state(float state) override
LP5562 4-channel (RGBW) I2C LED driver.
void set_channel_value_(uint8_t channel, uint8_t value)
void set_logarithmic_dimming(bool logarithmic_dimming)
std::array< uint8_t, 4 > currents_
float get_setup_priority() const override
void set_channel_current(uint8_t channel, uint8_t current)
Current limit of a channel in steps of 0.1 mA, written to the chip in setup().
Base class for all output components that can output a variable level, like PWM.
bool state
Definition fan.h:2
constexpr float HARDWARE
For components that deal with hardware and are very important like GPIO switch.
Definition component.h:43