I’m trying to used the LDR1 button on my Fez Cobra to stop all the threads running on the board. I’ve setup the code below to create an event for the button press:
public void ProgramStarted()
{
// Mainboard buttons
InterruptPort ldr1 = new InterruptPort(Pin.P0_22, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeLow);
ldr1.OnInterrupt += ldr1_Pressed;
}
private void ldr1_Pressed(uint data1, uint data2, DateTime time)
{
// LDR1 = Shutdown
Shutdown();
}
While my app is idle it recognised a button press and fires the event but as soon as the board becomes busy the event never fires.
Can anyone explain what is going on, and is there a way to respond to a button press even when the board is busy?
By the way, when I say ‘busy’ I don’t mean that the cpu is at 100% but the board is doing it’s job watching for input and sending data via the network.