Pointer Input
Pointer input provides a light and configurable wrapper around lvgl input device driver - specifically designed for mice, with configurable cursor icons.
API Reference
Header File
Classes
-
class PointerInput : public espp::BaseComponent
Light wrapper around LVGL input device driver, specifically designed for pointers / cursors / mice input devices.
Public Types
-
typedef std::function<void(int &x, int &y, bool &left_pressed, bool &right_pressed)> read_fn
Function prototype for getting the latest input data from the pointer.
- Param x
[out] Current x position.
- Param y
[out] Current y position.
- Param left_pressed
[out] Whether the left button is pressed.
- Param right_pressed
[out] Whether the right button is pressed.
Public Functions
-
inline explicit PointerInput(const Config &config)
Initialize and register the input drivers associated with the pointer.
- Parameters
config – Configuration structure for the PointerInput.
-
inline ~PointerInput()
Unregister the input drivers associated with the Pointer.
-
inline lv_indev_t *get_pointer_input_device()
Get a pointer to the LVGL input device driver for the pointer.
- Returns
Pointer to the LVGL input device driver for the pointer.
-
inline lv_obj_t *get_cursor_object()
Get a pointer to the cursor object.
- Returns
Pointer to the cursor object.
-
inline void set_cursor(const lv_image_dsc_t *icon)
Set the cursor to a specific icon.
Note
The icon must be a valid LVGL image descriptor.
- Parameters
icon – The icon to set.
-
inline void set_cursor(lv_obj_t *cursor_obj)
Set the cursor to a specific object.
- Parameters
cursor_obj – The cursor object to set.
-
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 pointer itself.
-
typedef std::function<void(int &x, int &y, bool &left_pressed, bool &right_pressed)> read_fn