idfxx 1.0.0
Modern C++23 components for ESP-IDF
Loading...
Searching...
No Matches
touch.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2026 Chris Leishman
3
4#pragma once
5
13#include <idfxx/gpio>
14
15#include <cstdint>
16#include <functional>
17
18struct esp_lcd_touch_s;
19typedef struct esp_lcd_touch_s esp_lcd_touch_t;
21
26namespace idfxx::lcd {
27
37class touch {
38public:
43 typedef std::move_only_function<
44 void(uint16_t* x, uint16_t* y, uint16_t* strength, uint8_t* point_num, uint8_t max_point_num)>
46
70
71 virtual ~touch() = default;
72
73 touch(const touch&) = delete;
74 touch& operator=(const touch&) = delete;
75
80 [[nodiscard]] esp_lcd_touch_handle_t idf_handle() const { return do_idf_handle(); }
81
82protected:
83 touch() = default;
84 touch(touch&&) noexcept = default;
85 touch& operator=(touch&&) noexcept = default;
86
88 [[nodiscard]] virtual esp_lcd_touch_handle_t do_idf_handle() const = 0;
89};
90
91} // namespace idfxx::lcd
A GPIO pin.
Definition gpio.hpp:62
static constexpr gpio nc()
Returns a GPIO representing "not connected".
Definition gpio.hpp:255
level
GPIO output/input level.
Definition gpio.hpp:68
@ low
Logic low (0)
Abstract base class for touch controllers.
Definition touch.hpp:37
virtual ~touch()=default
touch & operator=(const touch &)=delete
touch(touch &&) noexcept=default
esp_lcd_touch_handle_t idf_handle() const
Returns the underlying ESP-IDF handle.
Definition touch.hpp:80
touch(const touch &)=delete
std::move_only_function< void(uint16_t *x, uint16_t *y, uint16_t *strength, uint8_t *point_num, uint8_t max_point_num)> process_coordinates_callback
Callback type for processing touch coordinates.
Definition touch.hpp:45
virtual esp_lcd_touch_handle_t do_idf_handle() const =0
Hook for idf_handle.
LCD driver classes.
Definition color.hpp:21
Configuration structure for touch controllers.
Definition touch.hpp:53
process_coordinates_callback process_coordinates
Callback to apply user adjustments after reading coordinates from the touch controller.
Definition touch.hpp:68
bool mirror_y
Mirror Y after read coordinates.
Definition touch.hpp:65
uint16_t y_max
Y coordinates max (for mirroring)
Definition touch.hpp:55
gpio::level reset_level
Level of reset pin in reset.
Definition touch.hpp:60
bool swap_xy
Swap X and Y after read coordinates.
Definition touch.hpp:63
uint16_t x_max
X coordinates max (for mirroring)
Definition touch.hpp:54
bool mirror_x
Mirror X after read coordinates.
Definition touch.hpp:64
gpio rst_gpio
GPIO number of reset pin.
Definition touch.hpp:57
gpio int_gpio
GPIO number of interrupt pin.
Definition touch.hpp:58
gpio::level interrupt_level
Active level of interrupt pin.
Definition touch.hpp:61
struct esp_lcd_touch_s esp_lcd_touch_t
Definition touch.hpp:19
esp_lcd_touch_t * esp_lcd_touch_handle_t
Definition touch.hpp:20