00001 #ifndef __KEY_H 00002 #define __KEY_H 00003 #include "type.h" 00004 00005 #define ADC_CHANNEL_ONE 1 00006 00007 #define WM_KEY_NOT 0x00 00008 #define WM_KEY_DOWN 0x01 00009 #define WM_KEY_UP 0x02 00010 // 00011 #define VK_0_NONE 0x00 00012 #define VK_1 0x01 00013 #define VK_2 0x02 00014 #define VK_3 0x03 00015 #define VK_4 0x04 00016 #define VK_5 0x05 00017 00018 typedef struct 00019 { 00020 UINT8 lastKeyAction; 00021 UINT8 newKeyAction; 00022 UINT8 currentVKey; 00023 UINT8 countOnMin; 00024 UINT16 minSample; 00025 } keyStateType; 00026 00027 extern void ADC_Init(UINT8 iChannel); 00028 00029 void InitKeyState(keyStateType* ks); 00030 UINT8 ProcessKeyPress(keyStateType* ks); 00031 UINT8 ConvertADValueToVKValue(UINT16 adValue); 00032 00033 //Internal 00034 UINT16 DoADConv(int port); 00035 00036 #endif