Main Site Documentation

InterruptInput time


I’m trying to get the exact time that an digital input was activated. I’m using an interrupt to receive a notification:

 _interrupt = extender.SetupInterruptInput(GT.Socket.Pin.Three, GT.Interfaces.GlitchFilterMode.On, GT.Interfaces.ResistorMode.PullDown, GT.Interfaces.InterruptMode.RisingEdge);
      _interrupt.Interrupt += _interrupt_Interrupt;

 void _interrupt_Interrupt(InterruptInput sender, bool value)

InterruptInput does not seem to contain a time for the interrupt. Is the some other way to get the time other than setting a variable to DateTime.Now() ?

The question is related to a previous post on digital inputs, but I thought this was a separate issue.


Looks like an oversight in implementation of the InterruptInput. You can fallback to plain vanilla NETMF way of doing that:

        InterruptPort ip = new InterruptPort(GT.Socket.GetSocket(extender.ExtenderSocketNumber).CpuPins[3], true, Port.ResistorMode.PullDown, Port.InterruptMode.InterruptEdgeHigh);
            ip.OnInterrupt += ip_OnInterrupt;

        void ip_OnInterrupt(uint data1, uint data2, DateTime time)

Third parameter will have timing information.


It can be.