10static constexpr uint8_t LP5562_REG_ENABLE = 0x00;
11static constexpr uint8_t LP5562_REG_CONFIG = 0x08;
12static constexpr uint8_t LP5562_REG_RESET = 0x0d;
13static constexpr uint8_t LP5562_REG_LED_MAP = 0x70;
15static constexpr uint8_t LP5562_RESET_VALUE = 0xff;
17static constexpr uint8_t LP5562_ENABLE_CHIP_EN = 0x40;
18static constexpr uint8_t LP5562_ENABLE_LOG_EN = 0x80;
19static constexpr uint8_t LP5562_CONFIG_INT_CLK_EN = 0x01;
20static constexpr uint8_t LP5562_LED_MAP_ALL_PWM_REGISTERS = 0x00;
23static const uint8_t LP5562_REG_PWM[4] PROGMEM = {
31static const uint8_t LP5562_REG_CURRENT[4] PROGMEM = {
40 this->
write_byte(LP5562_REG_RESET, LP5562_RESET_VALUE);
44 const uint8_t enable = LP5562_ENABLE_CHIP_EN | (this->
logarithmic_dimming_ ? LP5562_ENABLE_LOG_EN : 0);
50 if (!this->
write_byte(LP5562_REG_CONFIG, LP5562_CONFIG_INT_CLK_EN) ||
51 !this->
write_byte(LP5562_REG_LED_MAP, LP5562_LED_MAP_ALL_PWM_REGISTERS)) {
55 for (
size_t channel = 0; channel < this->
currents_.size(); channel++) {
64 " Logarithmic dimming: %s",
72 const auto duty =
static_cast<uint8_t
>(roundf(
state * 255));
void mark_failed()
Mark this component as failed.
bool status_comm_result(bool ok)
Clears the warning when ok, else sets it with message (default "Communication failed"); returns ok.
bool ESPHOME_ALWAYS_INLINE setup_check(bool ok)
Marks the component failed with message (default "Communication failed") unless ok; returns ok.
bool write_byte(uint8_t a_register, uint8_t data) const
void dump_config() override
bool logarithmic_dimming_
void write_channel(uint8_t channel, float state)
std::array< uint8_t, 4 > currents_
ESPHOME_LOG_TAG(TAG, "lp5562")
void HOT delay(uint32_t ms)
uint8_t progmem_read_byte(const uint8_t *addr)