19 lines
568 B
C
19 lines
568 B
C
#pragma once
|
||
#include "esp_err.h"
|
||
|
||
// 按键引脚定义
|
||
#define PIN_BTN_BOOT 0 // GPIO0 BOOT按键(低电平有效)
|
||
#define PIN_BTN_KEY2 4 // GPIO4 KEY2按键(低电平有效)
|
||
|
||
// 按键事件回调函数类型
|
||
typedef void (*btn_event_cb_t)(int gpio_num, void *usr_data);
|
||
|
||
// 初始化按键驱动(GPIO中断 + 软件去抖)
|
||
esp_err_t button_init(void);
|
||
|
||
// 注册BOOT按键按下回调
|
||
void button_on_boot_press(btn_event_cb_t cb, void *usr_data);
|
||
|
||
// 注册KEY2按键按下回调
|
||
void button_on_key2_press(btn_event_cb_t cb, void *usr_data);
|