98 lines
2.0 KiB
C
98 lines
2.0 KiB
C
/**
|
||
* @file Flux_Button.h
|
||
* @brief 控制板按键头文件
|
||
*
|
||
* 用于声明按键IO编号,按键回调函数等
|
||
*
|
||
* @author wang xiang en
|
||
* @date 2025-04-18
|
||
* @version 版本号
|
||
* @copyright 版权声明((C)2025, YUWELL MEDTECH Co.ltd)
|
||
*/
|
||
#ifndef _FLUX_BUTTON_H
|
||
#define _FLUX_BUTTON_H
|
||
|
||
#ifdef __cplusplus
|
||
extern "C" {
|
||
#endif
|
||
|
||
|
||
/* Include external button component header files */
|
||
#include "iot_button.h"
|
||
#include "esp_log.h"
|
||
|
||
#include <stdio.h>
|
||
#include "freertos/FreeRTOS.h"
|
||
#include "freertos/task.h"
|
||
#include "freertos/semphr.h"
|
||
|
||
/* 定义按键IO编号 */
|
||
#define BUTTON_Center_IO_NUM GPIO_NUM_42
|
||
#define BUTTON_Left_IO_NUM GPIO_NUM_41
|
||
#define BUTTON_Right_IO_NUM GPIO_NUM_40
|
||
|
||
/* 定义电源输入IO编号 */
|
||
#define BUTTON_PowerIn_IO_NUM GPIO_NUM_10
|
||
#define BUTTON_PowerOut_IO_NUM GPIO_NUM_11
|
||
|
||
/* 定义电源输出电平 */
|
||
#define POWER_OFF_OUT_LEVEL (0)
|
||
#define POWER_ON_OUT_LEVEL (1)
|
||
|
||
/* 定义按键电平 */
|
||
#define BUTTON_ACTIVE_LEVEL (0)
|
||
#define BUTTON_POWERIN_ACTIVE_LEVEL (1)
|
||
|
||
/* 定义LCD状态位 */
|
||
#define LCD_STATE_BIT BIT0
|
||
|
||
/* 定义按键支持休眠 */
|
||
#define CONFIG_GPIO_BUTTON_SUPPORT_POWER_SAVE (0)
|
||
|
||
#define USE_LCD_BACKLIGHT_CLOSE (1)
|
||
|
||
/**
|
||
* @brief 按键命令枚举
|
||
*
|
||
* 定义按键按下事件的枚举值
|
||
*/
|
||
enum button_cmd_t
|
||
{
|
||
BUTTON_CMD_POWER_ON,
|
||
BUTTON_CMD_POWER_OFF,
|
||
BUTTON_CMD_CENTER_KEY,
|
||
BUTTON_CMD_LEFT_KEY,
|
||
BUTTON_CMD_RIGHT_KEY,
|
||
BUTTON_CMD_LCD_BACKLIGHT_CHANGE,
|
||
};
|
||
|
||
/**
|
||
* @brief 关闭电源
|
||
*
|
||
* 用于快捷关闭电源,关闭LDO芯片电源输出
|
||
*/
|
||
#define POWER_OFF gpio_set_level(BUTTON_PowerOut_IO_NUM, POWER_OFF_OUT_LEVEL);
|
||
|
||
/**
|
||
* @brief 开启电源
|
||
*
|
||
* 用于快捷开启电源,使能LDO芯片电源输出
|
||
*/
|
||
#define POWER_ON gpio_set_level(BUTTON_PowerOut_IO_NUM, POWER_ON_OUT_LEVEL);
|
||
|
||
|
||
/**
|
||
* @brief 按键初始化函数
|
||
*
|
||
* 按键功能初始化
|
||
*
|
||
*/
|
||
void flux_button_init(void);
|
||
|
||
|
||
#ifdef __cplusplus
|
||
} /* extern "C" */
|
||
#endif
|
||
|
||
|
||
#endif /*_FLUX_BUTTON_H*/ |