56 lines
1.3 KiB
C
56 lines
1.3 KiB
C
#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"
|
|
|
|
#define BUTTON_Center_IO_NUM GPIO_NUM_42
|
|
#define BUTTON_Left_IO_NUM GPIO_NUM_41
|
|
#define BUTTON_Right_IO_NUM GPIO_NUM_40
|
|
|
|
#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
|
|
|
|
#define POWER_OFF gpio_set_level(BUTTON_PowerOut_IO_NUM, POWER_OFF_OUT_LEVEL);
|
|
#define POWER_ON gpio_set_level(BUTTON_PowerOut_IO_NUM, POWER_ON_OUT_LEVEL);
|
|
|
|
/* Define button control command codes */
|
|
enum button_cmd_t
|
|
{
|
|
BUTTON_CMD_POWER_ON=0,
|
|
BUTTON_CMD_POWER_OFF=1,
|
|
BUTTON_CMD_CENTER_KEY=2,
|
|
BUTTON_CMD_LEFT_KEY=3,
|
|
BUTTON_CMD_RIGHT_KEY=4,
|
|
BUTTON_CMD_LCD_BACKLIGHT_CHANGE=5,
|
|
};
|
|
|
|
#define CONFIG_GPIO_BUTTON_SUPPORT_POWER_SAVE 0
|
|
|
|
void button_init_func(uint32_t button_num);
|
|
|
|
void button_init(void);
|
|
|
|
#ifdef __cplusplus
|
|
} /* extern "C" */
|
|
#endif
|
|
|
|
|
|
#endif /*_FLUX_BUTTON_H*/ |