kb.c

来自「可以实现44B0的底层所有通信」· C语言 代码 · 共 48 行

C
48
字号
#include <string.h>
#include "..\inc\def.h"
#include "..\inc\44b.h"
#include "..\inc\44blib.h"
#include "..\inc\kb.h"

void Test_Kb(void)
{
    U8 which_key;
    rPCONG=0x00ff;	//EINT7~0
    rPUPG=0x0;		//pull up enable    
    Delay(0);  //calibrate Delay()
    Led_Display(7);
    Delay(1000);  //calibrate Delay()
    Led_Display(0);
    Delay(5000);  //calibrate Delay()
    Led_Display(7);
    Uart_Printf("\n now let's start, enter a key please, press any key return\n");
    while(!Uart_GetKey())
             {
    	         while((rPDATG & 0xf0)==0xf0 )
    	         	{
    	         	  if ( Uart_GetKey())
    	         	  	{
    	         	  	  return ;
    	         	  	}
    	         	}
    	         which_key=rPDATG&0xf0;
                switch(which_key)
                          {
    	                     case 0xe0:
    	                                      Led_Display(0x1);
    	                                      break;
    	                     case 0xd0:
    	                                      Led_Display(0x2);
    	                                      break;
    	                     case 0xb0:
    	                                      Led_Display(0x4);
    	                                      break;
    	                     case 0x70:
    	                                      Led_Display(0x7);
    	                                      break;
    	                     default :
    	                                       break;
        	              }
     	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?