Index: yc_kscan.h
===================================================================
--- /YC3121_SDK/fw/sdk/yc_kscan.h	(revision 669)
+++ /YC3121_SDK/fw/sdk/yc_kscan.h	(working copy)
@@ -4,83 +4,98 @@
 #include "yc3121.h"
 #include "yc_gpio.h"
 #include "yc_timer.h"
+#include "board_config.h"
 
-#define SHAKE_DELAY	20
+#define SHAKE_DELAY	5
 
-#define KEY_S1	KEY_V1
-#define KEY_S2	KEY_V2
-#define KEY_S3	KEY_V6
-#define KEY_S4	KEY_V3
-#define KEY_S5	KEY_V7
-#define KEY_S6	KEY_V10
-#define KEY_S7	KEY_V4
-#define KEY_S8	KEY_V8
-#define KEY_S9	KEY_V11
-#define KEY_S10	KEY_V13
-#define KEY_S11	KEY_V5
-#define KEY_S12	KEY_V9
-#define KEY_S13	KEY_V12
-#define KEY_S14	KEY_V14
-#define KEY_S15	KEY_V15
-
-#define KEY_V1	30
-#define KEY_V2	31
-#define KEY_V3	32
-#define KEY_V4	33
-#define KEY_V5	34
-#define KEY_V6	35
-#define KEY_V7	36
-#define KEY_V8	37
-#define KEY_V9	38
-#define KEY_V10	39
-#define KEY_V11	40
-#define KEY_V12	41
-#define KEY_V13	42
-#define KEY_V14	43
-#define KEY_V15	44
-
-#define GPIO_GROUP_Line_1 GPIOC
-#define Line_1 GPIO_Pin_7
-
-#define GPIO_GROUP_Line_2 GPIOC
-#define Line_2 GPIO_Pin_9
+#if (BOARD_VER == MPOS_BOARD_V2_1)
 
-#define GPIO_GROUP_Line_3 GPIOC
-#define Line_3 GPIO_Pin_8
+    #define KEY_S1	KEY_V1
+    #define KEY_S2	KEY_V2
+    #define KEY_S3	KEY_V6
+    #define KEY_S4	KEY_V3
+    #define KEY_S5	KEY_V7
+    #define KEY_S6	KEY_V10
+    #define KEY_S7	KEY_V4
+    #define KEY_S8	KEY_V8
+    #define KEY_S9	KEY_V11
+    #define KEY_S10	KEY_V13
+    #define KEY_S11	KEY_V5
+    #define KEY_S12	KEY_V9
+    #define KEY_S13	KEY_V12
+    #define KEY_S14	KEY_V14
+    #define KEY_S15	KEY_V15
+
+    #define KEY_V1	30
+    #define KEY_V2	31
+    #define KEY_V3	32
+    #define KEY_V4	33
+    #define KEY_V5	34
+    #define KEY_V6	35
+    #define KEY_V7	36
+    #define KEY_V8	37
+    #define KEY_V9	38
+    #define KEY_V10	39
+    #define KEY_V11	40
+    #define KEY_V12	41
+    #define KEY_V13	42
+    #define KEY_V14	43
+    #define KEY_V15	44
+
+#elif (BOARD_VER == EPOS_BOARD_V1_0)
+
+    #define KEY_1  32
+    #define KEY_2  35
+    #define KEY_3  38
+    #define KEY_4  41
+    #define KEY_5  44
+    #define KEY_6  31
+    #define KEY_7  34
+    #define KEY_8  40
+    #define KEY_9  37
+    #define KEY_10 33
+    #define KEY_11 30
+    #define KEY_12 43
+    #define KEY_13 39
+    #define KEY_14 42
+    #define KEY_15 45
+    #define KEY_16 47
+    #define KEY_17 46
+    #define KEY_18 36
+
+    #define KEY_NUM_0   KEY_11
+    #define KEY_NUM_1   KEY_6
+    #define KEY_NUM_2   KEY_1
+    #define KEY_NUM_3   KEY_10
+    #define KEY_NUM_4   KEY_7
+    #define KEY_NUM_5   KEY_2
+    #define KEY_NUM_6   KEY_18
+    #define KEY_NUM_7   KEY_9
+    #define KEY_NUM_8   KEY_3
+    #define KEY_NUM_9   KEY_13
+    #define KEY_UP      KEY_8
+    #define KEY_DOWN    KEY_4
+    #define KEY_CONFIRM KEY_16
+    #define KEY_CANCEL  KEY_15
+    #define KEY_CLEAR   KEY_17
+    #define KEY_MENU    KEY_14
+    #define KEY_F1      KEY_12
+    #define KEY_F2      KEY_5
 
