13 using namespace touchscreen;
22 public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW,
23 spi::CLOCK_PHASE_LEADING, spi::DATA_RATE_2MHZ> {
27 this->display_width_ = x;
28 this->display_height_ = y;
31 void set_calibration(int16_t x_min, int16_t x_max, int16_t y_min, int16_t y_max);
44 void setup()
override;
45 void dump_config()
override;
46 float get_setup_priority()
const override;
63 void update()
override;
83 int16_t x_raw{0}, y_raw{0}, z_raw{0};
87 static int16_t best_two_avg(int16_t x, int16_t y, int16_t z);
88 static int16_t normalize(int16_t
val, int16_t min_val, int16_t max_val);
90 int16_t read_adc_(uint8_t ctrl);
100 uint32_t last_pos_ms_{0};
uint32_t get_report_interval()
void set_irq_pin(InternalGPIOPin *pin)
Set the pin used to detect the touch.
void set_dimensions(int16_t x, int16_t y)
Set the logical touch screen dimensions.
void set_swap_x_y(bool val)
If true the x and y axes will be swapped.
This class simplifies creating components that periodically check a state.
void set_threshold(int16_t threshold)
Set the threshold for the touch detection.
void set_report_interval(uint32_t interval)
Set the interval to report the touch point perodically.
XPT2046TouchscreenStore store_