Main Site Documentation

G120 Correct Interruport Implementation


#1

Can someone tell me what would be the correct params to set in InterruptPort when using a G120 RevC ?

I use this :


InterruptPort _bp = new InterruptPort(GHI.Hardware.G120.Pin.P2_3, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth);

but does not throw any interrupt when setting to GND or even 3.3…


#2

@ LouisCpro - implement and attach an interrupt handler to the port. Like :


_bp.OnInterrupt += bpHandler;



private void bpHandler(uint data1, uint data2, DateTime time)
 {
            
// your code goes here.

    _bp.ClearInterrupt(); 
}         


#3

@ RobvanSchelven -

My question was more on the resistor mode ans so on… Of course the event handling is mandatory to Work with interrupts.

Finally m’y problem was on the hardware side of the Moon, ont the soft !