From 2ee3f94d4bd4e28e587f8d9a5480abac768ed366 Mon Sep 17 00:00:00 2001 From: CoderNotCute <30313912+smartmx@users.noreply.github.com> Date: Sun, 26 Mar 2023 20:58:20 +0800 Subject: [PATCH] Update README.md --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5040b3f..aa2d583 100644 --- a/README.md +++ b/README.md @@ -287,6 +287,8 @@ MFBD_MBTN_DEFAULT_DEFINE(NAME, ...); ### 按键组GROUP中读取按键的接口函数 +在读取按键状态的函数中,如果按键按下了,应当返回`MFBD_BTN_STATE_DOWN`,否则返回`MFBD_BTN_STATE_UP`。 + ```c unsigned char bsp_btn_check(mfbd_btn_index_t btn_index) { @@ -295,31 +297,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; } ```