mirror of
https://github.com/0x1abin/MultiButton.git
synced 2025-01-25 08:32:55 +08:00
在初始化时结构体中的button_level变量直接由读取电平接口赋值,可能会导致上电瞬间误读电平,从而导致误触发事件
This commit is contained in:
parent
6bd1c6a451
commit
31ff772aaf
@ -26,7 +26,7 @@ void button_init(struct Button* handle, uint8_t(*pin_level)(uint8_t), uint8_t ac
|
|||||||
memset(handle, 0, sizeof(struct Button));
|
memset(handle, 0, sizeof(struct Button));
|
||||||
handle->event = (uint8_t)NONE_PRESS;
|
handle->event = (uint8_t)NONE_PRESS;
|
||||||
handle->hal_button_Level = pin_level;
|
handle->hal_button_Level = pin_level;
|
||||||
handle->button_level = handle->hal_button_Level(button_id);
|
handle->button_level = !active_level;
|
||||||
handle->active_level = active_level;
|
handle->active_level = active_level;
|
||||||
handle->button_id = button_id;
|
handle->button_id = button_id;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user