lv_indev.h
API reference for lv_indev.h
Functions
lv_indev_set_type
Set the type of an input device
void lv_indev_set_type(lv_indev_t *indev, lv_indev_type_t indev_type)| Name | Type | Description |
|---|---|---|
indev | lv_indev_t * | pointer to an input device |
indev_type | lv_indev_type_t | the type of the input device from lv_indev_type_t (LV_INDEV_TYPE_...) |
lv_indev_set_read_cb
Set a callback function to read input device data to the indev
void lv_indev_set_read_cb(lv_indev_t *indev, lv_indev_read_cb_t read_cb)| Name | Type | Description |
|---|---|---|
indev | lv_indev_t * | pointer to an input device |
read_cb | lv_indev_read_cb_t | pointer to callback function to read input device data |
lv_indev_set_user_data
Set user data to the indev
void lv_indev_set_user_data(lv_indev_t *indev, void *user_data)| Name | Type | Description |
|---|---|---|
indev | lv_indev_t * | pointer to an input device |
user_data | void * | pointer to user data |
lv_indev_set_driver_data
Set driver data to the indev
void lv_indev_set_driver_data(lv_indev_t *indev, void *driver_data)| Name | Type | Description |
|---|---|---|
indev | lv_indev_t * | pointer to an input device |
driver_data | void * | pointer to driver data |
lv_indev_set_display
Assign a display to the indev
void lv_indev_set_display(lv_indev_t *indev, struct _lv_display_t *disp)| Name | Type | Description |
|---|---|---|
indev | lv_indev_t * | pointer to an input device |
disp | struct _lv_display_t * | pointer to an display |
lv_indev_set_long_press_time
Set long press time to indev
void lv_indev_set_long_press_time(lv_indev_t *indev, uint16_t long_press_time)| Name | Type | Description |
|---|---|---|
indev | lv_indev_t * | pointer to input device |
long_press_time | uint16_t | time long press time in ms |
lv_indev_set_long_press_repeat_time
Set long press repeat time to indev
void lv_indev_set_long_press_repeat_time(lv_indev_t *indev, uint16_t long_press_repeat_time)| Name | Type | Description |
|---|---|---|
indev | lv_indev_t * | pointer to input device |
long_press_repeat_time | uint16_t | long press repeat time in ms |
lv_indev_set_scroll_limit
Set scroll limit to the input device
void lv_indev_set_scroll_limit(lv_indev_t *indev, uint8_t scroll_limit)| Name | Type | Description |
|---|---|---|
indev | lv_indev_t * | pointer to an input device |
scroll_limit | uint8_t | the number of pixels to slide before actually drag the object |
lv_indev_set_scroll_throw
Set scroll throw slow-down to the indev. Greater value means faster slow-down
void lv_indev_set_scroll_throw(lv_indev_t *indev, uint8_t scroll_throw)| Name | Type | Description |
|---|---|---|
indev | lv_indev_t * | pointer to an input device |
scroll_throw | uint8_t | the slow-down in [%] |
lv_indev_set_gesture_min_velocity
Set the minimum velocity threshold for gesture detection. The difference between consecutive points must exceed this value (in pixels) for the movement to be considered fast enough to trigger a gesture.
void lv_indev_set_gesture_min_velocity(lv_indev_t *indev, uint8_t min_velocity)| Name | Type | Description |
|---|---|---|
indev | lv_indev_t * | pointer to an input device |
min_velocity | uint8_t | minimum velocity threshold in pixels (default: 3) |
lv_indev_set_gesture_min_distance
Set the minimum distance threshold for gesture detection. The total distance from the first point to the current point must exceed this value (in pixels) for the movement to be considered large enough to trigger a gesture.
void lv_indev_set_gesture_min_distance(lv_indev_t *indev, uint8_t min_distance)| Name | Type | Description |
|---|---|---|
indev | lv_indev_t * | pointer to an input device |
min_distance | uint8_t | minimum distance threshold in pixels (default: 50) |
lv_indev_set_cursor
Set a cursor for a pointer input device (for LV_INPUT_TYPE_POINTER and LV_INPUT_TYPE_BUTTON)
void lv_indev_set_cursor(lv_indev_t *indev, lv_obj_t *cur_obj)| Name | Type | Description |
|---|---|---|
indev | lv_indev_t * | pointer to an input device |
cur_obj | lv_obj_t * | pointer to an object to be used as cursor |
lv_indev_set_group
Set a destination group for a keypad input device (for LV_INDEV_TYPE_KEYPAD)
void lv_indev_set_group(lv_indev_t *indev, lv_group_t *group)| Name | Type | Description |
|---|---|---|
indev | lv_indev_t * | pointer to an input device |
group | lv_group_t * | pointer to a group |
lv_indev_set_button_points
Set the an array of points for LV_INDEV_TYPE_BUTTON. These points will be assigned to the buttons to press a specific point on the screen
void lv_indev_set_button_points(lv_indev_t *indev, const lv_point_t points[])| Name | Type | Description |
|---|---|---|
indev | lv_indev_t * | pointer to an input device |
points | const lv_point_t | array of points |
lv_indev_set_mode
Set the input device's event model: event-driven mode or timer mode.
void lv_indev_set_mode(lv_indev_t *indev, lv_indev_mode_t mode)| Name | Type | Description |
|---|---|---|
indev | lv_indev_t * | pointer to an input device |
mode | lv_indev_mode_t | the mode of input device |
lv_indev_set_key_remap_cb
Set key remapping callback (LV_INDEV_TYPE_KEYPAD)
void lv_indev_set_key_remap_cb(lv_indev_t *indev, lv_indev_key_remap_cb_t remap_cb)| Name | Type | Description |
|---|---|---|
indev | lv_indev_t * | pointer to an indev |
remap_cb | lv_indev_key_remap_cb_t | remapping function callback. Use NULL to disable callback. |
lv_indev_set_external_data
Attaches external user data and destructor callback to an indev.
Associates custom user data with an LVGL indev and specifies a destructor function that will be automatically invoked when the indev is deleted to properly clean up the associated resources.
void lv_indev_set_external_data(lv_indev_t *indev, void *data, void(*free_cb)(void *data))| Name | Type | Description |
|---|---|---|
indev | lv_indev_t * | Pointer to an indev |
data | void * | User-defined data pointer to associate with the indev |
free_cb | void(*)(void *data) | Callback function for cleaning up ext_data when indev is deleted. Receives ext_data as parameter. NULL means no cleanup required. |
Enums
lv_indev_type_t
Possible input device types
| Name | Description |
|---|---|
LV_INDEV_TYPE_NONE | Uninitialized state |
LV_INDEV_TYPE_POINTER | Touch pad, mouse, external button |
LV_INDEV_TYPE_KEYPAD | Keypad or keyboard |
LV_INDEV_TYPE_BUTTON | External (hardware button) which is assigned to a specific point of the screen |
LV_INDEV_TYPE_ENCODER | Encoder with only Left, Right turn and a Button |
Used by 6 functions
lv_test_indev_get_indev— paramtypelv_test_indev_get_gesture_indev— paramtypelv_evdev_create— paramindev_typelv_evdev_create_fd— paramindev_typelv_libinput_create— paramindev_typelv_indev_set_type— paramindev_type
lv_indev_state_t
States for input devices
| Name | Value |
|---|---|
LV_INDEV_STATE_RELEASED | 0 |
LV_INDEV_STATE_PRESSED |
lv_indev_mode_t
| Name | Value |
|---|---|
LV_INDEV_MODE_NONE | 0 |
LV_INDEV_MODE_TIMER | |
LV_INDEV_MODE_EVENT |
Used by 1 function
lv_indev_set_mode— parammode
lv_indev_gesture_type_t
| Name | Value |
|---|---|
LV_INDEV_GESTURE_NONE | 0 |
LV_INDEV_GESTURE_PINCH | |
LV_INDEV_GESTURE_SWIPE | |
LV_INDEV_GESTURE_ROTATE | |
LV_INDEV_GESTURE_TWO_FINGERS_SWIPE | |
LV_INDEV_GESTURE_SCROLL | |
LV_INDEV_GESTURE_CNT |
Used by 2 functions
lv_indev_set_gesture_data— paramtypelv_event_get_gesture_state— paramtype
Structs
lv_indev_data_t
Data structure passed to an input driver to fill
| Member | Type | Description |
|---|---|---|
gesture_type | lv_indev_gesture_type_t[LV_INDEV_GESTURE_CNT] | |
gesture_data | void *[LV_INDEV_GESTURE_CNT] | |
state | lv_indev_state_t | LV_INDEV_STATE_RELEASED or LV_INDEV_STATE_PRESSED |
point | lv_point_t | For LV_INDEV_TYPE_POINTER the currently pressed point |
key | uint32_t | For LV_INDEV_TYPE_KEYPAD the currently pressed key |
btn_id | uint32_t | For LV_INDEV_TYPE_BUTTON the currently pressed button |
enc_diff | int16_t | For LV_INDEV_TYPE_ENCODER number of steps since the previous read |
timestamp | uint32_t | Initialized to lv_tick_get(). Driver may provide more accurate timestamp for buffered events |
continue_reading | bool | If set to true, the read callback is invoked again, unless the device is in event-driven mode |
Used by 2 functions
lv_indev_set_gesture_data— paramdatalv_indev_gesture_recognizers_set_data— paramdata
Typedefs
lv_indev_read_cb_t
typedef void(* lv_indev_read_cb_t) (lv_indev_t *indev, lv_indev_data_t *data)Used by 2 functions
lv_wayland_update_indevs— paramread_cblv_indev_set_read_cb— paramread_cb
lv_indev_key_remap_cb_t
typedef lv_key_t(* lv_indev_key_remap_cb_t) (lv_indev_t *indev, lv_key_t key)Indev key remapping callback
Used by 1 function
lv_indev_set_key_remap_cb— paramremap_cb
Dependencies
lv_obj_event.hlv_monkey.hlv_test_indev.hlv_test_indev_gesture.hlv_lovyan_gfx.hlv_evdev.hlv_libinput.hlv_nuttx_entry.hlv_nuttx_libuv.hlv_nuttx_mouse.hlv_nuttx_touchscreen.hlv_qnx.hlv_sdl_window.hlv_uefi_indev.hlv_wayland_keyboard.hlv_wayland_pointer.hlv_wayland_pointer_axis.hlv_wayland_touch.hlv_windows_context.hlv_windows_display.hlv_windows_input.hlv_x11.hlv_indev_private.h
Indirect dependencies
How is this guide?
Last updated on