ESPHome  2024.11.3
cst816_button.h
Go to the documentation of this file.
1 #pragma once
2 
6 #include "esphome/core/helpers.h"
7 
8 namespace esphome {
9 namespace cst816 {
10 
12  public Component,
13  public CST816ButtonListener,
14  public Parented<CST816Touchscreen> {
15  public:
16  void setup() override {
17  this->parent_->register_button_listener(this);
18  this->publish_initial_state(false);
19  }
20 
21  void dump_config() override { LOG_BINARY_SENSOR("", "CST816 Button", this); }
22 
23  void update_button(bool state) override { this->publish_state(state); }
24 };
25 
26 } // namespace cst816
27 } // namespace esphome
void update_button(bool state) override
Definition: cst816_button.h:23
void publish_initial_state(bool state)
Publish the initial state, this will not make the callback manager send callbacks and is meant only f...
bool state
The current reported state of the binary sensor.
Definition: binary_sensor.h:61
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
Helper class to easily give an object a parent of type T.
Definition: helpers.h:530