Initial lv_indev_set_feedback support
This commit is contained in:
@@ -166,6 +166,16 @@ void lv_indev_set_button_points(lv_indev_t * indev, lv_point_t * points)
|
|||||||
if(indev->driver.type == LV_INDEV_TYPE_BUTTON) indev->btn_points = points;
|
if(indev->driver.type == LV_INDEV_TYPE_BUTTON) indev->btn_points = points;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set feedback callback for indev.
|
||||||
|
* @param indev pointer to an input device
|
||||||
|
* @param feedback feedback callback
|
||||||
|
*/
|
||||||
|
void lv_indev_set_feedback(lv_indev_t *indev, lv_indev_feedback_t feedback)
|
||||||
|
{
|
||||||
|
indev->feedback = feedback;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the last point of an input device (for LV_INDEV_TYPE_POINTER and LV_INDEV_TYPE_BUTTON)
|
* 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
|
||||||
@@ -249,6 +259,16 @@ uint32_t lv_indev_get_inactive_time(const lv_indev_t * indev)
|
|||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get feedback callback for indev.
|
||||||
|
* @param indev pointer to an input device
|
||||||
|
* @return feedback callback
|
||||||
|
*/
|
||||||
|
lv_indev_feedback_t lv_indev_get_feedback(const lv_indev_t *indev)
|
||||||
|
{
|
||||||
|
return indev->feedback;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do nothing until the next release
|
* Do nothing until the next release
|
||||||
* @param indev pointer to an input device
|
* @param indev pointer to an input device
|
||||||
|
|||||||
@@ -91,6 +91,13 @@ void lv_indev_set_group(lv_indev_t *indev, lv_group_t *group);
|
|||||||
*/
|
*/
|
||||||
void lv_indev_set_button_points(lv_indev_t *indev, lv_point_t *points);
|
void lv_indev_set_button_points(lv_indev_t *indev, lv_point_t *points);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set feedback callback for indev.
|
||||||
|
* @param indev pointer to an input device
|
||||||
|
* @param feedback feedback callback
|
||||||
|
*/
|
||||||
|
void lv_indev_set_feedback(lv_indev_t *indev, lv_indev_feedback_t feedback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the last point of an input device (for LV_INDEV_TYPE_POINTER and LV_INDEV_TYPE_BUTTON)
|
* 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
|
||||||
@@ -125,6 +132,13 @@ void lv_indev_get_vect(const lv_indev_t * indev, lv_point_t * point);
|
|||||||
*/
|
*/
|
||||||
uint32_t lv_indev_get_inactive_time(const lv_indev_t * indev);
|
uint32_t lv_indev_get_inactive_time(const lv_indev_t * indev);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get feedback callback for indev.
|
||||||
|
* @param indev pointer to an input device
|
||||||
|
* @return feedback callback
|
||||||
|
*/
|
||||||
|
lv_indev_feedback_t lv_indev_get_feedback(const lv_indev_t *indev);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do nothing until the next release
|
* Do nothing until the next release
|
||||||
* @param indev pointer to an input device
|
* @param indev pointer to an input device
|
||||||
|
|||||||
@@ -1810,6 +1810,14 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
|
|||||||
lv_res_t res = LV_RES_OK;
|
lv_res_t res = LV_RES_OK;
|
||||||
|
|
||||||
lv_style_t * style = lv_obj_get_style(obj);
|
lv_style_t * style = lv_obj_get_style(obj);
|
||||||
|
|
||||||
|
lv_indev_t *indev_act = lv_indev_get_act();
|
||||||
|
|
||||||
|
if(sign > LV_INDEV_SIGNAL_START && sign < LV_INDEV_SIGNAL_END) {
|
||||||
|
if(indev_act != NULL && indev_act->feedback != NULL)
|
||||||
|
indev_act->feedback(indev_act, sign);
|
||||||
|
}
|
||||||
|
|
||||||
if(sign == LV_SIGNAL_CHILD_CHG) {
|
if(sign == LV_SIGNAL_CHILD_CHG) {
|
||||||
/*Return 'invalid' if the child change signal is not enabled*/
|
/*Return 'invalid' if the child change signal is not enabled*/
|
||||||
if(lv_obj_is_protected(obj, LV_PROTECT_CHILD_CHG) != false) res = LV_RES_INV;
|
if(lv_obj_is_protected(obj, LV_PROTECT_CHILD_CHG) != false) res = LV_RES_INV;
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ enum
|
|||||||
LV_SIGNAL_REFR_EXT_SIZE,
|
LV_SIGNAL_REFR_EXT_SIZE,
|
||||||
LV_SIGNAL_GET_TYPE,
|
LV_SIGNAL_GET_TYPE,
|
||||||
|
|
||||||
|
LV_INDEV_SIGNAL_START,
|
||||||
/*Input device related*/
|
/*Input device related*/
|
||||||
LV_SIGNAL_PRESSED,
|
LV_SIGNAL_PRESSED,
|
||||||
LV_SIGNAL_PRESSING,
|
LV_SIGNAL_PRESSING,
|
||||||
@@ -101,6 +102,7 @@ enum
|
|||||||
LV_SIGNAL_LONG_PRESS_REP,
|
LV_SIGNAL_LONG_PRESS_REP,
|
||||||
LV_SIGNAL_DRAG_BEGIN,
|
LV_SIGNAL_DRAG_BEGIN,
|
||||||
LV_SIGNAL_DRAG_END,
|
LV_SIGNAL_DRAG_END,
|
||||||
|
LV_INDEV_SIGNAL_END,
|
||||||
|
|
||||||
/*Group related*/
|
/*Group related*/
|
||||||
LV_SIGNAL_FOCUS,
|
LV_SIGNAL_FOCUS,
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ extern "C" {
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "lv_hal.h"
|
#include "lv_hal.h"
|
||||||
#include "../lv_misc/lv_area.h"
|
#include "../lv_misc/lv_area.h"
|
||||||
|
#include "../lv_core/lv_obj.h"
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
* DEFINES
|
* DEFINES
|
||||||
@@ -98,6 +99,9 @@ typedef struct _lv_indev_proc_t {
|
|||||||
uint8_t disabled :1;
|
uint8_t disabled :1;
|
||||||
} lv_indev_proc_t;
|
} lv_indev_proc_t;
|
||||||
|
|
||||||
|
struct _lv_indev_t;
|
||||||
|
|
||||||
|
typedef void (*lv_indev_feedback_t)(struct _lv_indev_t *, lv_signal_t);
|
||||||
|
|
||||||
struct _lv_obj_t;
|
struct _lv_obj_t;
|
||||||
struct _lv_group_t;
|
struct _lv_group_t;
|
||||||
@@ -106,6 +110,7 @@ struct _lv_group_t;
|
|||||||
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;
|
||||||
|
lv_indev_feedback_t feedback;
|
||||||
uint32_t last_activity_time;
|
uint32_t last_activity_time;
|
||||||
union {
|
union {
|
||||||
struct _lv_obj_t *cursor; /*Cursor for LV_INPUT_TYPE_POINTER*/
|
struct _lv_obj_t *cursor; /*Cursor for LV_INPUT_TYPE_POINTER*/
|
||||||
|
|||||||
Reference in New Issue
Block a user