Altera_Forum
Honored Contributor
21 years agoInterrupts in uClinux
Can someone please help me? I want to use the onboard buttons but I don't want to poll them continuously. With the altera_pio_button driver, 1, 2, 4 or 8 is written to /dev/buttons when a button is pressed, but it seems unnecessary to do the following to check each time whether a button was pressed:
FILE *btn = fopen( "/dev/buttons", "r" );
int Number=0;
fscanf(btn, "%d", &Number);
printf("%d\n", Number);
fclose(btn); I also noted an interrupt.h header. Can this be used, or is it only for device drivers? I can also access the buttons the following way: np_pio *pio = na_button_pio;
int buttons;
pio->np_pioedgecapture = 0; // clear the irq condition
buttons = pio->np_piodata; but again without interrupt, since the alt_irq_register() function won't work.