ClearInterrupt() public method

public ClearInterrupt ( ) : void
return void
Ejemplo n.º 1
0
 /// <summary>
 ///     Clear the interrupt flag.
 ///     Se Command Register on page 13 of the datasheet.
 /// </summary>
 /// <remarks>
 ///     According to the datasheet, writing a 1 into bit 6 of the command
 ///     register will clear any pending interrupts.
 /// </remarks>
 public void ClearInterrupt()
 {
     _tsl2561.WriteByte(ClearInterruptBit);
     if (_interruptPin != null)
     {
         _interruptPin.ClearInterrupt();
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// PushButton constructor.
        /// </summary>
        /// <param name="pin">GPIO input pin</param>
        /// <param name="callback">Callback delegate</param>
        /// <param name="resmode">Resistor mode</param>
        public PushButton(Cpu.Pin pin, NativeEventHandler callback, Port.ResistorMode resmode)
        {
            Port.InterruptMode imode = resmode == Port.ResistorMode.PullUp ?
                Port.InterruptMode.InterruptEdgeLow : Port.InterruptMode.InterruptEdgeHigh;
            m_interruptPort = new InterruptPort(pin, true, resmode, imode);

            if (callback != null) {
                m_interruptPort.OnInterrupt += callback;
            }
            // default behavior is to always clear interrupt
            m_interruptPort.OnInterrupt += new NativeEventHandler((uint port, uint state, DateTime time) => {
                m_interruptPort.ClearInterrupt();
            });
        }