sggt/App/APP_WU/Inc/key_functions.h

71 lines
1.5 KiB
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.

#ifndef _KEY_FUNCTIONS_H_
#define _KEY_FUNCTIONS_H_
#include "apps_gather.h"
typedef enum
{
KEY_OUT = 0, //输出
KEY_UP, //上
KEY_MENU, //菜单
KEY_IN, //输入
KEY_LEFT, //左
KEY_OK, //OK确认
KEY_RIGHT, //右
KEY_SWITCH, //二级菜单,切换输出&输入类型
KEY_SOURCE, //闲置,预留
KEY_DOWN, //下
KEY_BACK, //返回
KEY_NONE, //空闲
KEY_ALL //全选
}KEYS_TAG;
//tm1650扫描得到的原始键值
typedef enum
{
KEY_OUT_VAL = 76,
KEY_UP_VAL = 84,
KEY_MENU_VAL = 68,
KEY_IN_VAL = 78,
KEY_LEFT_VAL = 77,
KEY_OK_VAL = 85,
KEY_RIGHT_VAL = 94,
KEY_SWITCH_VAL = 69,
KEY_SOURCE_VAL = 111,
KEY_DOWN_VAL = 86,
KEY_BACK_VAL = 70,
KEY_NONE_VAL = 0,
KEY_ALL_VAL = 250
}KEYS_VALUE;
typedef enum
{
KEY_STATUS_DISABLE = 0,
KEY_STATUS_ENABLE
}KEYS_STATUS;
typedef struct
{
KEYS_TAG tag;
KEYS_VALUE value;
KEYS_STATUS status;
}KEYS;
extern KEYS key_pv; //当前按键
extern KEYS_STATUS key_sts[11]; //11个按键的状态排列顺序与枚举顺序一致
//按键数据类型转换
void key_char2struct(void);
//按键状态配置
void key_config(KEYS_TAG key_t, KEYS_STATUS sts);
//按键配置更新
void key_config_update(OPERATIONS ope);
#endif