Skip to content

Commit 443da0b

Browse files
Mr-MCFmysterywolf
authored andcommitted
在初始化时结构体中的button_level变量直接由读取电平接口赋值,可能会导致上电瞬间误读电平,从而导致误触发事件
0x1abin/MultiButton#42
1 parent 5d00b96 commit 443da0b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

multi_button.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void button_init(struct button* handle, uint8_t(*pin_level)(void), uint8_t activ
3535
memset(handle, 0, sizeof(struct button));
3636
handle->event = (uint8_t)NONE_PRESS;
3737
handle->hal_button_Level = pin_level;
38-
handle->button_level = handle->hal_button_Level();
38+
handle->button_level = !active_level;
3939
handle->active_level = active_level;
4040
}
4141

0 commit comments

Comments
 (0)