From 604ee6309640f27644714edf6d27da8540797620 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Thu, 9 Aug 2018 07:30:10 +0200 Subject: [PATCH] lv_indev_get_key() added --- lv_core/lv_indev.c | 11 +++++++++++ lv_core/lv_indev.h | 7 +++++++ 2 files changed, 18 insertions(+) diff --git a/lv_core/lv_indev.c b/lv_core/lv_indev.c index cc862236c..5a7c98d58 100644 --- a/lv_core/lv_indev.c +++ b/lv_core/lv_indev.c @@ -181,6 +181,17 @@ void lv_indev_get_point(const lv_indev_t * indev, lv_point_t * point) } } +/** + * Get the last key of an input device (for LV_INDEV_TYPE_KEYPAD) + * @param indev pointer to an input device + * @return the last pressed key (0 on error) + */ +uint32_t lv_indev_get_key(const lv_indev_t * indev) +{ + if(indev->driver.type != LV_INDEV_TYPE_KEYPAD) return 0; + else return indev->proc.last_key; +} + /** * 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 diff --git a/lv_core/lv_indev.h b/lv_core/lv_indev.h index 63ed1968e..1e7fd6bb1 100644 --- a/lv_core/lv_indev.h +++ b/lv_core/lv_indev.h @@ -98,6 +98,13 @@ void lv_indev_set_button_points(lv_indev_t *indev, lv_point_t *points); */ void lv_indev_get_point(const lv_indev_t * indev, lv_point_t * point); +/** + * Get the last key of an input device (for LV_INDEV_TYPE_KEYPAD) + * @param indev pointer to an input device + * @return the last pressed key (0 on error) + */ +uint32_t lv_indev_get_key(const lv_indev_t * indev); + /** * 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