-#define GPIO_GROUP_Line_4 GPIOC
-#define Line_4 GPIO_Pin_10
-
-#define GPIO_GROUP_Line_5 GPIOC
-#define Line_5 GPIO_Pin_11
-
-/**
-  * @brief  Keyboard related gpio initializes pull-up.
-  * @param  None 
-  * @retval None
-  */
-void Key_Gpio_Init_IPU(void);
-
-/**
-  * @brief  Keyboard GPIO level detection.
-  * @param  scanColumn: Scan column selection. 
-  * @param  value: 0.
-  * @retval None
-  */
-void Key_IODirection(uint8_t scanColumn,uint8_t value);
-
-/**
-  * @brief  Gets the keyboard IO input status.
-  * @param  keyIO
-  * @retval None
-  */
-uint8_t Key_GetIoValue(uint8_t keyIO);
+#endif
 
 /**
   * @brief  Keyboard scan function.
-  * @param  None. 
+  * @param  None.
   * @retval key assignments
   */
 uint8_t KEY_Scan(void);
 
+/**
+  * @brief  Keyboard release detection.
+  * @param  None.
+  * @retval None.
+  */
+void KEY_Scan_check(void);
+
 #endif

Index: yc_kscan.c
===================================================================
--- /YC3121_SDK/fw/sdk/yc_kscan.c	(revision 669)
+++ /YC3121_SDK/fw/sdk/yc_kscan.c	(working copy)
@@ -1,171 +1,337 @@
 #include "yc_kscan.h"
 
-const uint8_t keyMatrix[5][5] = 
+#if (BOARD_VER == MPOS_BOARD_V2_1)
+const uint8_t keyMatrix[5][5] =
 {
-	{KEY_S1,     0,       0,       0,       0   },
-	{KEY_S2,  KEY_S3,     0,       0,       0   },
-	{KEY_S4,  KEY_S5,  KEY_S6,     0,       0   },
-	{KEY_S7,  KEY_S8,  KEY_S9,  KEY_S10,    0   },
-	{KEY_S11, KEY_S12, KEY_S13, KEY_S14, KEY_S15}
+    {KEY_S1,     0,       0,       0,       0   },
+    {KEY_S2,  KEY_S3,     0,       0,       0   },
+    {KEY_S4,  KEY_S5,  KEY_S6,     0,       0   },
+    {KEY_S7,  KEY_S8,  KEY_S9,  KEY_S10,    0   },
+    {KEY_S11, KEY_S12, KEY_S13, KEY_S14, KEY_S15}
 };
+#elif (BOARD_VER == EPOS_BOARD_V1_0)
+const uint8_t keyMatrix[6][5] =
+{
+    {KEY_1,     0,        0,      0,      0},
+    {KEY_2,  KEY_6,       0,      0,      0},
+    {KEY_3,  KEY_7,  KEY_12,      0,      0},
+    {KEY_4,  KEY_8,  KEY_11, KEY_13,      0},
+    {KEY_5,  KEY_9,  KEY_10, KEY_14, KEY_15},
+    {KEY_16, KEY_17, KEY_18,      0,      0}
+};
+#endif
 
