lv_indev.h
Typedefs
-
typedef void (*lv_indev_read_cb_t)(lv_indev_t *indev, lv_indev_data_t *data)
Enums
-
enum lv_indev_type_t
Possible input device types
Values:
-
enumerator LV_INDEV_TYPE_NONE
Uninitialized state
-
enumerator LV_INDEV_TYPE_POINTER
Touch pad, mouse, external button
-
enumerator LV_INDEV_TYPE_KEYPAD
Keypad or keyboard
-
enumerator LV_INDEV_TYPE_BUTTON
External (hardware button) which is assigned to a specific point of the screen
-
enumerator LV_INDEV_TYPE_ENCODER
Encoder with only Left, Right turn and a Button
-
enumerator LV_INDEV_TYPE_NONE
Functions
-
lv_indev_t *lv_indev_create(void)
Create an indev
- 返回:
Pointer to the created indev or NULL when allocation failed
-
void lv_indev_delete(lv_indev_t *indev)
Remove the provided input device. Make sure not to use the provided input device afterwards anymore.
- 参数:
indev -- pointer to delete
-
lv_indev_t *lv_indev_get_next(lv_indev_t *indev)
Get the next input device.
- 参数:
indev -- pointer to the current input device. NULL to initialize.
- 返回:
the next input device or NULL if there are no more. Provide the first input device when the parameter is NULL
-
void lv_indev_read(lv_indev_t *indev)
Read data from an input device.
- 参数:
indev -- pointer to an input device
-
void lv_indev_read_timer_cb(lv_timer_t *timer)
Called periodically to read the input devices
- 参数:
timer -- pointer to a timer to read
-
void lv_indev_enable(lv_indev_t *indev, bool enable)
Enable or disable one or all input devices (default enabled)
- 参数:
indev -- pointer to an input device or NULL to enable/disable all of them
enable -- true to enable, false to disable
-
lv_indev_t *lv_indev_active(void)
Get the currently processed input device. Can be used in action functions too.
- 返回:
pointer to the currently processed input device or NULL if no input device processing right now
-
void lv_indev_set_type(lv_indev_t *indev, lv_indev_type_t indev_type)
Set the type of an input device
- 参数:
indev -- pointer to an input device
indev_type -- the type of the input device from
lv_indev_type_t
(LV_INDEV_TYPE_...
)
-
void lv_indev_set_read_cb(lv_indev_t *indev, lv_indev_read_cb_t read_cb)
Set a callback function to read input device data to the indev
- 参数:
indev -- pointer to an input device
read_cb -- pointer to callback function to read input device data
-
void lv_indev_set_user_data(lv_indev_t *indev, void *user_data)
Set user data to the indev
- 参数:
indev -- pointer to an input device
user_data -- pointer to user data
-
void lv_indev_set_driver_data(lv_indev_t *indev, void *driver_data)
Set driver data to the indev
- 参数:
indev -- pointer to an input device
driver_data -- pointer to driver data
-
void lv_indev_set_display(lv_indev_t *indev, struct _lv_display_t *disp)
Assign a display to the indev
- 参数:
indev -- pointer to an input device
disp -- pointer to an display
-
lv_indev_type_t lv_indev_get_type(const lv_indev_t *indev)
Get the type of an input device
- 参数:
indev -- pointer to an input device
- 返回:
the type of the input device from
lv_hal_indev_type_t
(LV_INDEV_TYPE_...
)
-
lv_indev_read_cb_t lv_indev_get_read_cb(lv_indev_t *indev)
Get the callback function to read input device data to the indev
- 参数:
indev -- pointer to an input device
- 返回:
Pointer to callback function to read input device data or NULL if indev is NULL
-
lv_indev_state_t lv_indev_get_state(const lv_indev_t *indev)
Get the indev state
- 参数:
indev -- pointer to an input device
- 返回:
Indev state or LV_INDEV_STATE_RELEASED if indev is NULL
-
lv_group_t *lv_indev_get_group(const lv_indev_t *indev)
Get the indev assigned group
- 参数:
indev -- pointer to an input device
- 返回:
Pointer to indev assigned group or NULL if indev is NULL
-
lv_display_t *lv_indev_get_display(const lv_indev_t *indev)
Get a pointer to the assigned display of the indev
- 参数:
indev -- pointer to an input device
- 返回:
pointer to the assigned display or NULL if indev is NULL
-
void *lv_indev_get_user_data(const lv_indev_t *indev)
Get a pointer to the user data of the indev
- 参数:
indev -- pointer to an input device
- 返回:
pointer to the user data or NULL if indev is NULL
-
void *lv_indev_get_driver_data(const lv_indev_t *indev)
Get a pointer to the driver data of the indev
- 参数:
indev -- pointer to an input device
- 返回:
pointer to the driver data or NULL if indev is NULL
-
void lv_indev_reset(lv_indev_t *indev, lv_obj_t *obj)
Reset one or all input devices
- 参数:
indev -- pointer to an input device to reset or NULL to reset all of them
obj -- pointer to an object which triggers the reset.
-
void lv_indev_reset_long_press(lv_indev_t *indev)
Reset the long press state of an input device
- 参数:
indev -- pointer to an input device
-
void lv_indev_set_cursor(lv_indev_t *indev, lv_obj_t *cur_obj)
Set a cursor for a pointer input device (for LV_INPUT_TYPE_POINTER and LV_INPUT_TYPE_BUTTON)
- 参数:
indev -- pointer to an input device
cur_obj -- pointer to an object to be used as cursor
-
void lv_indev_set_group(lv_indev_t *indev, lv_group_t *group)
Set a destination group for a keypad input device (for LV_INDEV_TYPE_KEYPAD)
- 参数:
indev -- pointer to an input device
group -- pointer to a group
-
void lv_indev_set_button_points(lv_indev_t *indev, const lv_point_t 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
- 参数:
indev -- pointer to an input device
points -- array of points
-
void lv_indev_get_point(const lv_indev_t *indev, lv_point_t *point)
Get the last point of an input device (for LV_INDEV_TYPE_POINTER and LV_INDEV_TYPE_BUTTON)
- 参数:
indev -- pointer to an input device
point -- pointer to a point to store the result
-
lv_dir_t lv_indev_get_gesture_dir(const lv_indev_t *indev)
Get the current gesture direct
- 参数:
indev -- pointer to an input device
- 返回:
current gesture direct
-
uint32_t lv_indev_get_key(const lv_indev_t *indev)
Get the last pressed key of an input device (for LV_INDEV_TYPE_KEYPAD)
- 参数:
indev -- pointer to an input device
- 返回:
the last pressed key (0 on error)
-
lv_dir_t lv_indev_get_scroll_dir(const lv_indev_t *indev)
Check the current scroll direction of an input device (for LV_INDEV_TYPE_POINTER and LV_INDEV_TYPE_BUTTON)
- 参数:
indev -- pointer to an input device
- 返回:
LV_DIR_NONE: no scrolling now LV_DIR_HOR/VER
-
lv_obj_t *lv_indev_get_scroll_obj(const lv_indev_t *indev)
Get the currently scrolled object (for LV_INDEV_TYPE_POINTER and LV_INDEV_TYPE_BUTTON)
- 参数:
indev -- pointer to an input device
- 返回:
pointer to the currently scrolled object or NULL if no scrolling by this indev
-
void lv_indev_get_vect(const lv_indev_t *indev, lv_point_t *point)
Get the movement vector of an input device (for LV_INDEV_TYPE_POINTER and LV_INDEV_TYPE_BUTTON)
- 参数:
indev -- pointer to an input device
point -- pointer to a point to store the types.pointer.vector
-
void lv_indev_wait_release(lv_indev_t *indev)
Do nothing until the next release
- 参数:
indev -- pointer to an input device
-
lv_obj_t *lv_indev_get_active_obj(void)
Gets a pointer to the currently active object in the currently processed input device.
- 返回:
pointer to currently active object or NULL if no active object
-
lv_timer_t *lv_indev_get_read_timer(lv_indev_t *indev)
Get a pointer to the indev read timer to modify its parameters with
lv_timer_...
functions.- 参数:
indev -- pointer to an input device
- 返回:
pointer to the indev read refresher timer. (NULL on error)
-
void lv_indev_set_mode(lv_indev_t *indev, lv_indev_mode_t mode)
Set the input device's event model: event-driven mode or timer mode.
- 参数:
indev -- pointer to an input device
mode -- the mode of input device
-
lv_indev_mode_t lv_indev_get_mode(lv_indev_t *indev)
Get the input device's running mode.
- 参数:
indev -- pointer to an input device
- 返回:
the running mode for the specified input device.
-
lv_obj_t *lv_indev_search_obj(lv_obj_t *obj, lv_point_t *point)
Search the most top, clickable object by a point
- 参数:
obj -- pointer to a start object, typically the screen
point -- pointer to a point for searching the most top child
- 返回:
pointer to the found object or NULL if there was no suitable object
-
void lv_indev_add_event_cb(lv_indev_t *indev, lv_event_cb_t event_cb, lv_event_code_t filter, void *user_data)
Add an event handler to the indev
- 参数:
indev -- pointer to an indev
event_cb -- an event callback
filter -- event code to react or
LV_EVENT_ALL
user_data -- optional user_data
-
uint32_t lv_indev_get_event_count(lv_indev_t *indev)
Get the number of event attached to an indev
- 参数:
indev -- pointer to an indev
- 返回:
number of events
-
lv_event_dsc_t *lv_indev_get_event_dsc(lv_indev_t *indev, uint32_t index)
Get an event descriptor for an event
- 参数:
indev -- pointer to an indev
index -- the index of the event
- 返回:
the event descriptor
-
bool lv_indev_remove_event(lv_indev_t *indev, uint32_t index)
Remove an event
- 参数:
indev -- pointer to an indev
index -- the index of the event to remove
- 返回:
true: and event was removed; false: no event was removed
-
uint32_t lv_indev_remove_event_cb_with_user_data(lv_indev_t *indev, lv_event_cb_t event_cb, void *user_data)
Remove an event_cb with user_data
- 参数:
indev -- pointer to a indev
event_cb -- the event_cb of the event to remove
user_data -- user_data
- 返回:
the count of the event removed
-
lv_result_t lv_indev_send_event(lv_indev_t *indev, lv_event_code_t code, void *param)
Send an event to an indev
- 参数:
indev -- pointer to an indev
code -- an event code. LV_EVENT_...
param -- optional param
- 返回:
LV_RESULT_OK: indev wasn't deleted in the event.
-
struct lv_indev_data_t
- #include <lv_indev.h>
Data structure passed to an input driver to fill
Public Members
-
lv_point_t point
For LV_INDEV_TYPE_POINTER the currently pressed point
-
uint32_t key
For LV_INDEV_TYPE_KEYPAD the currently pressed key
-
uint32_t btn_id
For LV_INDEV_TYPE_BUTTON the currently pressed button
-
int16_t enc_diff
For LV_INDEV_TYPE_ENCODER number of steps since the previous read
-
lv_indev_state_t state
LV_INDEV_STATE_REL or LV_INDEV_STATE_PR
-
bool continue_reading
If set to true, the read callback is invoked again, unless the device is in event-driven mode
-
lv_point_t point