lv_indev_gesture.h

Typedefs

typedef struct lv_indev_gesture lv_indev_gesture_t
typedef struct lv_indev_gesture_configuration lv_indev_gesture_configuration_t

Enums

enum lv_indev_gesture_state_t

Values:

enumerator LV_INDEV_GESTURE_STATE_NONE
enumerator LV_INDEV_GESTURE_STATE_ONGOING
enumerator LV_INDEV_GESTURE_STATE_RECOGNIZED
enumerator LV_INDEV_GESTURE_STATE_ENDED
enumerator LV_INDEV_GESTURE_STATE_CANCELED

Functions

void lv_indev_gesture_detect_pinch(lv_indev_gesture_recognizer_t *recognizer, lv_indev_touch_data_t *touches, uint16_t touch_cnt)

Detects a pinch gesture

Parameters:
  • recognizer – pointer to a gesture recognizer

  • touches – pointer to the first element of the collected touch events

  • touch_cnt – length of passed touch event array.

void lv_indev_set_pinch_up_threshold(lv_indev_gesture_recognizer_t *recognizer, float threshold)

Set the threshold for the pinch gesture scale up, when the scale factor of gesture reaches the threshold events get sent

Parameters:
  • recognizer – pointer to a gesture recognizer

  • touches – pointer to the first element of the collected touch events

  • touch_cnt – length of passed touch event array.

void lv_indev_set_pinch_down_threshold(lv_indev_gesture_recognizer_t *recognizer, float threshold)

Set the threshold for the pinch gesture scale down, when the scale factor of gesture reaches the threshold events get sent

Parameters:
  • recognizer – pointer to a gesture recognizer

  • touches – pointer to the first element of the collected touch events

  • touch_cnt – length of passed touch event array.

float lv_event_get_pinch_scale(lv_event_t *gesture_event)

Obtains the current scale of a pinch gesture

Parameters:

gesture_event – pointer to a gesture recognizer event

Returns:

the scale of the current gesture

void lv_indev_set_gesture_data(lv_indev_data_t *data, lv_indev_gesture_recognizer_t *recognizer)

Sets the state of the recognizer to a indev data structure, it is usually called from the indev read callback

Parameters:
  • data – the indev data

  • recognizer – pointer to a gesture recognizer

void lv_indev_get_gesture_center_point(lv_indev_gesture_recognizer_t *recognizer, lv_point_t *point)

Obtains the center point of a gesture

Parameters:
  • gesture_event – pointer to a gesture recognizer event

  • point – pointer to a point

lv_indev_gesture_state_t lv_event_get_gesture_state(lv_event_t *gesture_event)

Obtains the current state of the gesture recognizer attached to an event

Parameters:

gesture_event – pointer to a gesture recognizer event

Returns:

current state of the gesture recognizer

void lv_indev_get_gesture_primary_point(lv_indev_gesture_recognizer_t *recognizer, lv_point_t *point)

Obtains the coordinates of the current primary point

Parameters:
  • recognizer – pointer to a gesture recognizer

  • point – pointer to a point

bool lv_indev_recognizer_is_active(lv_indev_gesture_recognizer_t *recognizer)

Allows to determine if there is an are ongoing gesture

Parameters:

recognizer – pointer to a gesture recognizer

Returns:

false if there are no contact points, or the gesture has ended - true otherwise

struct lv_indev_touch_data_t

Public Members

lv_point_t point
lv_indev_state_t state
uint8_t id
uint32_t timestamp
struct lv_indev_gesture_recognizer_t

Public Members

lv_indev_gesture_type_t type
lv_indev_gesture_state_t state
lv_indev_gesture_t *info
float scale
float rotation
float distance
float speed
lv_indev_gesture_configuration_t *config