With this code using an InterruptPort in place, to react to the LDR0 button press, the interrupt handler function never gets called, and worse, pressing the LDR0 button stops communication on the Ethernet ENC20 module. But when I use an InputPort instead of an InterruptPort and read the port, I do see the false value, and there is no impact on the Ethernet communications.
public partial class Program
{
/// <summary>
///This method is run when the mainboard is powered up or reset.
/// </summary>
void ProgramStarted()
{
InterruptPort IntButtonLDR0 = new InterruptPort(GHI.Hardware.G120.Pin.P2_10, true,
Port.ResistorMode.PullUp,
Port.InterruptMode.InterruptEdgeBoth);
IntButtonLDR0.OnInterrupt += new NativeEventHandler(IntButton_OnInterruptLDR0);
}
static void IntButton_OnInterruptLDR0(uint port, uint state, DateTime time)
{
Debug.Print("Button LDR0 Pressed");
}
}