ESPHome  2024.5.0
tlc5971.h
Go to the documentation of this file.
1 #pragma once
2 // TLC5971 12-Channel, 16-Bit PWM LED Driver
3 // https://www.ti.com/lit/ds/symlink/tlc5971.pdf
4 
6 #include "esphome/core/hal.h"
8 #include <vector>
9 
10 namespace esphome {
11 namespace tlc5971 {
12 
13 class TLC5971 : public Component {
14  public:
15  const uint8_t N_CHANNELS_PER_CHIP = 12;
16 
17  void set_data_pin(GPIOPin *data_pin) { data_pin_ = data_pin; }
18  void set_clock_pin(GPIOPin *clock_pin) { clock_pin_ = clock_pin; }
19  void set_num_chips(uint8_t num_chips) { num_chips_ = num_chips; }
20 
21  void setup() override;
22 
23  void dump_config() override;
24 
25  float get_setup_priority() const override { return setup_priority::HARDWARE; }
26 
28  void loop() override;
29 
30  void set_channel_value(uint16_t channel, uint16_t value);
31 
32  protected:
33  void transfer_(uint8_t send);
34 
37  uint8_t num_chips_;
38 
39  std::vector<uint16_t> pwm_amounts_;
40  bool update_{true};
41 };
42 } // namespace tlc5971
43 } // namespace esphome
void set_num_chips(uint8_t num_chips)
Definition: tlc5971.h:19
void set_clock_pin(GPIOPin *clock_pin)
Definition: tlc5971.h:18
const uint8_t N_CHANNELS_PER_CHIP
Definition: tlc5971.h:15
void transfer_(uint8_t send)
Definition: tlc5971.cpp:65
void set_data_pin(GPIOPin *data_pin)
Definition: tlc5971.h:17
const float HARDWARE
For components that deal with hardware and are very important like GPIO switch.
Definition: component.cpp:18
std::vector< uint16_t > pwm_amounts_
Definition: tlc5971.h:39
float get_setup_priority() const override
Definition: tlc5971.h:25
void dump_config() override
Definition: tlc5971.cpp:19
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
Definition: a01nyub.cpp:7
void setup() override
Definition: tlc5971.cpp:9
void set_channel_value(uint16_t channel, uint16_t value)
Definition: tlc5971.cpp:91
void loop() override
Send new values if they were updated.
Definition: tlc5971.cpp:26