From 31c1ef86842517de56fe9e0b207bbd174660cb62 Mon Sep 17 00:00:00 2001 From: CoderNotCute <30313912+smartmx@users.noreply.github.com> Date: Sun, 26 Mar 2023 10:08:55 +0800 Subject: [PATCH] update is_btn_down_func will return MFBD_BTN_STATE_UP or others. --- examples/mfbd_demo_rtt.c | 10 +++++----- mfbd.c | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/mfbd_demo_rtt.c b/examples/mfbd_demo_rtt.c index afc6290..b40df67 100644 --- a/examples/mfbd_demo_rtt.c +++ b/examples/mfbd_demo_rtt.c @@ -137,31 +137,31 @@ unsigned char bsp_btn_check(mfbd_btn_index_t btn_index) case 1: if (rt_pin_read(BTN_KEY0) == 0) { - return 1; + return MFBD_BTN_STATE_DOWN; } break; case 2: if (rt_pin_read(BTN_KEY1) == 0) { - return 1; + return MFBD_BTN_STATE_DOWN; } break; case 3: if (rt_pin_read(BTN_KEY2) == 0) { - return 1; + return MFBD_BTN_STATE_DOWN; } break; case 4: if (rt_pin_read(BTN_WK_UP) == 1) { - return 1; + return MFBD_BTN_STATE_DOWN; } break; default: break; } - return 0; + return MFBD_BTN_STATE_UP; } void bsp_btn_value_report(mfbd_btn_code_t btn_value) diff --git a/mfbd.c b/mfbd.c index 9315777..7fdac0b 100644 --- a/mfbd.c +++ b/mfbd.c @@ -55,7 +55,7 @@ void mfbd_tbtn_scan(const mfbd_group_t *_pbtn_group) while (_pbtn != NULL) { - if (_pbtn_group->is_btn_down_func(_pbtn->btn_info->btn_index) != 0) + if (_pbtn_group->is_btn_down_func(_pbtn->btn_info->btn_index) != MFBD_BTN_STATE_UP) { if (_pbtn->filter_count < (MFBD_FILTER_TIME_IN_FUC)) { @@ -144,7 +144,7 @@ void mfbd_nbtn_scan(const mfbd_group_t *_pbtn_group) while (_pbtn != NULL) { - if (_pbtn_group->is_btn_down_func(_pbtn->btn_info->btn_index) != 0) + if (_pbtn_group->is_btn_down_func(_pbtn->btn_info->btn_index) != MFBD_BTN_STATE_UP) { if (_pbtn->filter_count < (MFBD_FILTER_TIME_IN_FUC)) { @@ -267,7 +267,7 @@ void mfbd_mbtn_scan(const mfbd_group_t *_pbtn_group) mfbd_mbtn_t *_pbtn = *_ppbtn; while (_pbtn != NULL) { - if (_pbtn_group->is_btn_down_func(_pbtn->btn_info->btn_index) != 0) + if (_pbtn_group->is_btn_down_func(_pbtn->btn_info->btn_index) != MFBD_BTN_STATE_UP) { if (_pbtn->filter_count < (MFBD_FILTER_TIME_IN_FUC)) {