-void Key_Gpio_Init_IPU(void)
+/**
+  * @brief  Keyboard related gpio initializes pull-up.
+  * @param  None
+  * @retval None
+  */
+static void Key_Gpio_Init_IPU(void)
 {
-  GPIO_InitTypeDef GPIO_InitStruct;
-	
-	GPIO_InitStruct.GPIO_Pin = Line_1;
-	GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IPU;
-	GPIO_Init(GPIO_GROUP_Line_1,&GPIO_InitStruct);
-
-	GPIO_InitStruct.GPIO_Pin = Line_2;
-	GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IPU;
-	GPIO_Init(GPIO_GROUP_Line_2,&GPIO_InitStruct);
-
-
-	GPIO_InitStruct.GPIO_Pin = Line_3;
-	GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IPU;
-	GPIO_Init(GPIO_GROUP_Line_3,&GPIO_InitStruct);	
-
-	GPIO_InitStruct.GPIO_Pin = Line_4;
-	GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IPU;
-	GPIO_Init(GPIO_GROUP_Line_4,&GPIO_InitStruct);		
-
-
-	GPIO_InitStruct.GPIO_Pin = Line_5;
-	GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IPU;
-	GPIO_Init(GPIO_GROUP_Line_5,&GPIO_InitStruct);	
-}
-
-void Key_IODirection(uint8_t scanColumn,uint8_t value)
-{
-	switch(scanColumn)
-	{
-		case	0:
-			GPIO_Config(GPIO_GROUP_Line_1, Line_1, OUTPUT_LOW);
-//			GPIO_WriteBit(GPIO_GROUP_Line_1, Line_1, (BitAction)value);
-		break;
-		case	1:
-			GPIO_Config(GPIO_GROUP_Line_2, Line_2, OUTPUT_LOW);
-//			GPIO_WriteBit(GPIO_GROUP_Line_2, Line_2, (BitAction)value);
-		break;
-		case	2:
-			GPIO_Config(GPIO_GROUP_Line_3, Line_3, OUTPUT_LOW);
-//			GPIO_WriteBit(GPIO_GROUP_Line_3, Line_3, (BitAction)value);
-		break;
-		case	3:
-			GPIO_Config(GPIO_GROUP_Line_4, Line_4, OUTPUT_LOW);
-//			GPIO_WriteBit(GPIO_GROUP_Line_4, Line_4, (BitAction)value);
-		break;
-		case	0xff:
-			GPIO_Config(GPIO_GROUP_Line_1, Line_1, OUTPUT_LOW);
-			GPIO_Config(GPIO_GROUP_Line_2, Line_2, OUTPUT_LOW);
-			GPIO_Config(GPIO_GROUP_Line_3, Line_3, OUTPUT_LOW);
-			GPIO_Config(GPIO_GROUP_Line_4, Line_4, OUTPUT_LOW);
-			GPIO_Config(GPIO_GROUP_Line_5, Line_5, OUTPUT_LOW);
-//			GPIO_WriteBit(GPIO_GROUP_Line_1, Line_1, (BitAction)value);
-//			GPIO_WriteBit(GPIO_GROUP_Line_2, Line_2, (BitAction)value);
-//			GPIO_WriteBit(GPIO_GROUP_Line_3, Line_3, (BitAction)value);
-//			GPIO_WriteBit(GPIO_GROUP_Line_4, Line_4, (BitAction)value);
-//			GPIO_WriteBit(GPIO_GROUP_Line_5, Line_5, (BitAction)value);
-			break;
-		default:
-			break;
-	}
-}
-
-uint8_t Key_GetIoValue(uint8_t keyIO)
-{
-	uint8_t temp = 0xff;
-	
-	switch (keyIO)
-	{
-		case 0:
-			if (0 == GPIO_ReadInputDataBit(GPIO_GROUP_Line_2, Line_2))
-				temp = 1;
-			else if (0 == GPIO_ReadInputDataBit(GPIO_GROUP_Line_3, Line_3))
-				temp = 2;
-			else if (0 == GPIO_ReadInputDataBit(GPIO_GROUP_Line_4, Line_4))
-				temp = 3;
-			else if (0 == GPIO_ReadInputDataBit(GPIO_GROUP_Line_5, Line_5))
-				temp = 4;
-		break;
-		case 1:
-			if (0 == GPIO_ReadInputDataBit(GPIO_GROUP_Line_3, Line_3))
-				temp = 2;
-			else if (0 == GPIO_ReadInputDataBit(GPIO_GROUP_Line_4, Line_4))
-				temp = 3;
-			else if (0 == GPIO_ReadInputDataBit(GPIO_GROUP_Line_5, Line_5))
-				temp = 4;
-		break;
-		case 2:
-			if (0 == GPIO_ReadInputDataBit(GPIO_GROUP_Line_4, Line_4))
-				temp = 3;
-			else if (0 == GPIO_ReadInputDataBit(GPIO_GROUP_Line_5, Line_5))
-				temp = 4;
-		break;
-		case 3:
-			if (0 == GPIO_ReadInputDataBit(GPIO_GROUP_Line_5, Line_5))
-				temp = 4;
-			break;
-		case 0xff:
-			if( 0 == GPIO_ReadInputDataBit(GPIO_GROUP_Line_1, Line_1) )
-			  temp = 0;
-		  else if( 0 == GPIO_ReadInputDataBit(GPIO_GROUP_Line_2, Line_2) )
-			  temp = 1;
-		  else if( 0 == GPIO_ReadInputDataBit(GPIO_GROUP_Line_3, Line_3) )
-			  temp = 2;
-		  else if( 0 == GPIO_ReadInputDataBit(GPIO_GROUP_Line_4, Line_4) )
-			  temp = 3;
-		  else if( 0 == GPIO_ReadInputDataBit(GPIO_GROUP_Line_5, Line_5) )
-			  temp = 4;
-      break;
-			default: break;
-	}
-	return temp;
+#if (BOARD_VER == MPOS_BOARD_V2_1)
+    GPIO_InitTypeDef GPIO_InitStruct;
+
+    GPIO_InitStruct.GPIO_Pin = Line_1;
+    GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IPU;
+    GPIO_Init(GPIO_GROUP_Line_1, &GPIO_InitStruct);
+
+    GPIO_InitStruct.GPIO_Pin = Line_2;
+    GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IPU;
+    GPIO_Init(GPIO_GROUP_Line_2, &GPIO_InitStruct);
+
+    GPIO_InitStruct.GPIO_Pin = Line_3;
+    GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IPU;
+    GPIO_Init(GPIO_GROUP_Line_3, &GPIO_InitStruct);
+
+    GPIO_InitStruct.GPIO_Pin = Line_4;
+    GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IPU;
+    GPIO_Init(GPIO_GROUP_Line_4, &GPIO_InitStruct);
+
+    GPIO_InitStruct.GPIO_Pin = Line_5;
+    GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IPU;
+    GPIO_Init(GPIO_GROUP_Line_5, &GPIO_InitStruct);
+
+#elif (BOARD_VER == EPOS_BOARD_V1_0)
+    GPIO_InitTypeDef GPIO_InitStruct;
+
+    GPIO_InitStruct.GPIO_Pin = KEY_PIN_1;
+    GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IPU;
+    GPIO_Init(KEY_PORT_1, &GPIO_InitStruct);
+
+    GPIO_InitStruct.GPIO_Pin = KEY_PIN_2;
+    GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IPU;
+    GPIO_Init(KEY_PORT_2, &GPIO_InitStruct);
+
+    GPIO_InitStruct.GPIO_Pin = KEY_PIN_3;
+    GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IPU;
+    GPIO_Init(KEY_PORT_3, &GPIO_InitStruct);
+
+    GPIO_InitStruct.GPIO_Pin = KEY_PIN_4;
+    GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IPU;
+    GPIO_Init(KEY_PORT_4, &GPIO_InitStruct);
+
+    GPIO_InitStruct.GPIO_Pin = KEY_PIN_5;
+    GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IPU;
+    GPIO_Init(KEY_PORT_5, &GPIO_InitStruct);
+
+    GPIO_InitStruct.GPIO_Pin = KEY_PIN_6;
+    GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IPU;
+    GPIO_Init(KEY_PORT_6, &GPIO_InitStruct);
+#endif
 }
 
