ESPHome 2026.5.0
Loading...
Searching...
No Matches
tlc59208f_output.h
Go to the documentation of this file.
1#pragma once
2
7
8namespace esphome::tlc59208f {
9
10// 0*: Group dimming, 1: Group blinking
11inline constexpr uint8_t TLC59208F_MODE2_DMBLNK = (1 << 5);
12// 0*: Output change on Stop command, 1: Output change on ACK
13inline constexpr uint8_t TLC59208F_MODE2_OCH = (1 << 3);
14// 0*: WDT disabled, 1: WDT enabled
15inline constexpr uint8_t TLC59208F_MODE2_WDTEN = (1 << 2);
16// WDT timeouts
17inline constexpr uint8_t TLC59208F_MODE2_WDT_5MS = (0 << 0);
18inline constexpr uint8_t TLC59208F_MODE2_WDT_15MS = (1 << 0);
19inline constexpr uint8_t TLC59208F_MODE2_WDT_25MS = (2 << 0);
20inline constexpr uint8_t TLC59208F_MODE2_WDT_35MS = (3 << 0);
21
22class TLC59208FOutput;
23
24class TLC59208FChannel : public output::FloatOutput, public Parented<TLC59208FOutput> {
25 public:
26 void set_channel(uint8_t channel) { channel_ = channel; }
27
28 protected:
29 friend class TLC59208FOutput;
30
31 void write_state(float state) override;
32
33 uint8_t channel_;
34};
35
38 public:
40
42
43 void setup() override;
44 void dump_config() override;
45 float get_setup_priority() const override { return setup_priority::HARDWARE; }
46 void loop() override;
47
48 protected:
50
51 void set_channel_value_(uint8_t channel, uint8_t value) {
52 if (this->pwm_amounts_[channel] != value)
53 this->update_ = true;
54 this->pwm_amounts_[channel] = value;
55 }
56
57 uint8_t mode_;
58
59 uint8_t min_channel_{0xFF};
60 uint8_t max_channel_{0x00};
61 uint8_t pwm_amounts_[256] = {
62 0,
63 };
64 bool update_{true};
65};
66
67} // namespace esphome::tlc59208f
BedjetMode mode
BedJet operating mode.
Helper class to easily give an object a parent of type T.
Definition helpers.h:1861
This Class provides the methods to read/write bytes from/to an i2c device.
Definition i2c.h:132
Base class for all output components that can output a variable level, like PWM.
void write_state(float state) override
TLC59208F float output component.
float get_setup_priority() const override
void set_channel_value_(uint8_t channel, uint8_t value)
void register_channel(TLC59208FChannel *channel)
TLC59208FOutput(uint8_t mode=TLC59208F_MODE2_OCH)
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:41
constexpr uint8_t TLC59208F_MODE2_WDT_35MS
constexpr uint8_t TLC59208F_MODE2_OCH
constexpr uint8_t TLC59208F_MODE2_DMBLNK
constexpr uint8_t TLC59208F_MODE2_WDTEN
constexpr uint8_t TLC59208F_MODE2_WDT_5MS
constexpr uint8_t TLC59208F_MODE2_WDT_25MS
constexpr uint8_t TLC59208F_MODE2_WDT_15MS