13namespace touchscreen {
15static const uint8_t STATE_RELEASED = 0x00;
16static const uint8_t STATE_PRESSED = 0x01;
17static const uint8_t STATE_UPDATED = 0x02;
18static const uint8_t STATE_RELEASING = 0x04;
19static const uint8_t STATE_CALIBRATE = 0x07;
55 void set_calibration(int16_t x_min, int16_t x_max, int16_t y_min, int16_t y_max) {
73 touches.push_back(i.second);
93 int16_t
normalize_(int16_t
val, int16_t min_val, int16_t max_val,
bool inverted =
false);
This class simplifies creating components that periodically check a state.
virtual void touch(TouchPoint tp)
virtual void update(const TouchPoints_t &tpoints)
void call_setup() override
std::map< uint8_t, TouchPoint > touches_
display::Display * get_display() const
int16_t normalize_(int16_t val, int16_t min_val, int16_t max_val, bool inverted=false)
void attach_interrupt_(InternalGPIOPin *irq_pin, esphome::gpio::InterruptType type)
Call this function to send touch points to the on_touch listener and the binary_sensors.
void set_swap_xy(bool swap)
void set_mirror_y(bool invert_y)
virtual void update_touches()=0
std::vector< TouchListener * > touch_listeners_
void set_mirror_x(bool invert_x)
void set_touch_timeout(uint16_t val)
display::Display * display_
TouchscreenInterrupt store_
Trigger< const TouchPoints_t & > * get_update_trigger()
void set_display(display::Display *display)
void register_listener(TouchListener *listener)
TouchPoints_t get_touches()
Trigger< const TouchPoints_t & > update_trigger_
void set_calibration(int16_t x_min, int16_t x_max, int16_t y_min, int16_t y_max)
Trigger< TouchPoint, const TouchPoints_t & > * get_touch_trigger()
optional< TouchPoint > get_touch()
Trigger< TouchPoint, const TouchPoints_t & > touch_trigger_
void add_raw_touch_position_(uint8_t id, int16_t x_raw, int16_t y_raw, int16_t z_raw=0)
Trigger * get_release_trigger()
std::vector< TouchPoint > TouchPoints_t
Providing packet encoding functions for exchanging data with a remote host.
void swap(optional< T > &x, optional< T > &y) noexcept
static void gpio_intr(TouchscreenInterrupt *store)