-static uint8_t GetKeyCode(void)
+/**
+  * @brief  Keyboard GPIO level detection.
+  * @param  scanColumn: Scan column selection.
+  * @retval None
+  */
+static void Key_IODirection(uint8_t scanColumn)
+{
+#if (BOARD_VER == MPOS_BOARD_V2_1)
+    switch (scanColumn)
+    {
+    case	0:
+        GPIO_Config(GPIO_GROUP_Line_1, Line_1, OUTPUT_LOW);
+        break;
+    case	1:
+        GPIO_Config(GPIO_GROUP_Line_2, Line_2, OUTPUT_LOW);
+        break;
+    case	2:
+        GPIO_Config(GPIO_GROUP_Line_3, Line_3, OUTPUT_LOW);
+        break;
+    case	3:
+        GPIO_Config(GPIO_GROUP_Line_4, Line_4, OUTPUT_LOW);
+        break;
+    case	0xff:
+        GPIO_Config(GPIO_GROUP_Line_1, Line_1, OUTPUT_LOW);
+        GPIO_Config(GPIO_GROUP_Line_2, Line_2, OUTPUT_LOW);
+        GPIO_Config(GPIO_GROUP_Line_3, Line_3, OUTPUT_LOW);
+        GPIO_Config(GPIO_GROUP_Line_4, Line_4, OUTPUT_LOW);
+        GPIO_Config(GPIO_GROUP_Line_5, Line_5, OUTPUT_LOW);
+        break;
+    default:
+        break;
+    }
+#elif (BOARD_VER == EPOS_BOARD_V1_0)
+    switch (scanColumn)
+    {
+    case	0:
+        GPIO_Config(KEY_PORT_1, KEY_PIN_1, OUTPUT_LOW);
+        break;
+    case	1:
+        GPIO_Config(KEY_PORT_2, KEY_PIN_2, OUTPUT_LOW);
+        break;
+    case	2:
+        GPIO_Config(KEY_PORT_3, KEY_PIN_3, OUTPUT_LOW);
+        break;
+    case	3:
+        GPIO_Config(KEY_PORT_4, KEY_PIN_4, OUTPUT_LOW);
+        break;
+    case	4:
+        GPIO_Config(KEY_PORT_5, KEY_PIN_5, OUTPUT_LOW);
+        break;
+    case	0xff:
+        GPIO_Config(KEY_PORT_1, KEY_PIN_1, OUTPUT_LOW);
+        GPIO_Config(KEY_PORT_2, KEY_PIN_2, OUTPUT_LOW);
+        GPIO_Config(KEY_PORT_3, KEY_PIN_3, OUTPUT_LOW);
+        GPIO_Config(KEY_PORT_4, KEY_PIN_4, OUTPUT_LOW);
+        GPIO_Config(KEY_PORT_5, KEY_PIN_5, OUTPUT_LOW);
+        GPIO_Config(KEY_PORT_6, KEY_PIN_6, OUTPUT_LOW);
+        break;
+    default:
+        break;
+    }
+#endif
+}
+
+/**
+  * @brief  Gets the keyboard IO input status.
+  * @param  keyIO
+  * @retval None
+  */
+static uint8_t Key_GetIoValue(uint8_t keyIO)
 {
-    uint8_t i,keyvalue;    
+    uint8_t temp = 0xff;
+#if (BOARD_VER == MPOS_BOARD_V2_1)
+    switch (keyIO)
+    {
+    case 0:
+        if (0 == GPIO_ReadInputDataBit(GPIO_GROUP_Line_2, Line_2))
+            temp = 1;
+        else if (0 == GPIO_ReadInputDataBit(GPIO_GROUP_Line_3, Line_3))
+            temp = 2;
+        else if (0 == GPIO_ReadInputDataBit(GPIO_GROUP_Line_4, Line_4))
+            temp = 3;
+        else if (0 == GPIO_ReadInputDataBit(GPIO_GROUP_Line_5, Line_5))
+            temp = 4;
+        break;
+    case 1:
+        if (0 == GPIO_ReadInputDataBit(GPIO_GROUP_Line_3, Line_3))
+            temp = 2;
+        else if (0 == GPIO_ReadInputDataBit(GPIO_GROUP_Line_4, Line_4))
+            temp = 3;
+        else if (0 == GPIO_ReadInputDataBit(GPIO_GROUP_Line_5, Line_5))
+            temp = 4;
+        break;
+    case 2:
+        if (0 == GPIO_ReadInputDataBit(GPIO_GROUP_Line_4, Line_4))
+            temp = 3;
+        else if (0 == GPIO_ReadInputDataBit(GPIO_GROUP_Line_5, Line_5))
+            temp = 4;
+        break;
+    case 3:
+        if (0 == GPIO_ReadInputDataBit(GPIO_GROUP_Line_5, Line_5))
+            temp = 4;
+        break;
+    case 0xff:
+        if (0 == GPIO_ReadInputDataBit(GPIO_GROUP_Line_1, Line_1))
+            temp = 0;
+        else if (0 == GPIO_ReadInputDataBit(GPIO_GROUP_Line_2, Line_2))
+            temp = 1;
+        else if (0 == GPIO_ReadInputDataBit(GPIO_GROUP_Line_3, Line_3))
+            temp = 2;
+        else if (0 == GPIO_ReadInputDataBit(GPIO_GROUP_Line_4, Line_4))
+            temp = 3;
+        else if (0 == GPIO_ReadInputDataBit(GPIO_GROUP_Line_5, Line_5))
+            temp = 4;
+        break;
+    default:
+        break;
+    }
+    return temp;
+#elif (BOARD_VER == EPOS_BOARD_V1_0)
+    switch (keyIO)
+    {
+    case 0:
+        if (0 == GPIO_ReadInputDataBit(KEY_PORT_2, KEY_PIN_2))
+            temp = 0;
+        else if (0 == GPIO_ReadInputDataBit(KEY_PORT_3, KEY_PIN_3))
+            temp = 1;
+        else if (0 == GPIO_ReadInputDataBit(KEY_PORT_4, KEY_PIN_4))
+            temp = 2;
+        else if (0 == GPIO_ReadInputDataBit(KEY_PORT_5, KEY_PIN_5))
+            temp = 3;
+        else if (0 == GPIO_ReadInputDataBit(KEY_PORT_6, KEY_PIN_6))
+            temp = 4;
+        break;
+    case 1:
+        if (0 == GPIO_ReadInputDataBit(KEY_PORT_3, KEY_PIN_3))
+            temp = 1;
+        else if (0 == GPIO_ReadInputDataBit(KEY_PORT_4, KEY_PIN_4))
+            temp = 2;
+        else if (0 == GPIO_ReadInputDataBit(KEY_PORT_5, KEY_PIN_5))
+            temp = 3;
+        else if (0 == GPIO_ReadInputDataBit(KEY_PORT_6, KEY_PIN_6))
+            temp = 4;
+        break;
+    case 2:
+        if (0 == GPIO_ReadInputDataBit(KEY_PORT_4, KEY_PIN_4))
+            temp = 2;
+        else if (0 == GPIO_ReadInputDataBit(KEY_PORT_5, KEY_PIN_5))
+            temp = 3;
+        else if (0 == GPIO_ReadInputDataBit(KEY_PORT_6, KEY_PIN_6))
+            temp = 4;
+        break;
+    case 3:
+        if (0 == GPIO_ReadInputDataBit(KEY_PORT_5, KEY_PIN_5))
+            temp = 3;
+        else if (0 == GPIO_ReadInputDataBit(KEY_PORT_6, KEY_PIN_6))
+            temp = 4;
+        break;
+    case 4:
+        if (0 == GPIO_ReadInputDataBit(KEY_PORT_6, KEY_PIN_6))
+            temp = 4;
+        break;
+    case 0xff:
+        if (0 == GPIO_ReadInputDataBit(KEY_PORT_1, KEY_PIN_1))
+            temp = 0;
+        else if (0 == GPIO_ReadInputDataBit(KEY_PORT_2, KEY_PIN_2))
+            temp = 1;
+        else if (0 == GPIO_ReadInputDataBit(KEY_PORT_3, KEY_PIN_3))
+            temp = 2;
+        break;
+    default:
+        break;
+    }
+    return temp;
+#endif
+}
 
