Main Site Documentation

InterruptInput time


#1

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() ?

http://netmf.com/Gadgeteer/docs/GadgeteerCore/2.41.500/html/df4c5e24-fa9b-10f1-b857-519f69f54476.htm

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


#2

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.


#3

It can be.


#4

Thanks!