19 lines
568 B
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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);