Touchpad Input
Touchpad input provides a light and configurable wrapper around lvgl input device driver - specifically designed for touch panels, with an optional home button (part of the touch panel).
API Reference
Header File
Classes
-
class TouchpadInput : public espp::BaseComponent
Light wrapper around LVGL input device driver, specifically designed for touchpads with optional home buttons.
Public Types
-
typedef std::function<void(uint8_t *num_touches, uint16_t *x, uint16_t *y, uint8_t *state)> touchpad_read_fn
Function prototype for getting the latest input data from the touchpad.
- Param num_touches
Number of touch points / presses (pointer to data to be filled).
- Param x
Current x position (pointer to data to be filled).
- Param y
Current y position (pointer to data to be filled).
- Param state
Home button state if there is a home button (pointer to data to be filled).
Public Functions
-
inline explicit TouchpadInput(const Config &config)
Initialize and register the input drivers associated with the touchpad.
- Parameters
config – Configuration structure for the TouchpadInput.
-
inline ~TouchpadInput()
Unregister the input drivers associated with the Touchpad.
-
inline lv_indev_t *get_touchpad_input_device()
Get a pointer to the LVGL input device driver for the touchpad.
- Returns
Pointer to the LVGL input device driver for the touchpad.
-
inline lv_indev_t *get_home_button_input_device()
Get a pointer to the LVGL input device driver for the home button.
- Returns
Pointer to the LVGL input device driver for the home button.
-
inline const std::string &get_name() const
Get the name of the component
Note
This is the tag of the logger
- Returns
A const reference to the name of the component
-
inline void set_log_tag(const std::string_view &tag)
Set the tag for the logger
- Parameters
tag – The tag to use for the logger
-
inline espp::Logger::Verbosity get_log_level() const
Get the log level for the logger
See also
See also
- Returns
The verbosity level of the logger
-
inline void set_log_level(espp::Logger::Verbosity level)
Set the log level for the logger
See also
See also
- Parameters
level – The verbosity level to use for the logger
-
inline void set_log_verbosity(espp::Logger::Verbosity level)
Set the log verbosity for the logger
See also
See also
See also
Note
This is a convenience method that calls set_log_level
- Parameters
level – The verbosity level to use for the logger
-
inline espp::Logger::Verbosity get_log_verbosity() const
Get the log verbosity for the logger
See also
See also
See also
Note
This is a convenience method that calls get_log_level
- Returns
The verbosity level of the logger
-
inline void set_log_rate_limit(std::chrono::duration<float> rate_limit)
Set the rate limit for the logger
See also
Note
Only calls to the logger that have _rate_limit suffix will be rate limited
- Parameters
rate_limit – The rate limit to use for the logger
-
struct Config
Configuration structure, containing the read function for the touchpad itself.
Public Members
-
touchpad_read_fn touchpad_read
Input function for the touchpad itself.
-
bool swap_xy{false}
If true, swap the x/y coordinates retrieved from the touchpad_read_fn.
-
bool invert_x = {false}
If true, Invert the output of the x coordinate.
-
bool invert_y = {false}
If true, Invert the output of the y coordinate.
-
touchpad_read_fn touchpad_read
-
typedef std::function<void(uint8_t *num_touches, uint16_t *x, uint16_t *y, uint8_t *state)> touchpad_read_fn