📄 int_keyboard.c
字号:
//---------------------------------------------------------------------------------
//
// Copyright (C) SEIKO EPSON CORP. 2003
//
// GROUP : SEE LSI
// FILE : int_keyboard.c
// MODULE :
// Function description : This is an interrupt file.
// Revision history :
// Date userName Description
// 2004/01/06 Angela Yuan start
//
// Notes :
//
//---------------------------------------------------------------------------------
//---------------------------------------------------------------------------------
// Include files (#include)
//---------------------------------------------------------------------------------
#include "../include/drv_key.h"
//---------------------------------------------------------------------------------
// Global & static variables
//---------------------------------------------------------------------------------
extern unsigned short scanin_data[];
extern unsigned char key_position;
extern line_scanin();
extern char scanout();
extern disable_keyscanint();
extern void enable_keyscanint();
extern timer_disable();
extern timer_enable();
unsigned short global_variable;
void int_scanout(void)__attribute__ ((interrupt_handler));
void int_clocktimer(void);
//---------------------------------------------------------------------------------
// Function name : int_scanout()
// Function description : input interrupt for key input
//
// Parameters
// Input : none
// Output : none
// I/O : none
//
// Return value : none
//
// Global variable :
//---------------------------------------------------------------------------------
void int_scanout(void)
{
disable_keyscanint();
timer_enable();
}
//---------------------------------------------------------------------------------
// Function name : int_clocktimer()
// Function description : input interrupt for clocktimer
//
// Parameters
// Input : none
// Output : none
// I/O : none
//
// Return value : none
//
// Global variable : equal, addr
//---------------------------------------------------------------------------------
unsigned char addr_pre;
void int_clocktimer(void)
{
unsigned char addr_post;
unsigned char i;
unsigned char tmp;
asm("popn %r1");
ent_int();
asm("pushn %r14");
timer_disable();
if(!bKeyStatus) //push key de_shifting
{
for (i= 0, addr_pre = 0xff; (addr_pre == 0xff) && (i<0x0d); i++)
{
global_variable = (global_variable | 0x1fff) & scanin_data[i];
line_scanin(global_variable);
addr_pre = scanout();
}
if ((addr_pre | 0xfe )== 0xfe)
{
tmp = 1;
addr_pre = 0xfe;
}
else if ((addr_pre | 0xfd ) == 0xfd)
{
tmp = 2;
addr_pre = 0xfd;
}
else if ((addr_pre | 0xfb ) == 0xfb)
{
tmp = 3;
addr_pre = 0xfb;
}
else if ((addr_pre | 0xf7 ) == 0xf7)
{
tmp = 4;
addr_pre = 0xf7;
}
else if ((addr_pre | 0xef ) == 0xef)
{
tmp = 5;
addr_pre = 0xef;
}
else
{
tmp = 0;
addr_pre = 0xff;
}
if (!tmp) //just a push shifting
{
global_variable = (global_variable & 0xe000);
line_scanin(global_variable);
enable_keyscanint();
}
else //key is pushed
{
key_position = i*5 + tmp;
bKeyStatus = 1;
iset_flg(1, 0x010);
timer_enable();
}
}
else //poping key de_shift
{
addr_post = (scanout() |addr_pre);
if (addr_post == 0xff) //key is poped
{
bKeyStatus = 0;
iset_flg(1, 0x010);
global_variable = (global_variable & 0xe000);
line_scanin(global_variable);
enable_keyscanint();
}
else //just a pop shifting
timer_enable();
}
asm("popn %r14");
ret_int();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -