|
如何實(shí)現(xiàn)一個(gè)按鍵多種功能,這里介紹了按鍵單擊,雙擊,長(zhǎng)按,源代碼,親測(cè)有效,模塊獨(dú)立,包括.c和.h文件
my_key.c
my_key.h
- /**
- * @file my_key.h
- * @author xxb
- * @version V1.0
- * @date 07/29/2017
- * @brief This file contains all the functions prototypes for the KEY firmware
- */
- #ifndef __MY_KEY_H__
- #define __MY_KEY_H__
- #include "..\inc\cpu.h"
- #ifdef KEY_GLOBAL
- #define KEY_EXT
- #else
- #define KEY_EXT extern
- #endif
- #define NO_KEY 0xFF
- #define MyKEY_NAME1 1
- #define MyKEY_NAME2 2
- #define MyKEY_NAME1_LONG MyKEY_NAME1+10
- KEY_EXT U8 key_state;
- KEY_EXT U8 old_val;
- void Key_Process(void);
- #endif
復(fù)制代碼
|
評(píng)分
-
查看全部評(píng)分
|