diff --git a/src/W800_SDK_v1.00.10/lvgl/lvgl_port/lv_port_indev.c b/src/W800_SDK_v1.00.10/lvgl/lvgl_port/lv_port_indev.c index 1e95ca8..29fef39 100644 --- a/src/W800_SDK_v1.00.10/lvgl/lvgl_port/lv_port_indev.c +++ b/src/W800_SDK_v1.00.10/lvgl/lvgl_port/lv_port_indev.c @@ -36,6 +36,8 @@ static void touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data); * STATIC VARIABLES **********************/ static lv_indev_t * indev_touchpad; +static bool _indev_touched = false; + /********************** * MACROS @@ -49,6 +51,7 @@ static void touch_panel_isr(void *arg) CST816D_Touch_Data_t *p = arg; tls_clr_gpio_irq_status(LCD_TOUCH_PANEL_IRQ); CST816D_read_touch_event(p); + _indev_touched = true; } static void touch_panel_feedback_cb(struct _lv_indev_drv_t *lv_indev_drv, uint8_t lv_event_code) @@ -112,6 +115,17 @@ void lv_port_indev_init(void) indev_touchpad = lv_indev_drv_register(&indev_drv); } +bool lv_port_indev_touched(void) +{ + if(_indev_touched) + { + _indev_touched = false; + return true; + } + + return false; +} + /********************** * STATIC FUNCTIONS **********************/ diff --git a/src/W800_SDK_v1.00.10/lvgl/lvgl_port/lv_port_indev.h b/src/W800_SDK_v1.00.10/lvgl/lvgl_port/lv_port_indev.h index 2d2008b..2c51e23 100644 --- a/src/W800_SDK_v1.00.10/lvgl/lvgl_port/lv_port_indev.h +++ b/src/W800_SDK_v1.00.10/lvgl/lvgl_port/lv_port_indev.h @@ -30,8 +30,21 @@ extern "C" { /********************** * GLOBAL PROTOTYPES **********************/ + +/** + * @brief Initializes the input device for LVGL to use. + * + */ void lv_port_indev_init(void); +/** + * @brief Checks if the input device registered a touch event or not. + * + * @return true if a touch event was registered, the event is cleared once the function is called. + * @return false if not + */ +bool lv_port_indev_touched(void); + /********************** * MACROS **********************/