diff --git a/lv_core/lv_indev.c b/lv_core/lv_indev.c index efdaf6838..920db0b42 100644 --- a/lv_core/lv_indev.c +++ b/lv_core/lv_indev.c @@ -111,7 +111,7 @@ void lv_indev_reset(lv_indev_t * indev) * Reset the long press state of an input device * @param indev pointer to an input device */ -void lv_indev_reset_lpr(lv_indev_t * indev) +void lv_indev_reset_long_press(lv_indev_t * indev) { indev->proc.long_pr_sent = 0; indev->proc.longpr_rep_timestamp = lv_tick_get(); @@ -119,19 +119,15 @@ void lv_indev_reset_lpr(lv_indev_t * indev) } /** - * Enable input devices device by type - * @param type Input device type - * @param enable true: enable this type; false: disable this type + * Enable or disable an input devices + * @param indev pointer to an input device + * @param en true: enable; false: disable */ -void lv_indev_enable(lv_hal_indev_type_t type, bool enable) +void lv_indev_enable(lv_indev_t * indev, bool en) { + if(!indev) return; - lv_indev_t * i = lv_indev_next(NULL); - - while(i) { - if(i->driver.type == type) i->proc.disabled = enable == false ? 1 : 0; - i = lv_indev_next(i); - } + indev->proc.disabled = en ? 1 : 0; } /** diff --git a/lv_core/lv_indev.h b/lv_core/lv_indev.h index 2e55c2371..a5287fca7 100644 --- a/lv_core/lv_indev.h +++ b/lv_core/lv_indev.h @@ -58,14 +58,14 @@ void lv_indev_reset(lv_indev_t * indev); * Reset the long press state of an input device * @param indev_proc pointer to an input device */ -void lv_indev_reset_lpr(lv_indev_t * indev); +void lv_indev_reset_long_press(lv_indev_t * indev); /** - * Enable input devices device by type - * @param type Input device type - * @param enable true: enable this type; false: disable this type + * Enable or disable an input devices + * @param indev pointer to an input device + * @param en true: enable; false: disable */ -void lv_indev_enable(lv_hal_indev_type_t type, bool enable); +void lv_indev_enable(lv_indev_t * indev, bool en); /** * Set a cursor for a pointer input device (for LV_INPUT_TYPE_POINTER and LV_INPUT_TYPE_BUTTON) diff --git a/lv_objx/lv_btnm.c b/lv_objx/lv_btnm.c index 86d58b872..2d47ee02b 100644 --- a/lv_objx/lv_btnm.c +++ b/lv_objx/lv_btnm.c @@ -841,7 +841,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param) btn_pr = get_button_from_point(btnm, &p); /*Invalidate to old and the new areas*/; if(btn_pr != ext->btn_id_pr) { - lv_indev_reset_lpr(param); + lv_indev_reset_long_press(param); if(ext->btn_id_pr != LV_BTNM_BTN_NONE) { invalidate_button_area(btnm, ext->btn_id_pr); }