ESPHome 2026.3.0-dev
Loading...
Searching...
No Matches
tlc59208f_output.h
Go to the documentation of this file.
1#pragma once
2
7
8namespace esphome {
9namespace tlc59208f {
10
11// 0*: Group dimming, 1: Group blinking
12inline constexpr uint8_t TLC59208F_MODE2_DMBLNK = (1 << 5);
13// 0*: Output change on Stop command, 1: Output change on ACK
14inline constexpr uint8_t TLC59208F_MODE2_OCH = (1 << 3);
15// 0*: WDT disabled, 1: WDT enabled
16inline constexpr uint8_t TLC59208F_MODE2_WDTEN = (1 << 2);
17// WDT timeouts
18inline constexpr uint8_t TLC59208F_MODE2_WDT_5MS = (0 << 0);
19inline constexpr uint8_t TLC59208F_MODE2_WDT_15MS = (1 << 0);
20inline constexpr uint8_t TLC59208F_MODE2_WDT_25MS = (2 << 0);
21inline constexpr uint8_t TLC59208F_MODE2_WDT_35MS = (3 << 0);
22
23class TLC59208FOutput;
24
25class TLC59208FChannel : public output::FloatOutput, public Parented<TLC59208FOutput> {
26 public:
27 void set_channel(uint8_t channel) { channel_ = channel; }
28
29 protected:
30 friend class TLC59208FOutput;
31
32 void write_state(float state) override;
33
34 uint8_t channel_;
35};
36
39 public:
41
43
44 void setup() override;
45 void dump_config() override;
46 float get_setup_priority() const override { return setup_priority::HARDWARE; }
47 void loop() override;
48
49 protected:
51
52 void set_channel_value_(uint8_t channel, uint8_t value) {
53 if (this->pwm_amounts_[channel] != value)
54 this->update_ = true;
55 this->pwm_amounts_[channel] = value;
56 }
57
58 uint8_t mode_;
59
60 uint8_t min_channel_{0xFF};
61 uint8_t max_channel_{0x00};
62 uint8_t pwm_amounts_[256] = {
63 0,
64 };
65 bool update_{true};
66};
67
68} // namespace tlc59208f
69} // namespace esphome
BedjetMode mode
BedJet operating mode.
Helper class to easily give an object a parent of type T.
Definition helpers.h:1618
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:29
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
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7