ESPHome  2022.6.3
touchscreen_binary_sensor.h
Go to the documentation of this file.
1 #pragma once
2 
7 #include "esphome/core/helpers.h"
8 
9 namespace esphome {
10 namespace touchscreen {
11 
13  public Component,
14  public TouchListener,
15  public Parented<Touchscreen> {
16  public:
17  void setup() override { this->parent_->register_listener(this); }
18 
20  void set_area(int16_t x_min, int16_t x_max, int16_t y_min, int16_t y_max) {
21  this->x_min_ = x_min;
22  this->x_max_ = x_max;
23  this->y_min_ = y_min;
24  this->y_max_ = y_max;
25  }
26 
27  void set_page(display::DisplayPage *page) { this->page_ = page; }
28 
29  void touch(TouchPoint tp) override;
30  void release() override;
31 
32  protected:
33  int16_t x_min_, x_max_, y_min_, y_max_;
35 };
36 
37 } // namespace touchscreen
38 } // namespace esphome
void set_area(int16_t x_min, int16_t x_max, int16_t y_min, int16_t y_max)
Set the touch screen area where the button will detect the touch.
Definition: a4988.cpp:4
Base class for all binary_sensor-type classes.
Definition: binary_sensor.h:26
Helper class to easily give an object a parent of type T.
Definition: helpers.h:494