lv_indev_gesture.h
API reference for lv_indev_gesture.h
Functions
lv_indev_set_pinch_up_threshold
Set the threshold for the pinch gesture scale up, when the scale factor of gesture reaches the threshold events get sent
void lv_indev_set_pinch_up_threshold(lv_indev_t *indev, float threshold)| Name | Type | Description |
|---|---|---|
indev | lv_indev_t * | pointer to the indev device containing the pinch recognizer |
threshold | float | threshold for a pinch up gesture to be recognized |
lv_indev_set_pinch_down_threshold
Set the threshold for the pinch gesture scale down, when the scale factor of gesture reaches the threshold events get sent
void lv_indev_set_pinch_down_threshold(lv_indev_t *indev, float threshold)| Name | Type | Description |
|---|---|---|
indev | lv_indev_t * | pointer to the indev device containing the pinch recognizer |
threshold | float | threshold for a pinch down gesture to be recognized |
lv_indev_set_rotation_rad_threshold
Set the rotation threshold in radian for the rotation gesture
void lv_indev_set_rotation_rad_threshold(lv_indev_t *indev, float threshold)| Name | Type | Description |
|---|---|---|
indev | lv_indev_t * | pointer to the indev device containing the rotation recognizer |
threshold | float | threshold in radian for a rotation gesture to be recognized |
lv_indev_set_gesture_data
Sets the state of the recognizer to a indev data structure, it is usually called from the indev read callback
void lv_indev_set_gesture_data(lv_indev_data_t *data, lv_indev_gesture_recognizer_t *recognizer, lv_indev_gesture_type_t type)| Name | Type | Description |
|---|---|---|
data | lv_indev_data_t * | the indev data |
recognizer | lv_indev_gesture_recognizer_t * | pointer to a gesture recognizer |
type | lv_indev_gesture_type_t | the gesture type |
lv_indev_gesture_recognizers_set_data
Set the lv_indev_data_t struct from the recognizer data. To be called in the indev read_cb.
void lv_indev_gesture_recognizers_set_data(lv_indev_t *indev, lv_indev_data_t *data)| Name | Type |
|---|---|
indev | lv_indev_t * |
data | lv_indev_data_t * |
lv_event_get_pinch_scale
Obtains the current scale of a pinch gesture
float lv_event_get_pinch_scale(lv_event_t *gesture_event)| Name | Type | Description |
|---|---|---|
gesture_event | lv_event_t * | pointer to a gesture event |
Returns: float — the scale of the current gesture
lv_event_get_rotation
Obtains the current angle in radian of a rotation gesture
float lv_event_get_rotation(lv_event_t *gesture_event)| Name | Type | Description |
|---|---|---|
gesture_event | lv_event_t * | pointer to a gesture event |
Returns: float — the rotation angle in radian of the current gesture
lv_event_get_two_fingers_swipe_distance
Obtains the current distance in pixels of a two fingers swipe gesture, from the starting center
float lv_event_get_two_fingers_swipe_distance(lv_event_t *gesture_event)| Name | Type | Description |
|---|---|---|
gesture_event | lv_event_t * | pointer to a gesture event |
Returns: float — the distance from the center, in pixels, of the current gesture
lv_event_get_two_fingers_swipe_dir
Obtains the current direction from the center of a two finger swipe
lv_dir_t lv_event_get_two_fingers_swipe_dir(lv_event_t *gesture_event)| Name | Type | Description |
|---|---|---|
gesture_event | lv_event_t * | pointer to a gesture event |
Returns: lv_dir_t — the rotation angle in radian of the current gesture
lv_indev_get_gesture_center_point
Obtains the center point of a gesture
void lv_indev_get_gesture_center_point(lv_indev_gesture_recognizer_t *recognizer, lv_point_t *point)| Name | Type | Description |
|---|---|---|
recognizer | lv_indev_gesture_recognizer_t * | pointer to a gesture recognizer event |
point | lv_point_t * | pointer to a point |
lv_event_get_gesture_state
Obtains the current state of the gesture recognizer attached to an event
lv_indev_gesture_state_t lv_event_get_gesture_state(lv_event_t *gesture_event, lv_indev_gesture_type_t type)| Name | Type | Description |
|---|---|---|
gesture_event | lv_event_t * | pointer to a gesture recognizer event |
type | lv_indev_gesture_type_t | the gesture type |
Returns: lv_indev_gesture_state_t — current state of the gesture recognizer
lv_event_get_gesture_type
Obtains the current event type of the gesture recognizer attached to an event
lv_indev_gesture_type_t lv_event_get_gesture_type(lv_event_t *gesture_event)| Name | Type | Description |
|---|---|---|
gesture_event | lv_event_t * | pointer to a gesture recognizer event |
Returns: lv_indev_gesture_type_t — current event type of the gesture recognizer
lv_indev_get_gesture_primary_point
Obtains the coordinates of the current primary point
void lv_indev_get_gesture_primary_point(lv_indev_gesture_recognizer_t *recognizer, lv_point_t *point)| Name | Type | Description |
|---|---|---|
recognizer | lv_indev_gesture_recognizer_t * | pointer to a gesture recognizer |
point | lv_point_t * | pointer to a point |
lv_indev_gesture_init
Initialize this indev's recognizers. It specifies their recognizer functions
void lv_indev_gesture_init(lv_indev_t *indev)| Name | Type | Description |
|---|---|---|
indev | lv_indev_t * | pointer to the indev containing the recognizers to initialize |
lv_indev_gesture_detect_pinch
Pinch gesture recognizer function Will update the recognizer data
void lv_indev_gesture_detect_pinch(lv_indev_gesture_recognizer_t *recognizer, lv_indev_touch_data_t *touches, uint16_t touch_cnt)| Name | Type | Description |
|---|---|---|
recognizer | lv_indev_gesture_recognizer_t * | pointer to a gesture recognizer |
touches | lv_indev_touch_data_t * | pointer to the first element of the collected touch events |
touch_cnt | uint16_t | length of passed touch event array. |
lv_indev_gesture_detect_rotation
Rotation gesture recognizer function Will update the recognizer data
void lv_indev_gesture_detect_rotation(lv_indev_gesture_recognizer_t *recognizer, lv_indev_touch_data_t *touches, uint16_t touch_cnt)| Name | Type | Description |
|---|---|---|
recognizer | lv_indev_gesture_recognizer_t * | pointer to a gesture recognizer |
touches | lv_indev_touch_data_t * | pointer to the first element of the collected touch events |
touch_cnt | uint16_t | length of passed touch event array. |
lv_indev_gesture_detect_two_fingers_swipe
Two finger swipe gesture recognizer function Will update the recognizer data
void lv_indev_gesture_detect_two_fingers_swipe(lv_indev_gesture_recognizer_t *recognizer, lv_indev_touch_data_t *touches, uint16_t touch_cnt)| Name | Type | Description |
|---|---|---|
recognizer | lv_indev_gesture_recognizer_t * | pointer to a gesture recognizer |
touches | lv_indev_touch_data_t * | pointer to the first element of the collected touch events |
touch_cnt | uint16_t | length of passed touch event array. |
lv_indev_recognizer_is_active
Allows to determine if there is an are ongoing gesture
bool lv_indev_recognizer_is_active(lv_indev_gesture_recognizer_t *recognizer)| Name | Type | Description |
|---|---|---|
recognizer | lv_indev_gesture_recognizer_t * | pointer to a gesture recognizer |
Returns: bool — false if there are no contact points, or the gesture has ended - true otherwise
lv_indev_gesture_recognizers_update
Update the recognizers. It execute the recognizers functions and checks for LV_GESTURE_STATE_RECOGNIZED or LV_GESTURE_STATE_ENDED gestures. To be called in the indev read_cb.
void lv_indev_gesture_recognizers_update(lv_indev_t *indev, lv_indev_touch_data_t *touches, uint16_t touch_cnt)| Name | Type | Description |
|---|---|---|
indev | lv_indev_t * | pointer to the indev containing from which the recognizer need an update |
touches | lv_indev_touch_data_t * | indev touch data array, containing the last touch data from indev since the last recognizers update |
touch_cnt | uint16_t | number of indev touch data in touches |
Enums
lv_indev_gesture_state_t
| Name | Value |
|---|---|
LV_INDEV_GESTURE_STATE_NONE | 0 |
LV_INDEV_GESTURE_STATE_ONGOING | |
LV_INDEV_GESTURE_STATE_RECOGNIZED | |
LV_INDEV_GESTURE_STATE_ENDED | |
LV_INDEV_GESTURE_STATE_CANCELED |
Structs
lv_indev_touch_data
| Member | Type | Description |
|---|---|---|
point | lv_point_t | |
state | lv_indev_state_t | |
id | uint8_t | |
timestamp | uint32_t |
lv_indev_gesture_recognizer
| Member | Type | Description |
|---|---|---|
type | lv_indev_gesture_type_t | |
state | lv_indev_gesture_state_t | |
info | lv_indev_gesture_t * | |
scale | float | |
rotation | float | |
distance | float | |
speed | float | |
two_fingers_swipe_dir | lv_dir_t | |
config | lv_indev_gesture_configuration_t * | |
recog_fn | lv_recognizer_func_t |
Typedefs
lv_indev_gesture_recognizer_t
typedef struct lv_indev_gesture_recognizer lv_indev_gesture_recognizer_tUsed by 7 functions
lv_indev_gesture_detect_pinch— paramrecognizerlv_indev_gesture_detect_rotation— paramrecognizerlv_indev_gesture_detect_two_fingers_swipe— paramrecognizerlv_indev_set_gesture_data— paramrecognizerlv_indev_get_gesture_center_point— paramrecognizerlv_indev_get_gesture_primary_point— paramrecognizerlv_indev_recognizer_is_active— paramrecognizer
lv_indev_touch_data_t
typedef struct lv_indev_touch_data lv_indev_touch_data_tUsed by 4 functions
lv_indev_gesture_detect_pinch— paramtoucheslv_indev_gesture_detect_rotation— paramtoucheslv_indev_gesture_detect_two_fingers_swipe— paramtoucheslv_indev_gesture_recognizers_update— paramtouches
lv_indev_gesture_t
typedef struct lv_indev_gesture lv_indev_gesture_tlv_indev_gesture_configuration_t
typedef struct lv_indev_gesture_configuration lv_indev_gesture_configuration_tlv_recognizer_func_t
typedef void(* lv_recognizer_func_t) (lv_indev_gesture_recognizer_t *, lv_indev_touch_data_t *, uint16_t)Dependencies
Indirect dependencies
lv_anim.hlv_area.hlv_assert.hlv_bidi.hlv_color.hlv_color_op.hlv_conf_internal.hlv_display.hlv_draw.hlv_draw_arc.hlv_draw_blur.hlv_draw_buf.hlv_draw_image.hlv_draw_label.hlv_draw_line.hlv_draw_rect.hlv_draw_triangle.hlv_event.hlv_ext_data.hlv_flex.hlv_font.hlv_fs.hlv_grad.hlv_grid.hlv_group.hlv_image_decoder.hlv_image_dsc.hlv_indev.hlv_layout.hlv_log.hlv_math.hlv_matrix.hlv_mem.hlv_obj_class.hlv_obj_draw.hlv_obj_event.hlv_obj_pos.hlv_obj_property.hlv_obj_scroll.hlv_obj_style.hlv_obj_style_gen.hlv_obj_tree.hlv_palette.hlv_profiler.hlv_profiler_builtin.hlv_sprintf.hlv_string.hlv_style.hlv_style_gen.hlv_symbol_def.hlv_text.hlv_timer.hlv_types.h
Last updated on