Add TT21100 touchscreen component (#4793)

Co-authored-by: Rajan Patel <rpatel3001@gmail.com>
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
Stefan Rado
2023-07-12 03:19:19 +02:00
committed by GitHub
parent 7a551081ee
commit 5f531ac9b0
11 changed files with 392 additions and 2 deletions
@@ -3,6 +3,11 @@
namespace esphome {
namespace touchscreen {
void TouchscreenBinarySensor::setup() {
this->parent_->register_listener(this);
this->publish_initial_state(false);
}
void TouchscreenBinarySensor::touch(TouchPoint tp) {
bool touched = (tp.x >= this->x_min_ && tp.x <= this->x_max_ && tp.y >= this->y_min_ && tp.y <= this->y_max_);
@@ -14,7 +14,7 @@ class TouchscreenBinarySensor : public binary_sensor::BinarySensor,
public TouchListener,
public Parented<Touchscreen> {
public:
void setup() override { this->parent_->register_listener(this); }
void setup() override;
/// Set the touch screen area where the button will detect the touch.
void set_area(int16_t x_min, int16_t x_max, int16_t y_min, int16_t y_max) {