Baji_Rtc_Toy_Key/main/dzbj/dzbj_button.h
Rdzleo dbdd304905 代码初始化:
本项目为触摸版项目代码复制而来,基于此版本进行按键功能的适配!
2026-03-23 11:14:56 +08:00

31 lines
773 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
#ifdef __cplusplus
extern "C" {
#endif
#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 dzbj_button_init(void);
// 注册BOOT按键按下回调
void dzbj_button_on_boot_press(btn_event_cb_t cb, void *usr_data);
// 注册KEY2按键按下回调
void dzbj_button_on_key2_press(btn_event_cb_t cb, void *usr_data);
// 吧唧模式 BOOT 单击处理(唤醒屏幕 / 退出手电筒 / 返回Home
void dzbj_boot_click_handler(void);
#ifdef __cplusplus
}
#endif