forked from SZV10X_Software/SZV103_FM33A0xxEV_SiZhu

jinlicong
2024-04-24 f0de07104a329cc2eb6d2e77a23214313e675034
Function/KEY/key.c
@@ -1,88 +1,37 @@
#include "key.h"
#include "gpio.h"
/******************************************
 * func:    Get_key
 * desc:    scan key & return key data
 * input:   none
 * output:  none
 * return:  key data  4bytes:
 *   4#   3#  2#   1#  byte
 * |   |KEY3|KEY2|KEY1|
 *****************************************/
uint32 Get_key(void)
/*******************************************************************************
 * Function Name: Key_GPIO_Init
 * Parameters: none
 * Return: none
 * Description:
 ******************************************************************************/
void Key_GPIO_Init(void)
{
   uint32 temp32a=0,temp32b=1;
   while(temp32a != temp32b)
   {
      temp32a = (KEY1 | (KEY2 << 8) | (KEY3 << 16));
      delay_ms(1);//È¥¶¶¶¯
      temp32b = (KEY1 | (KEY2 << 8) | (KEY3 << 16));
   }
   return(temp32a);
   InputtIO(KEY1_PORT,KEY1_PIN,IN_PULLUP);
   InputtIO(KEY2_PORT,KEY2_PIN,IN_PULLUP);
   InputtIO(KEY3_PORT,KEY3_PIN,IN_PULLUP);
   InputtIO(KEY4_PORT,KEY4_PIN,IN_PULLUP);
}
uint32 get_key4(void)
void keyPro(void)
{
   uint32 temp32a=0,temp32b=1;
   static uint8_t P_Key1Cnt=0,R_Key2Cnt=0,L_Key3Cnt=0;
   
   while(temp32a != temp32b)
   P_Key1Cnt = (KEY1_IO_READ==Bit_RESET)? P_Key1Cnt+1:0;
   R_Key2Cnt = (KEY2_IO_READ==Bit_RESET)? R_Key2Cnt+1:0;
   L_Key3Cnt = (KEY3_IO_READ==Bit_RESET)? L_Key3Cnt+1:0;
   if(R_Key2Cnt== 5)
   {
      temp32a = KEY4;
      delay_ms(1);//È¥¶¶¶¯
      temp32b = KEY4;
   }
      //ÀýÈçÓÒ¼ü³¤°´5Ãë½øÈë²éѯģʽ
   }
   
   return(temp32a);
}
/******************************************
 * func:    Get_key_count
 * desc:
 * input:   none
 * output:  none
 * return:
 *****************************************/
/*
uint8_t Get_key_count(uint8_t keybufs,uint8_t key_count)
{
   uint32 key_stat=0;
   key_stat = Get_key(); //get key state
   if((key_stat) & 0xff)         //°´¼ü°´Ï ËÉ¿ªÖ®ºó²ÅÄÜÉúЧÏÂÒ»´Î°´¼ü
   {
      if( !keybufs )
      {
         keybufs  = 0x01;
      }
   }
   else
   {
      if( keybufs )
      {
         keybufs  = 0x00;
         key_count++;
         if(key_count==11)
         {
            key_count = 0;
         }
      }
   }
   return key_count;
}     */
void key_interruptinit_disable(void)
{
}
void key_interruptinit_enable(void)
{
}
void key_interruptinit(void)
{
}