BF533对键盘功能实现的主函数
0赞
发表于 4/8/2012 9:18:03 AM
阅读(2553)
#include "dm_bf5xx.h"
#include "dm_types.h"
/****************************************************************************
* 名称 :main
* 功能 :KeyBoard 测试函数
* 入口参数 :无
* 出口参数 :无
****************************************************************************/
void main(void)
{
Set_PLL( (int16_t)(CORECLK/CLKIN), (int16_t)(CORECLK/SYSCLK));
Init_EBIU();
Init_timer0_Interrupts();
Init_Timers();
Init_Platform_KBD();
while(1){
}
}
* 名称 :keydecode
* 功能 :打印键盘键值
* 入口参数 :flag 按键标志
* keydat 键值
* 出口参数 :无
****************************************************************************/
void keydecode(int_t flag ,uint8_t keydat)
{
if(flag == 1){
switch (keydat)
{
case 0x7e: printf("The kb is F\n\r"); break;
case 0xbe: printf("The kb is E\n\r"); break;
case 0xde: printf("The kb is D\n\r"); break;
case 0xee: printf("The kb is C\n\r"); break;
case 0x7d: printf("The kb is B\n\r"); break;
case 0xbd: printf("The kb is A\n\r"); break;
case 0xdd: printf("The kb is 0\n\r"); break;
case 0xed: printf("The kb is 9\n\r"); break;
case 0x7b: printf("The kb is 8\n\r"); break;
case 0xbb: printf("The kb is 7\n\r"); break;
case 0xdb: printf("The kb is 6\n\r"); break;
case 0xeb: printf("The kb is 5\n\r"); break;
case 0x77: printf("The kb is 4\n\r"); break;
case 0xb7: printf("The kb is 3\n\r"); break;
case 0xd7: printf("The kb is 2\n\r"); break;
case 0xe7: printf("The kb is 1\n\r"); break;
default: break;
}
flag = 0;
}
}
/****************************************************************************
* 名称 :scankb
* 功能 :键盘初始化
* 入口参数 :无
* 出口参数 :无
****************************************************************************/
void scankb(void)
{
Init_timer0_Interrupts();
Init_Timers();
Init_Platform_KBD();
}
