9 static const char *
const TAG =
"tlc59208f";
68 static const uint8_t LDR_OFF = 0x00;
69 static const uint8_t LDR_ON = 0x01;
70 static const uint8_t LDR_PWM = 0x02;
71 static const uint8_t LDR_GRPPWM = 0x03;
74 ESP_LOGCONFIG(TAG,
"Setting up TLC59208FOutputComponent...");
76 ESP_LOGV(TAG,
" Resetting all devices on the bus...");
80 ESP_LOGE(TAG,
"RESET failed");
86 if (!this->
write_byte(TLC59208F_REG_MODE1, TLC59208F_MODE1_AI2 | TLC59208F_MODE1_ALLCALL)) {
87 ESP_LOGE(TAG,
"MODE1 failed");
92 ESP_LOGE(TAG,
"MODE2 failed");
98 if (!this->
write_byte(TLC59208F_REG_LEDOUT0, (LDR_PWM << 6) | (LDR_PWM << 4) | (LDR_PWM << 2) | (LDR_PWM << 0))) {
99 ESP_LOGE(TAG,
"LEDOUT0 failed");
103 if (!this->
write_byte(TLC59208F_REG_LEDOUT1, (LDR_PWM << 6) | (LDR_PWM << 4) | (LDR_PWM << 2) | (LDR_PWM << 0))) {
104 ESP_LOGE(TAG,
"LEDOUT1 failed");
114 ESP_LOGCONFIG(TAG,
"TLC59208F:");
115 ESP_LOGCONFIG(TAG,
" Mode: 0x%02X", this->
mode_);
118 ESP_LOGE(TAG,
"Setting up TLC59208F failed!");
128 ESP_LOGVV(TAG,
"Channel %02u: pwm=%04u ", channel, pwm);
130 uint8_t
reg = TLC59208F_REG_PWM0 + channel;
149 const uint8_t max_duty = 255;
150 const float duty_rounded = roundf(state * max_duty);
151 auto duty =
static_cast<uint8_t
>(duty_rounded);
152 this->parent_->set_channel_value_(this->channel_, duty);
const uint8_t TLC59208F_REG_GROUPPWM
const uint8_t TLC59208F_REG_ALLCALLADR
const uint8_t TLC59208F_MODE1_SLEEP
const uint8_t TLC59208F_REG_LEDOUT1
const uint8_t TLC59208F_REG_PWM0
const uint8_t TLC59208F_MODE1_SUB3
void status_set_warning(const char *message="unspecified")
I2CRegister reg(uint8_t a_register)
calls the I2CRegister constructor
const uint8_t TLC59208F_REG_SUBADR2
const uint8_t TLC59208F_MODE1_AI0
const uint8_t TLC59208F_MODE2_WDT_5MS
void set_parent(T *parent)
Set the parent of this object.
void dump_config() override
const uint8_t TLC59208F_REG_SUBADR1
const uint8_t TLC59208F_MODE1_ALLCALL
const uint8_t TLC59208F_MODE2_WDT_15MS
const uint8_t TLC59208F_REG_SUBADR3
void write_state(float state) override
No error found during execution of method.
void register_channel(TLC59208FChannel *channel)
void status_clear_warning()
const uint8_t TLC59208F_SWRST_ADDR
const uint8_t TLC59208F_REG_LEDOUT0
const uint8_t TLC59208F_MODE2_WDTEN
const uint8_t TLC59208F_MODE1_SUB1
I2CBus * bus_
pointer to I2CBus instance
const uint8_t TLC59208F_MODE2_WDT_25MS
const uint8_t TLC59208F_REG_GROUPFREQ
virtual ErrorCode write(uint8_t address, const uint8_t *buffer, size_t len)
bool write_byte(uint8_t a_register, uint8_t data, bool stop=true)
virtual void mark_failed()
Mark this component as failed.
uint8_t pwm_amounts_[256]
const uint8_t TLC59208F_MODE2_OCH
const uint8_t TLC59208F_MODE2_DMBLNK
const uint8_t TLC59208F_MODE1_AI2
Implementation of SPI Controller mode.
void IRAM_ATTR HOT delayMicroseconds(uint32_t us)
const uint8_t TLC59208F_SWRST_SEQ[2]
const uint8_t TLC59208F_REG_MODE1
const uint8_t TLC59208F_REG_MODE2
const uint8_t TLC59208F_MODE1_AI1
const uint8_t TLC59208F_MODE2_WDT_35MS
const uint8_t TLC59208F_MODE1_SUB2