BigW Consortium Gitlab

Commit b2f72d3f by Gabor Kiss-Vamosi

LV_INDEV_TYPE_BUTTON added

parent a676590e
...@@ -60,40 +60,49 @@ void lv_indev_reset_lpr(lv_indev_t * indev); ...@@ -60,40 +60,49 @@ void lv_indev_reset_lpr(lv_indev_t * indev);
void lv_indev_enable(lv_hal_indev_type_t type, bool enable); void lv_indev_enable(lv_hal_indev_type_t type, bool enable);
/** /**
* Set a cursor for a pointer input device * Set a cursor for a pointer input device (for LV_INPUT_TYPE_POINTER and LV_INPUT_TYPE_BUTTON)
* @param indev pointer to an input device (type: 'LV_INDEV_TYPE_POINTER') * @param indev pointer to an input device
* @param cur_obj pointer to an object to be used as cursor * @param cur_obj pointer to an object to be used as cursor
*/ */
void lv_indev_set_cursor(lv_indev_t *indev, lv_obj_t *cur_obj); void lv_indev_set_cursor(lv_indev_t *indev, lv_obj_t *cur_obj);
#if USE_LV_GROUP #if USE_LV_GROUP
/** /**
* Set a destination group for a keypad input device * Set a destination group for a keypad input device (for LV_INDEV_TYPE_KEYPAD)
* @param indev pointer to an input device (type: 'LV_INDEV_TYPE_KEYPAD') * @param indev pointer to an input device
* @param group point to a group * @param group point to a group
*/ */
void lv_indev_set_group(lv_indev_t *indev, lv_group_t *group); void lv_indev_set_group(lv_indev_t *indev, lv_group_t *group);
#endif #endif
/**
* 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
* @param indev pointer to an input device
* @param group point to a group
*/
void lv_indev_set_button_points(lv_indev_t *indev, lv_point_t *points);
/** /**
* Get the last point of an input device * Get the last point of an input device (for LV_INDEV_TYPE_POINTER and LV_INDEV_TYPE_BUTTON)
* @param indev pointer to an input device * @param indev pointer to an input device
* @param point pointer to a point to store the result * @param point pointer to a point to store the result
*/ */
void lv_indev_get_point(lv_indev_t * indev, lv_point_t * point); void lv_indev_get_point(lv_indev_t * indev, lv_point_t * point);
/** /**
* Check if there is dragging with an input device or not * Check if there is dragging with an input device or not (for LV_INDEV_TYPE_POINTER and LV_INDEV_TYPE_BUTTON)
* @param indev pointer to an input device * @param indev pointer to an input device
* @return true: drag is in progress * @return true: drag is in progress
*/ */
bool lv_indev_is_dragging(lv_indev_t * indev); bool lv_indev_is_dragging(lv_indev_t * indev);
/** /**
* Get the vector of dragging of an input device * Get the vector of dragging of an input device (for LV_INDEV_TYPE_POINTER and LV_INDEV_TYPE_BUTTON)
* @param indev pointer to an input device * @param indev pointer to an input device
* @param point pointer to a point to store the vector * @param point pointer to a point to store the vector
*/ */
void lv_indev_get_vect(lv_indev_t * indev, lv_point_t * point); void lv_indev_get_vect(lv_indev_t * indev, lv_point_t * point);
/** /**
* Get elapsed time since last press * Get elapsed time since last press
* @param indev pointer to an input device (NULL to get the overall smallest inactivity) * @param indev pointer to an input device (NULL to get the overall smallest inactivity)
......
...@@ -33,19 +33,21 @@ typedef enum { ...@@ -33,19 +33,21 @@ typedef enum {
LV_INDEV_TYPE_NONE, /*Show uninitialized state*/ LV_INDEV_TYPE_NONE, /*Show uninitialized state*/
LV_INDEV_TYPE_POINTER, /*Touch pad, mouse, external button*/ LV_INDEV_TYPE_POINTER, /*Touch pad, mouse, external button*/
LV_INDEV_TYPE_KEYPAD, /*Keypad or keyboard*/ LV_INDEV_TYPE_KEYPAD, /*Keypad or keyboard*/
LV_INDEV_TYPE_BUTTON, /*External (hardware button) which is assinged to a specific point of the screen*/
} lv_hal_indev_type_t; } lv_hal_indev_type_t;
/*States for input devices*/ /*States for input devices*/
typedef enum { typedef enum {
LV_INDEV_STATE_REL, LV_INDEV_STATE_REL = 0,
LV_INDEV_STATE_PR LV_INDEV_STATE_PR
}lv_indev_state_t; }lv_indev_state_t;
/*Data type when an input device is read */ /*Data type when an input device is read */
typedef struct { typedef struct {
union { union {
lv_point_t point; /*For INDEV_TYPE_POINTER*/ lv_point_t point; /*For LV_INDEV_TYPE_POINTER the currently pressed point*/
uint32_t key; /*For INDEV_TYPE_KEYPAD*/ uint32_t key; /*For LV_INDEV_TYPE_KEYPAD the currently pressed key*/
uint32_t btn; /*For LV_INDEV_TYPE_BUTTON the currently pressed button*/
}; };
lv_indev_state_t state; /*LV_INDEV_EVENT_REL or LV_INDEV_EVENT_PR*/ lv_indev_state_t state; /*LV_INDEV_EVENT_REL or LV_INDEV_EVENT_PR*/
void *user_data; /*'lv_indev_drv_t.priv' for this driver*/ void *user_data; /*'lv_indev_drv_t.priv' for this driver*/
...@@ -60,10 +62,11 @@ typedef struct { ...@@ -60,10 +62,11 @@ typedef struct {
struct _lv_obj_t; struct _lv_obj_t;
typedef struct _lv_indev_state_t { /*Run time data of input devices*/
typedef struct _lv_indev_proc_t {
lv_indev_state_t state; lv_indev_state_t state;
union { union {
struct { /*Pointer data*/ struct { /*Pointer and button data*/
lv_point_t act_point; lv_point_t act_point;
lv_point_t last_point; lv_point_t last_point;
lv_point_t vect; lv_point_t vect;
...@@ -94,13 +97,16 @@ typedef struct _lv_indev_state_t { ...@@ -94,13 +97,16 @@ typedef struct _lv_indev_state_t {
struct _lv_obj_t; struct _lv_obj_t;
struct _lv_group_t; struct _lv_group_t;
/*The main input device descriptor with driver, runtime data ('proc') and some additional information*/
typedef struct _lv_indev_t { typedef struct _lv_indev_t {
lv_indev_drv_t driver; lv_indev_drv_t driver;
lv_indev_proc_t proc; lv_indev_proc_t proc;
uint32_t last_activity_time; uint32_t last_activity_time;
union { union {
struct _lv_obj_t *cursor; struct _lv_obj_t *cursor; /*Cursor for LV_INPUT_TYPE_POINTER*/
struct _lv_group_t *group; /*Keypad destination group*/ struct _lv_group_t *group; /*Keypad destination group*/
lv_point_t * btn_points; /*Array points assigned to the button ()screen will be pressed here by the buttons*/
}; };
struct _lv_indev_t *next; struct _lv_indev_t *next;
} lv_indev_t; } lv_indev_t;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment