ESPHome  2024.11.0
ttp229_lsf.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 #include <vector>
8 
9 namespace esphome {
10 namespace ttp229_lsf {
11 
13  public:
14  void set_channel(uint8_t channel) { channel_ = channel; }
15  void process(uint16_t data) { this->publish_state(data & (1 << this->channel_)); }
16 
17  protected:
18  uint8_t channel_;
19 };
20 
22  public:
23  void register_channel(TTP229Channel *channel) { this->channels_.push_back(channel); }
24  void setup() override;
25  void dump_config() override;
26  float get_setup_priority() const override { return setup_priority::DATA; }
27  void loop() override;
28 
29  protected:
30  std::vector<TTP229Channel *> channels_{};
31  enum ErrorCode {
32  NONE = 0,
34  } error_code_{NONE};
35 };
36 
37 } // namespace ttp229_lsf
38 } // namespace esphome
void setup()
void loop()
const float DATA
For components that import data from directly connected sensors like DHT.
Definition: component.cpp:19
void set_channel(uint8_t channel)
Definition: ttp229_lsf.h:14
void process(uint16_t data)
Definition: ttp229_lsf.h:15
float get_setup_priority() const override
Definition: ttp229_lsf.h:26
void publish_state(bool state)
Publish a new state to the front-end.
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
Base class for all binary_sensor-type classes.
Definition: binary_sensor.h:37
This Class provides the methods to read/write bytes from/to an i2c device.
Definition: i2c.h:133
void register_channel(TTP229Channel *channel)
Definition: ttp229_lsf.h:23