From b40beb9595157b0d048d1612cad5c0841c142b58 Mon Sep 17 00:00:00 2001 From: zjd190319 <119920349+zjd190319@users.noreply.github.com> Date: Thu, 20 Apr 2023 16:18:36 +0800 Subject: [PATCH] Update multi_button.c Adjust the order of initializing member variables. "button_id" is not correctly initialized when the first call of "hal_button_Level". --- multi_button.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/multi_button.c b/multi_button.c index 6b09dc8..2b8c722 100644 --- a/multi_button.c +++ b/multi_button.c @@ -23,9 +23,9 @@ void button_init(struct Button* handle, uint8_t(*pin_level)(uint8_t), uint8_t ac memset(handle, 0, sizeof(struct Button)); handle->event = (uint8_t)NONE_PRESS; handle->hal_button_Level = pin_level; + handle->button_id = button_id; handle->button_level = handle->hal_button_Level(button_id); handle->active_level = active_level; - handle->button_id = button_id; } /**