添加BOOT键、飞控复位控制、串口校验位设置

This commit is contained in:
OPTOC
2025-10-14 10:17:40 +08:00
parent 0336a20472
commit e7989c7444
6 changed files with 87 additions and 2 deletions

View File

@@ -5,6 +5,9 @@ button_t btn;
cfg_board_pin_io_t key_switch = {
.pin = 9,
.en_lev = 0,};
cfg_board_pin_io_t boot_switch = {
.pin = ~0,
.en_lev = 0,};
// 新增事件类型
// EVT_DOUBLE_CLICK: 双击
// EVT_SINGLE_LONG_PRESS: 单击后长按
@@ -34,6 +37,7 @@ static void my_button_handler(button_event_t evt) {
break;
case EVT_LONG_PRESS: //长按
SYS_LOG_INF("[Event] LONG_PRESS");
Examples_run();
rgb_Indicator_light_off(0);
break;
case EVT_SINGLE_LONG_PRESS: //单击后长按
@@ -163,9 +167,18 @@ void _work_button(void *arg) {
}
void button_work_init() {
pin_cfg_input(&key_switch);
pin_cfg_output(&boot_switch);
button_init(&btn, read_button_pin, my_button_handler);
static os_work_t work_handler_button;
os_work_create(&work_handler_button, "work-button", _work_button, NULL, OS_PRIORITY_NORMAL);
os_work_submit(default_os_work_q_hdl, &work_handler_button, 10);
}
void boot_set(uint8_t value)
{
pin_set_valid(&boot_switch, value);
}