📄 scan_key_test.c
字号:
/*
***********************************************************************
Embest Info&Tech Co., Ltd. All rights reserved.
www.embedinfo.com
***********************************************************************
---------------- file information -------------------------------------
file name: scan_key_test.c
version : v0
author : z.x.q. Embest
begin : 2006-04-10
finish : 2006-04-10
define : scan_key_test file
notes :
---------------- modify information -----------------------------------
version :
modify :
begin :
finish :
define :
-----------------------------------------------------------------------
*/
/*-------------------------------------------------------------------*/
/* include files */
/*---------------------------------------------------------------- --*/
#include "..\..\com\lpc_lib_uart\lpc_lib_uart.h"
#include "..\..\com\lpc_lib_keyboard\lpc_lib_keyboard.h"
/*-------------------------------------------------------------------*/
/* global function/variable declare */
/*-------------------------------------------------------------------*/
//the scan key value,initialize with 255,that as a flag (>15)
void key_test(void);
/*-------------------------------------------------------------------*/
/* function code */
/*-------------------------------------------------------------------*/
extern INT32U key_data;
void Main(void)
{
lpc_init_pll_manual(); //init the pll clock
VICIntEnClr = 0xffffffff;
VICVectAddr = 0;
VICIntSelect = 0;
spi_data_send(0, 0xfb);
spi_data_send(0, 0x56);
spi_data_send(0, 0xfb);
spi_data_send(0, 0x56);
uart0_init(57600); //set baudrate 19200
uart0_printf("\nwelcome,:)\n");
key_test();
}
void key_test(void)
{
INT32U i=0;
key_init();
while(1)
{
if(key_data<16) //judge key value effectivity
{
uart0_printf("%x,",key_data);
key_data=255;
i++;
if(i>14) //10 chars for a line
{
uart0_sendch('\n');
i=0;
key_close();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -