Encoder Input

Encoder input provides a light and configurable wrapper around lvgl input device driver - specifically designed for encoders, which have a single incremental input and a single button.

API Reference

Header File

Classes

class EncoderInput : public espp::BaseComponent

Light wrapper around LVGL input device driver, specifically designed for encoders with optional home buttons.

Public Functions

inline explicit EncoderInput(const Config &config)

Initialize and register the input drivers associated with the encoder.

Parameters

config – Configuration structure for the EncoderInput.

inline ~EncoderInput()

Unregister the input drivers associated with the Encoder.

inline lv_indev_t *get_encoder_input_device()

Get the input device driver associated with the encoder.

Returns

The input device driver associated with the encoder.

inline lv_indev_t *get_button_input_device()

Get the input device driver associated with the button.

Returns

The input device driver associated with the 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

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 encoder itself.

Public Members

read_fn read

Input function for the encoder and button itself.

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

Log verbosity for the input driver.