+static uint8_t GetKeyCode(void)
+{
+    uint8_t i, keyvalue;
+#if (BOARD_VER == MPOS_BOARD_V2_1)
     for (i = 0; i < 4; i++)
     {
-			Key_Gpio_Init_IPU();
-			delay_ms(5);
-			
-      keyvalue = Key_GetIoValue(0xff);
-        
-			if (keyvalue != 0xff )
-			{
-				return  keyMatrix[4][keyvalue];
-			}
-        
-			Key_IODirection(i, 0);
-			delay_ms(SHAKE_DELAY);
-			keyvalue = Key_GetIoValue(i);
-			if(keyvalue != 0xff)
-			{
-				return (keyMatrix[keyvalue-1][i]);
-			}
+        Key_Gpio_Init_IPU();
+        delay_ms(5);
+
+        keyvalue = Key_GetIoValue(0xff);
+
+        if (keyvalue != 0xff)
+        {
+            return  keyMatrix[4][keyvalue];
+        }
+
+        Key_IODirection(i);
+        delay_ms(SHAKE_DELAY);
+        keyvalue = Key_GetIoValue(i);
+        if (keyvalue != 0xff)
+        {
+            return (keyMatrix[keyvalue - 1][i]);
+        }
+    }
+
+    return 0;
+#elif (BOARD_VER == EPOS_BOARD_V1_0)
+    Key_Gpio_Init_IPU();
+    delay_ms(1);
+
+    keyvalue = Key_GetIoValue(0xff);
+
+    if (keyvalue != 0xff)
+    {
+        return  keyMatrix[5][keyvalue];
+    }
+
+    for (i = 0; i < 5; i++)
+    {
+        Key_Gpio_Init_IPU();
+        delay_ms(1);
+
+        Key_IODirection(i);
+        delay_ms(SHAKE_DELAY);
+
+        keyvalue = Key_GetIoValue(i);
+        if (keyvalue != 0xff)
+        {
+            return (keyMatrix[keyvalue][i]);
+        }
     }
-    
-    return 0;		
+
+    return 0;
+#endif
 }
 
 uint8_t KEY_Scan(void)
 {
-	uint8_t KeyCode = 0, KeyCode2 = 0;
+    uint8_t KeyCode = 0, KeyCode2 = 0;
 
-	KeyCode = GetKeyCode();
-	if (KeyCode != 0)
-	{	        
-		delay_ms(SHAKE_DELAY);
-		KeyCode2 = GetKeyCode();
-		if (KeyCode2 == KeyCode)
-		{		
-				return KeyCode2;
-		}
-	}	
+    KeyCode = GetKeyCode();
+    if (KeyCode != 0)
+    {
+        delay_ms(SHAKE_DELAY);
+        KeyCode2 = GetKeyCode();
+        if (KeyCode2 == KeyCode)
+        {
+            return KeyCode2;
+        }
+    }
+
+    return 0;
+}
 
-	return 0;
+void KEY_Scan_check(void)
+{
+    while (GetKeyCode());
 }
