#172750 - sylvestersteele - Mon Mar 01, 2010 4:23 am
Hi,
Detecting key presses by polling in the while loop is pretty straightforward, but I want to detect them using interrupts. I did the following:
And I found that the keyPressed function is never executed. I was going through the previous posts and came across a post saying that key presses are supposed to be detecting while processing the VBlank interrupt.
Q1: Is this this best way to do it?
Q2: When is the IRQ_KEYS interrupt generated?
Q3: If the answer to Q1 is no- then what is the best way to do it?
Thanks,
Sylvester
Detecting key presses by polling in the while loop is pretty straightforward, but I want to detect them using interrupts. I did the following:
Code: |
irqInit ();
irqSet(IRQ_VBLANK, Vblank); irqEnable (IRQ_KEYS); irqSet(IRQ_KEYS, keyPressed); consoleDemoInit(); |
And I found that the keyPressed function is never executed. I was going through the previous posts and came across a post saying that key presses are supposed to be detecting while processing the VBlank interrupt.
Q1: Is this this best way to do it?
Q2: When is the IRQ_KEYS interrupt generated?
Q3: If the answer to Q1 is no- then what is the best way to do it?
Thanks,
Sylvester