You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#include "bsp_key.h"
|
|
|
|
|
|
|
|
void L2_key_init()
|
|
|
|
{
|
|
|
|
D_stdIO_P3(BITN2);
|
|
|
|
D_stdIO_P3(BITN3);//准双向口
|
|
|
|
D_stdIO_P4(BITN0);
|
|
|
|
//初始化为高电平
|
|
|
|
Key1 = Key2 = Key3 = 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
U8 L2_ReadKey1(void)
|
|
|
|
{
|
|
|
|
Key1 = 1;
|
|
|
|
if (Key1 == 0)
|
|
|
|
{
|
|
|
|
return Key_Down;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return Key_Up;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
U8 L2_ReadKey2(void)
|
|
|
|
{
|
|
|
|
Key2 = 1;
|
|
|
|
if (Key2 == 0)
|
|
|
|
{
|
|
|
|
return Key_Down;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return Key_Up;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
U8 L2_ReadKey3(void)
|
|
|
|
{
|
|
|
|
Key3 = 1;
|
|
|
|
if (Key3 == 0)
|
|
|
|
{
|
|
|
|
return Key_Down;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return Key_Up;
|
|
|
|
}
|
|
|
|
}
|