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

template<typename T = void>
inline void set_log_tag(const std::string_view&)#

Not available: the tag is fixed at construction (pass it to the constructor). Enable CONFIG_ESPP_LOGGER_MUTABLE_TAG (menuconfig: ESPP Logger -> Mutable tag) to change it afterwards.

inline espp::Logger::Verbosity get_log_level() const#

Get the log level for the logger

Returns:

The verbosity level of the logger

inline void set_log_level(espp::Logger::Verbosity level)#

Set the log level for the logger

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

set_log_level

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

get_log_level

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

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.

Public Members

read_fn read#

Input function for the pointer hardware itself.

int cursor_radius = {8}#

Radius of the cursor object.

Logger::Verbosity log_level = {Logger::Verbosity::WARN}#

Log verbosity for the input driver.