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
32class touch {
33public:
38 typedef std::move_only_function<
41
48 struct config {
51
54
55 struct {
58 } levels = {};
59
60 struct {
61 unsigned int swap_xy : 1 = 0;
62 unsigned int mirror_x : 1 = 0;
63 unsigned int mirror_y : 1 = 0;
64 } flags = {};
65
68 };
69
70 virtual ~touch() = default;
71
72 touch(const touch&) = delete;
73 touch& operator=(const touch&) = delete;
74
77
78protected:
79 touch() = default;
80};
81
82} // namespace idfxx::lcd
Type-safe set of flags from a scoped enum.
Definition flags.hpp:88
A GPIO pin.
Definition gpio.hpp:61
static constexpr gpio nc()
Returns a GPIO representing "not connected".
Definition gpio.hpp:254
level
GPIO output/input level.
Definition gpio.hpp:67
@ low
Logic low (0)
Abstract base class for touch controllers.
Definition touch.hpp:32
virtual ~touch()=default
touch & operator=(const touch &)=delete
virtual esp_lcd_touch_handle_t idf_handle() const =0
Returns the underlying ESP-IDF handle.
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:40
LCD driver classes.
Definition color.hpp:19
std::expected< T, std::error_code > result
result type wrapping a value or error code.
Definition error.hpp:120
Configuration structure for touch controllers.
Definition touch.hpp:48
gpio::level reset
Level of reset pin in reset.
Definition touch.hpp:56
unsigned int mirror_y
Mirror Y after read coordinates.
Definition touch.hpp:63
process_coordinates_callback process_coordinates
Definition touch.hpp:67
struct idfxx::lcd::touch::config::@2 levels
gpio::level interrupt
Active level of interrupt pin.
Definition touch.hpp:57
uint16_t y_max
Y coordinates max (for mirroring)
Definition touch.hpp:50
uint16_t x_max
X coordinates max (for mirroring)
Definition touch.hpp:49
unsigned int swap_xy
Swap X and Y after read coordinates.
Definition touch.hpp:61
gpio rst_gpio
GPIO number of reset pin.
Definition touch.hpp:52
unsigned int mirror_x
Mirror X after read coordinates.
Definition touch.hpp:62
gpio int_gpio
GPIO number of interrupt pin.
Definition touch.hpp:53
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