lv_indev.h

API reference for lv_indev.h

Report on GitHub
See Also: Private HeaderThis header has a companion private implementation with internal data structures.lv_indev_private.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)
Parameters
NameTypeDescription
indevlv_indev_t *pointer to an input device
indev_typelv_indev_type_tthe 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)
Parameters
NameTypeDescription
indevlv_indev_t *pointer to an input device
read_cblv_indev_read_cb_tpointer 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)
Parameters
NameTypeDescription
indevlv_indev_t *pointer to an input device
user_datavoid *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)
Parameters
NameTypeDescription
indevlv_indev_t *pointer to an input device
driver_datavoid *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)
Parameters
NameTypeDescription
indevlv_indev_t *pointer to an input device
dispstruct _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)
Parameters
NameTypeDescription
indevlv_indev_t *pointer to input device
long_press_timeuint16_ttime 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)
Parameters
NameTypeDescription
indevlv_indev_t *pointer to input device
long_press_repeat_timeuint16_tlong 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)
Parameters
NameTypeDescription
indevlv_indev_t *pointer to an input device
scroll_limituint8_tthe 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)
Parameters
NameTypeDescription
indevlv_indev_t *pointer to an input device
scroll_throwuint8_tthe 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)
Parameters
NameTypeDescription
indevlv_indev_t *pointer to an input device
min_velocityuint8_tminimum 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)
Parameters
NameTypeDescription
indevlv_indev_t *pointer to an input device
min_distanceuint8_tminimum 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)
Parameters
NameTypeDescription
indevlv_indev_t *pointer to an input device
cur_objlv_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)
Parameters
NameTypeDescription
indevlv_indev_t *pointer to an input device
grouplv_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[])
Parameters
NameTypeDescription
indevlv_indev_t *pointer to an input device
pointsconst lv_point_tarray 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)
Parameters
NameTypeDescription
indevlv_indev_t *pointer to an input device
modelv_indev_mode_tthe 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)
Parameters
NameTypeDescription
indevlv_indev_t *pointer to an indev
remap_cblv_indev_key_remap_cb_tremapping 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))
Parameters
NameTypeDescription
indevlv_indev_t *Pointer to an indev
datavoid *User-defined data pointer to associate with the indev
free_cbvoid(*)(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

NameDescription
LV_INDEV_TYPE_NONEUninitialized state
LV_INDEV_TYPE_POINTERTouch pad, mouse, external button
LV_INDEV_TYPE_KEYPADKeypad or keyboard
LV_INDEV_TYPE_BUTTONExternal (hardware button) which is assigned to a specific point of the screen
LV_INDEV_TYPE_ENCODEREncoder with only Left, Right turn and a Button
Used by 6 functions
  • lv_test_indev_get_indev — param type
  • lv_test_indev_get_gesture_indev — param type
  • lv_evdev_create — param indev_type
  • lv_evdev_create_fd — param indev_type
  • lv_libinput_create — param indev_type
  • lv_indev_set_type — param indev_type

lv_indev_state_t

States for input devices

NameValue
LV_INDEV_STATE_RELEASED0
LV_INDEV_STATE_PRESSED

lv_indev_mode_t

NameValue
LV_INDEV_MODE_NONE0
LV_INDEV_MODE_TIMER
LV_INDEV_MODE_EVENT
Used by 1 function
  • lv_indev_set_mode — param mode

lv_indev_gesture_type_t

NameValue
LV_INDEV_GESTURE_NONE0
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 — param type
  • lv_event_get_gesture_state — param type

Structs

struct

lv_indev_data_t

Data structure passed to an input driver to fill

MemberTypeDescription
gesture_typelv_indev_gesture_type_t[LV_INDEV_GESTURE_CNT]
gesture_datavoid *[LV_INDEV_GESTURE_CNT]
statelv_indev_state_tLV_INDEV_STATE_RELEASED or LV_INDEV_STATE_PRESSED
pointlv_point_tFor LV_INDEV_TYPE_POINTER the currently pressed point
keyuint32_tFor LV_INDEV_TYPE_KEYPAD the currently pressed key
btn_iduint32_tFor LV_INDEV_TYPE_BUTTON the currently pressed button
enc_diffint16_tFor LV_INDEV_TYPE_ENCODER number of steps since the previous read
timestampuint32_tInitialized to lv_tick_get(). Driver may provide more accurate timestamp for buffered events
continue_readingboolIf 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 — param data
  • lv_indev_gesture_recognizers_set_data — param data

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 — param read_cb
  • lv_indev_set_read_cb — param read_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 — param remap_cb

Dependencies

How is this guide?

Last updated on

On this page