Gast
#676148
Hallo,
habe dieses kleine Programm geschrieben um meine Tasten auszuwerten, daß
ganze passiert in meiner Inerrupt Subroutine und funktioniert soweit
ganz gut, aber jetzt würde ich gerne auch lane tastendrücker asuwerten!
Wie kann ich dan nam besten machen?
Timer?, 2. Interrupt?
Das mit dem delay funktioniert irgendwie nicht?
void timer0_c_irq_handler(void) {
volatile AT91PS_TC pTC = AT91C_BASE_TC0; // pointer to timer
channel 0 register structure
volatile AT91PS_PIO pPIO = AT91C_BASE_PIOA; // pointer to PIO
register structure
unsigned int dummy; // temporary
uint8_t presscounter,i;
dummy = pTC->TC_SR; // read TC0 Status Register to
clear interrupt
if ((pPIO->PIO_ODSR & LED1) == LED1) {
pPIO->PIO_CODR = LED1; // turn LED1 (DS2) on
} else {
pPIO->PIO_SODR = LED1; // turn LED1 (DS2) off
}
bouncer++;
if ((AT91F_PIO_GetInput(AT91C_BASE_PIOA) & BUT_left ) != BUT_left )
{
i = bouncer ;
delayisr(500000);
if ((AT91F_PIO_GetInput(AT91C_BASE_PIOA) & BUT_left ) == BUT_left)
{
pressedkey = 1;
} else {
pressedkey = 2;
}
}
if ((AT91F_PIO_GetInput(AT91C_BASE_PIOA) & BUT_right ) != BUT_right )
{
pressedkey = 2;
bouncer++;
}
if ((AT91F_PIO_GetInput(AT91C_BASE_PIOA) & BUT_menu ) != BUT_menu )
{
pressedkey = 3;
bouncer = 0;
if ((AT91F_PIO_GetInput(AT91C_BASE_PIOA) & BUT_menu ) != BUT_menu )
{
pressedkey = 4;
bouncer++;
}
}
}