__irq static void timer4_isr( void )
{
int i;
int keys=gp_ButtonResult();
for(i=0; i<10;i++)
uKeys[i]=((0x1<<i)&keys)? 1: 0;
//clear bit?
}
void InstallKbdHandler( void )
{
ClearKeys();
rCLKCON |= 0x40; //enable pwmtimer
rTCFG0 = 0xFF00; //8bit prescale = 255 --> 16.1133 KHz for PCLK=66MHz
rTCFG1 = 0x30000; //4bit divider = 1/16
rTCNTB4 = 322; //~20ms
rTCON = 0x6 << 20; //auto reload + maunal update
ARMDisableInterrupt();
swi_install_irq(BIT_TIMER4,timer4_isr);
ARMEnableInterrupt();
rTCON = 0x5 << 20; //start + auto-reload
}