/******************** (C) COPYRIGHT 2011 APTENON ********************* File Name : key.c* Author : edwin kang* Version : V0.0* Date : 11/30/2011* Description : key file.*******************************************************************************/
#define _KEY_C_
#include "includes.h"
/*lint -e830 -e831 -e534 */ //return val
/*lint -e525 -e725 -e539 */ //shuojin
#define KEY_NULL 0xFF
/*********************************************
Function: Key_Null
Description:
Write/Modify: edwin
Time: 2011-12-8*********************************************/
static void Key_Null(BYTE uAction)
{uAction = uAction;
}/**************************************************************************/
/* */
/**************************************************************************/static void Key_DVD_Reject(BYTE uAction)
{if (uAction == 0){//pressed//Beep_On();}else if (uAction == 1){//keep}else if (uAction == 2){//bounce// DVD_Fill_OpCmd(DVD_CMD_EJECT);}
}/*
************************************KEY_MAP(BYTE action),NAVI按键MAP
************************************
*/
void KEY_MAP(BYTE uAction)
{if (uAction == 0){//pressed//Beep_On();//IPC_SendKeyMessage_NAVI(MSG_ACTION_PRESSED);}else if (uAction == 1){//keep}else if (uAction == 2){//bounce// GpsSend_CntrCmd(0x92);// IPC_SendKeyMessage_NAVI(MSG_ACTION_PRESSED);}}/*
************************************KEY_Media(BYTE action),car按键MAP
************************************
*/
void KEY_Media(BYTE uAction)
{if (uAction == 0){//pressed//Beep_On();}else if (uAction == 1){//keep}else if (uAction == 2){//bounce//IPC_SendKeyMessage_Media_Sw(MSG_ACTION_PRESSED);}}/*
************************************KEY_TEL(BYTE action),bluetooth按键MAP
************************************
*/
void KEY_TEL(BYTE uAction)
{if (uAction == 0){//pressed//Beep_On();}else if (uAction == 1){//keep}else if (uAction == 2){//bounce//IPC_SendKeyMessage_Radio(MSG_ACTION_PRESSED);//Millertao20150402}}/*
************************************KEY_Menu(BYTE action),menu按键MAP
************************************
*/
void KEY_Menu(BYTE uAction)
{if (uAction == 0){//pressed//Beep_On();}else if (uAction == 1){//keep}else if (uAction == 2){//bounce//printf("\r\n>>>>key_menu ");LF_CanBus_SendControlCmd(key_menu);//IPC_SendKeyMessage_Menu(MSG_ACTION_PRESSED);}}
/*
************************************KEY_Radio(BYTE action),radio按键radio,mode
************************************
*/
const BYTE SRC_Mode[6] =
{SYSTEM_MODE_IN_CAR_MEDIA,SYSTEM_MODE_IN_DVD,SYSTEM_MODE_IN_mp5_music,SYSTEM_MODE_IN_AUX,SYSTEM_MODE_IN_TV,SYSTEM_MODE_IN_CARREC,};
void KEY_Radio(BYTE uAction)
{if (uAction == 0){//pressed//Beep_On();}else if (uAction == 1){//keep}else if (uAction == 2){//bounce//IPC_SendKeyMessage_Radio(MSG_ACTION_PRESSED);//Millertao20150402}}
/*
************************************KEY_Enter(BYTE action),radio按键MAP
************************************
*/
void KEY_Enter(BYTE uAction)
{if (uAction == 0){//pressed//Beep_On();}else if (uAction == 1){//keep}else if (uAction == 2){//bounce//printf("\r\n>>>>key_enter ");LF_CanBus_SendControlCmd(key_enter);// IPC_SendKeyMessage_ENTER(MSG_ACTION_BOUNCE);}}
/*
************************************KEY_Back(BYTE action),back按键MAP
************************************
*/void KEY_Back(BYTE uAction)
{if (uAction == 0){//pressed//Beep_On();}else if (uAction == 1){//keep}else if (uAction == 2){//bounce//printf("\r\n>>>>key_back ");LF_CanBus_SendControlCmd(key_back);}}/*
************************************KEY_Option(BYTE action),option按键MAP
************************************
*/void KEY_Option(BYTE uAction)
{if (uAction == 0){//pressed//Beep_On();}else if (uAction == 1){//keep}else if (uAction == 2){//bounce//LF_CanBus_SendControlCmd(BENZE_CMD_KNOB_DN_PRESSED);// IPC_SendKeyMessage_DEC(MSG_ACTION_PRESSED);}}/**************************************************************************/
/* */
/**************************************************************************/
/*
************************************KEY_Up(BYTE action),key_up按键MAP
************************************
*/
void KEY_Up(BYTE uAction)
{if (uAction == 0){//pressed//Beep_On();}else if (uAction == 1){//keep}else if (uAction == 2){//bounce// printf("\r\n>>>>key_up ");LF_CanBus_SendControlCmd(key_up);}}
/*
************************************KEY_Dn(BYTE action),key_Dn按键MAP
************************************
*/
void KEY_Dn(BYTE uAction)
{if (uAction == 0){//pressed//Beep_On();}else if (uAction == 1){//keep}else if (uAction == 2){//bounce// printf("\r\n>>>>key_down ");LF_CanBus_SendControlCmd(key_down);}}
/*
************************************KEY_Left(BYTE action),key_Left按键MAP
************************************
*/
void KEY_Left(BYTE uAction)
{if (uAction == 0){//pressed//Beep_On();}else if (uAction == 1){//keep}else if (uAction == 2){//bounce// printf("\r\n>>>>key_left ");LF_CanBus_SendControlCmd(key_left);}}
/*
************************************KEY_Right(BYTE action),key_Right按键MAP
************************************
*/
void KEY_Right(BYTE uAction)
{if (uAction == 0){//pressed//Beep_On();}else if (uAction == 1){//keep}else if (uAction == 2){//bounce// printf("\r\n>>>>key_right ");LF_CanBus_SendControlCmd(key_right);}}#if 0//Miller.Tao,20140912
static const KEY_DEFINE KEY_TAB[4][5] =
{{//KEY0{0, 100, Key_DVD_Reject}, // key,{0, 0, Key_Null}, // key{0, 0, Key_Null}, // key{0, 0, Key_Null}, // key{3300, 3300, Key_Null}, // key},//KEY1{{0, 0, Key_Null}, // key{0, 0, Key_Null}, // key{0, 0, Key_Null}, // key{0, 0, Key_Null}, // key{3300, 3300, Key_Null}, // key},//KEY2{{0, 0, Key_Null}, // key{0, 0, Key_Null}, // key{0, 0, Key_Null}, // key{0, 0, Key_Null}, // key{3300, 3300, Key_Null}, // key},//KEY3{{0, 0, Key_Null}, // key{0, 0, Key_Null}, // key{0, 0, Key_Null}, // key{0, 0, Key_Null}, // key{3300, 3300, Key_Null}, // key},
};
#else
#define VoltageDeta 100
static const KEY_DEFINE KEY_TAB[4][8] =
{{//KEY0{329-VoltageDeta, 329+VoltageDeta, KEY_Up}, // key,"key_up"{1716-VoltageDeta, 1716+VoltageDeta, KEY_Dn}, // key,"key_Dn"{1043-VoltageDeta, 1043+VoltageDeta, KEY_Left}, // key,"key_Left"{2500-VoltageDeta, 2500+VoltageDeta, KEY_Right}, // key,"key_Right"{2983-VoltageDeta, 2983+VoltageDeta, KEY_Enter}, // key,"key_Enter"{666-VoltageDeta, 666+VoltageDeta, KEY_Menu}, // key,"key_Menu"{2144-VoltageDeta, 2144+VoltageDeta, KEY_Back}, // key,"key_back"{3300, 3300, Key_Null}, // key},//KEY1{{0, 0, Key_Null}, // key{0, 0, Key_Null}, // key{0, 0, Key_Null}, // key{0, 0, Key_Null}, // key{3300, 3300, Key_Null}, // key},//KEY2{{0, 0, Key_Null}, // key{0, 0, Key_Null}, // key{0, 0, Key_Null}, // key{0, 0, Key_Null}, // key{3300, 3300, Key_Null}, // key},//KEY3{{0, 0, Key_Null}, // key{0, 0, Key_Null}, // key{0, 0, Key_Null}, // key{0, 0, Key_Null}, // key{3300, 3300, Key_Null}, // key},
};
#endif
static u8 GetKeyPos(u16 keyVoltage, u8 uKeyGroup);
/***************************************KEY START ***********************************/
/*********************************************
Function: Key_Dispatch
Description: read opration code
Write/Modify: edwin
Time: 2011-12-8*********************************************/
u16 GetVotFromAD(u16 u16AD)
{//u16 int_part,float_part;u16 temp;temp = u16AD;//把采集到的数据转换成电压值temp = (u16)((((u32)temp) * 3300) >> 12);//int_part = temp/1000;//float_part = temp%1000;return temp;
}/**************************************************************************/
/* */
/**************************************************************************/
static u8 GetKeyPos(u16 keyVoltage, u8 uKeyGroup)
{u8 i;for (i &#61; 0; KEY_TAB[uKeyGroup][i].keyVoltage_high !&#61; 3300 &&KEY_TAB[uKeyGroup][i].keyVoltage_low !&#61; 3300; i&#43;&#43;){if (keyVoltage >&#61; KEY_TAB[uKeyGroup][i].keyVoltage_low && keyVoltage <&#61;KEY_TAB[uKeyGroup][i].keyVoltage_high){return i;}}return KEY_NULL;
}/**************************************************************************/
/* */
/**************************************************************************/
//u8 u8Key0Pos;
void Key_Dispatch(void)
{u8 u8Key1Pos, u8Key2Pos, u8Key3Pos;u8 u8Key0Pos;/*comment these key if be used *///g_stuKEY.KeyAD[1] &#61; 0xFF;g_stuKEY.KeyAD[2] &#61; 0xFF;g_stuKEY.KeyAD[3] &#61; 0xFF;//g_stuKEY.keytest &#61; GetVotFromAD(g_stuKEY.KeyAD[0]);//return;switch (g_stuKEY.KeyScanProgress){case E_KEY_READ_FIRSR:g_stuKEY.keytest &#61; GetVotFromAD(g_stuKEY.KeyAD[0]);#if 1u8Key0Pos &#61; GetKeyPos(GetVotFromAD(g_stuKEY.KeyAD[0]), 0);u8Key1Pos &#61;KEY_NULL;// GetKeyPos(GetVotFromAD(g_stuKEY.KeyAD[1]), 1);u8Key2Pos &#61; GetKeyPos(GetVotFromAD(g_stuKEY.KeyAD[2]), 2);u8Key3Pos &#61; GetKeyPos(GetVotFromAD(g_stuKEY.KeyAD[3]), 3);
#elseu8Key0Pos &#61; GetKeyPos(g_stuKEY.KeyAD[0], 0);u8Key1Pos &#61; GetKeyPos(g_stuKEY.KeyAD[1], 1);u8Key2Pos &#61; GetKeyPos(g_stuKEY.KeyAD[2], 2);u8Key3Pos &#61; GetKeyPos(g_stuKEY.KeyAD[3], 3);
#endifif (u8Key0Pos !&#61; KEY_NULL){//g_stuKEY.KeyScanProgress &#61; E_KEY_READ_DELAY;g_stuKEY.key0Pos &#61; u8Key0Pos;}if (u8Key1Pos !&#61; KEY_NULL){//g_stuKEY.KeyScanProgress &#61; E_KEY_READ_DELAY;g_stuKEY.key1Pos &#61; u8Key1Pos;}if (u8Key2Pos !&#61; KEY_NULL){//g_stuKEY.KeyScanProgress &#61; E_KEY_READ_DELAY;g_stuKEY.key2Pos &#61; u8Key2Pos;}if (u8Key3Pos !&#61; KEY_NULL){//g_stuKEY.KeyScanProgress &#61; E_KEY_READ_DELAY;g_stuKEY.key3Pos &#61; u8Key3Pos;}break;case E_KEY_READ_DELAY:
#if 1u8Key0Pos &#61; GetKeyPos(GetVotFromAD(g_stuKEY.KeyAD[0]), 0);u8Key1Pos &#61;KEY_NULL;// GetKeyPos(GetVotFromAD(g_stuKEY.KeyAD[1]), 1);u8Key2Pos &#61; GetKeyPos(GetVotFromAD(g_stuKEY.KeyAD[2]), 2);u8Key3Pos &#61; GetKeyPos(GetVotFromAD(g_stuKEY.KeyAD[3]), 3);
#elseu8Key0Pos &#61; GetKeyPos(g_stuKEY.KeyAD[0], 0);u8Key1Pos &#61; GetKeyPos(g_stuKEY.KeyAD[1], 1);u8Key2Pos &#61; GetKeyPos(g_stuKEY.KeyAD[2], 2);u8Key3Pos &#61; GetKeyPos(g_stuKEY.KeyAD[3], 3);
#endifif (g_stuKEY.key0Pos !&#61; KEY_NULL && g_stuKEY.key0Pos &#61;&#61; u8Key0Pos){//KEY_TAB[0][g_stuKEY.key0Pos].keyfun(0);g_stuKEY.KeyScanProgress &#61; E_KEY_KEEP_DELAY;g_stuKEY.wKeyKeepDelay &#61; 200;}else if (g_stuKEY.key1Pos !&#61; KEY_NULL && g_stuKEY.key1Pos &#61;&#61; u8Key1Pos){//KEY_TAB[1][g_stuKEY.key2Pos].keyfun(0);g_stuKEY.KeyScanProgress &#61; E_KEY_KEEP_DELAY;g_stuKEY.wKeyKeepDelay &#61; 200;}else if (g_stuKEY.key2Pos !&#61; KEY_NULL && g_stuKEY.key2Pos &#61;&#61; u8Key2Pos){//KEY_TAB[2][g_stuKEY.key2Pos].keyfun(0);g_stuKEY.KeyScanProgress &#61; E_KEY_KEEP_DELAY;g_stuKEY.wKeyKeepDelay &#61; 200;}else if (g_stuKEY.key3Pos !&#61; KEY_NULL && g_stuKEY.key3Pos &#61;&#61; u8Key3Pos){//KEY_TAB[3][g_stuKEY.key3Pos].keyfun(0);g_stuKEY.KeyScanProgress &#61; E_KEY_KEEP_DELAY;g_stuKEY.wKeyKeepDelay &#61; 200;}else{g_stuKEY.key0Pos &#61; KEY_NULL;g_stuKEY.key1Pos &#61; KEY_NULL;g_stuKEY.key2Pos &#61; KEY_NULL;g_stuKEY.key3Pos &#61; KEY_NULL;g_stuKEY.KeyScanProgress &#61; E_KEY_READ_FIRSR;}break;case E_KEY_KEEP_DELAY:if (DecWordToZero(&g_stuKEY.wKeyKeepDelay)){g_stuKEY.KeyScanProgress &#61; E_KEY_KEEP;g_stuKEY.wKeyKeepDelay &#61; KEY_LONGPRESS_BREAK;}else{
#if 1u8Key0Pos &#61; GetKeyPos(GetVotFromAD(g_stuKEY.KeyAD[0]), 0);u8Key1Pos &#61;KEY_NULL;// GetKeyPos(GetVotFromAD(g_stuKEY.KeyAD[1]), 1);u8Key2Pos &#61; GetKeyPos(GetVotFromAD(g_stuKEY.KeyAD[2]), 2);u8Key3Pos &#61; GetKeyPos(GetVotFromAD(g_stuKEY.KeyAD[3]), 3);
#elseu8Key0Pos &#61; GetKeyPos(g_stuKEY.KeyAD[0], 0);u8Key1Pos &#61; GetKeyPos(g_stuKEY.KeyAD[1], 1);u8Key2Pos &#61; GetKeyPos(g_stuKEY.KeyAD[2], 2);u8Key3Pos &#61; GetKeyPos(g_stuKEY.KeyAD[3], 3);
#endifif (g_stuKEY.key0Pos !&#61; KEY_NULL && g_stuKEY.key0Pos &#61;&#61; u8Key0Pos){//}else if (g_stuKEY.key1Pos !&#61; KEY_NULL && g_stuKEY.key1Pos &#61;&#61; u8Key1Pos){//}else if (g_stuKEY.key2Pos !&#61; KEY_NULL && g_stuKEY.key2Pos &#61;&#61; u8Key2Pos){//}else if (g_stuKEY.key3Pos !&#61; KEY_NULL && g_stuKEY.key3Pos &#61;&#61; u8Key3Pos){//}else{g_stuKEY.KeyScanProgress &#61; E_KEY_BOUNCE;}}break;case E_KEY_KEEP:
#if 1u8Key0Pos &#61; GetKeyPos(GetVotFromAD(g_stuKEY.KeyAD[0]), 0);u8Key1Pos &#61;KEY_NULL;// GetKeyPos(GetVotFromAD(g_stuKEY.KeyAD[1]), 1);u8Key2Pos &#61; GetKeyPos(GetVotFromAD(g_stuKEY.KeyAD[2]), 2);u8Key3Pos &#61; GetKeyPos(GetVotFromAD(g_stuKEY.KeyAD[3]), 3);
#elseu8Key0Pos &#61; GetKeyPos(g_stuKEY.KeyAD[0], 0);u8Key1Pos &#61; GetKeyPos(g_stuKEY.KeyAD[1], 1);u8Key2Pos &#61; GetKeyPos(g_stuKEY.KeyAD[2], 2);u8Key3Pos &#61; GetKeyPos(g_stuKEY.KeyAD[3], 3);
#endifif (g_stuKEY.key0Pos !&#61; KEY_NULL && g_stuKEY.key0Pos &#61;&#61; u8Key0Pos){//if (DecWordToZero(&g_stuKEY.wKeyKeepDelay)){g_stuKEY.wKeyKeepDelay &#61; KEY_LONGPRESS_BREAK;//KEY_TAB[0][g_stuKEY.key0Pos].keyfun(1);}}else if (g_stuKEY.key1Pos !&#61; KEY_NULL && g_stuKEY.key1Pos &#61;&#61; u8Key1Pos){//if (DecWordToZero(&g_stuKEY.wKeyKeepDelay)){g_stuKEY.wKeyKeepDelay &#61; KEY_LONGPRESS_BREAK;//KEY_TAB[1][g_stuKEY.key1Pos].keyfun(1);}}else if (g_stuKEY.key2Pos !&#61; KEY_NULL && g_stuKEY.key2Pos &#61;&#61; u8Key2Pos){//if (DecWordToZero(&g_stuKEY.wKeyKeepDelay)){g_stuKEY.wKeyKeepDelay &#61; KEY_LONGPRESS_BREAK;//KEY_TAB[2][g_stuKEY.key2Pos].keyfun(1);}}else if (g_stuKEY.key3Pos !&#61; KEY_NULL && g_stuKEY.key3Pos &#61;&#61; u8Key3Pos){//if (DecWordToZero(&g_stuKEY.wKeyKeepDelay)){g_stuKEY.wKeyKeepDelay &#61; KEY_LONGPRESS_BREAK;//KEY_TAB[3][g_stuKEY.key3Pos].keyfun(1);}}else{g_stuKEY.KeyScanProgress &#61; E_KEY_BOUNCE;}break;case E_KEY_BOUNCE:if (g_stuKEY.key0Pos !&#61; KEY_NULL){//KEY_TAB[0][g_stuKEY.key0Pos].keyfun(2);}else if (g_stuKEY.key1Pos !&#61; KEY_NULL){//KEY_TAB[1][g_stuKEY.key1Pos].keyfun(2);}else if (g_stuKEY.key2Pos !&#61; KEY_NULL){//KEY_TAB[2][g_stuKEY.key2Pos].keyfun(2);}else if (g_stuKEY.key3Pos !&#61; KEY_NULL){//KEY_TAB[3][g_stuKEY.key3Pos].keyfun(2);}g_stuKEY.KeyScanProgress &#61; E_KEY_READ_FIRSR;g_stuKEY.key0Pos &#61; KEY_NULL;g_stuKEY.key1Pos &#61; KEY_NULL;g_stuKEY.key2Pos &#61; KEY_NULL;g_stuKEY.key3Pos &#61; KEY_NULL;break;}
}void KeyTask(void)
{if (!wKeyScanTimer){Key_Dispatch();wKeyScanTimer &#61; 20;//printf("\r\ng_stuKEY.KeyAD[0] : %d", g_stuKEY.keytest);}}BYTE encoderA;
BYTE encoderB;
BYTE gEncoder_A_end;//bakeup
BYTE gEncoder_B_end;//bakeup
//BYTE gRemVal_CMD;//void Init_Encoder(void)
{// gEncoder_A_end &#61; GPIO_ReadInputDataBit(KnobENC_ENDA_PORT,KnobENC_ENDA_PIN);//gEncoder_B_end &#61; GPIO_ReadInputDataBit(KnobENC_ENDB_PORT,KnobENC_ENDB_PIN);
}/*
*************************************************
*
*handle encoder
*Author:Miller.Tao20140911
*
*************************************************
*/
#define changed_value 200
#define press_low 0
#define press_mid 1
#define press_hig 2void EncoderProcess(void)
{static BYTE press_statu_count&#61;0;static BYTE press_statu&#61;0xff;if(g_stuKEY.KeyAD[1]>&#61;(2000-changed_value)&&g_stuKEY.KeyAD[1]<&#61;(2000&#43;200)){if(press_statu_count<&#61;1){//printf("\r\npress_statu : press_mid : %d", g_stuKEY.KeyAD[1]);press_statu_count&#43;&#43;;}if(press_statu_count>&#61;2){press_statu&#61;press_mid;}}elsepress_statu_count&#61;0;if(g_stuKEY.KeyAD[1]>&#61;(300-changed_value)&&g_stuKEY.KeyAD[1]<&#61;(300&#43;200)){if(press_statu&#61;&#61;press_mid){//printf("\r\nKEY_statu : key_dec %d", g_stuKEY.KeyAD[1] );LF_CanBus_SendControlCmd(key_dec);}else if(press_statu&#61;&#61;press_hig){//printf("\r\nKEY_statu : key_inc %d", g_stuKEY.KeyAD[1] );LF_CanBus_SendControlCmd(key_inc);}//printf("\r\npress_statu : press_low : %d", g_stuKEY.KeyAD[1]);press_statu&#61;press_low;}if(g_stuKEY.KeyAD[1]>&#61;(4000-changed_value)&&g_stuKEY.KeyAD[1]<&#61;(4000&#43;200)){if(press_statu&#61;&#61;press_mid){//printf("\r\nKEY_statu : key_inc %d", g_stuKEY.KeyAD[1] );LF_CanBus_SendControlCmd(key_inc);}else if(press_statu&#61;&#61;press_low){//printf("\r\nKEY_statu : key_dec %d", g_stuKEY.KeyAD[1] );LF_CanBus_SendControlCmd(key_dec);}//printf("\r\npress_statu : press_hig : %d", g_stuKEY.KeyAD[1]);press_statu&#61;press_hig;}#if 0BYTE temp_A;BYTE temp_B;temp_A &#61; GPIO_ReadInputDataBit(KnobENC_ENDA_PORT,KnobENC_ENDA_PIN);temp_B &#61; GPIO_ReadInputDataBit(KnobENC_ENDB_PORT,KnobENC_ENDB_PIN);if(temp_A !&#61; temp_B ){if(temp_A !&#61; gEncoder_A_end){gRemVal_CMD &#61; 1;if(g_stuSYSINFO.uOSDMainMode!&#61;MAIN_OSD_MODE_IN_NAVI)//MillerTao20141125LF_CanBus_SendControlCmd(BENZE_CMD_KNOB_TUNEDEC_PRESSED);//Miller.tao20140912}else if(temp_B !&#61; gEncoder_B_end){gRemVal_CMD &#61; 0;if(g_stuSYSINFO.uOSDMainMode!&#61;MAIN_OSD_MODE_IN_NAVI)//MillerTao20141125LF_CanBus_SendControlCmd(BENZE_CMD_KNOB_TUNEINC_PRESSED);}}gEncoder_A_end &#61; temp_A;gEncoder_B_end &#61; temp_B;
#endif
}
/***************************************KEY END ***********************************/
#undef _KEY_C_/*
main()
{
KeyTask();//key 按键
}
void SysTick_Handler(void)
{EncoderProcess();if(wKeyScanTimer !&#61; 0)wKeyScanTimer--;//Key SCAN DELAY
}*/
/* 这份源代码文件已被未注册的SourceFormatX格式化过 */
/* 如果您想不再添加此类信息&#xff0c;请您注册这个共享软件 */
/* 更多相关信息请访问网站: http://cn.textrush.com *//******************** (C) COPYRIGHT 2011 ********************* File Name : key.h* Author : edwin kang* Version : V0.0* Date : 09/8/2011* Description : key.c head file.*******************************************************************************/
#ifndef _KEY_H_
#define _KEY_H_
#ifdef _KEY_C_
#define _KEY_EXT_
#else
#define _KEY_EXT_ extern
#endif
#define KEY_LONGPRESS_DELAY_TIMR 50 //10ms
#define KEY_LONGPRESS_BREAK 10 //10ms#define I2C_KEY_SCAN_FIRST_TIMER 20// 1 ms
#define I2C_KEY_SCAN_SECOND_TIMER 20// 1 ms
#define I2C_KEY_SCAN_ACTION_TIMER 20// 1 mstypedef enum
{E_KEY_READ_FIRSR, E_KEY_READ_DELAY, E_KEY_KEEP_DELAY, E_KEY_KEEP,E_KEY_BOUNCE
} E_KEY_SCAN_STATUS;
typedef void(*KeyCallBack)(BYTE);
typedef struct
{u16 KeyAD[4]; E_KEY_SCAN_STATUS KeyScanProgress;u16 wKeyKeepDelay;u8 key0Pos;u8 key1Pos;u8 key2Pos;u8 key3Pos;u16 keytest;} KEY;
typedef struct
{u16 keyVoltage_low;u16 keyVoltage_high;KeyCallBack keyfun;
} KEY_DEFINE;
_KEY_EXT_ KEY g_stuKEY;
_KEY_EXT_ vu16 wKeyScanTimer;
_KEY_EXT_ BYTE gModeIndex;//millertao20150625_KEY_EXT_ void Key_Dispatch(void);
_KEY_EXT_ void KeyTask(void);
_KEY_EXT_ u16 GetVotFromAD(u16 u16AD);
_KEY_EXT_ void Key_Q3_KeyBoardScan_Task(void);_KEY_EXT_ void Init_Encoder(void);_KEY_EXT_ void EncoderProcess(void);#endif