示例#1
0
 /// <summary> Adds an interrupt to the given GPIO pin. </summary>
 /// <param name="Pin"> The pin to monitor. </param>
 /// <param name="InterruptType"> The type of edge to listen for. </param>
 /// <param name="Delegate"> The delegate to call when the given type of event happens. </param>
 internal static void AddInterrupt(int Pin, int InterruptType, InterruptCallback Delegate)
 {
     if (!Initialized)
     {
         throw new InvalidOperationException("Cannot perform GPIO operations until the system is initialized. Call RasperryPi.Initialize().");
     }
     External.AddInterrupt(Pin, InterruptType, Delegate);
 }
示例#2
0
        ///////////////////////////////////////////////////////////////////////

        public void CheckCallbacks(
            Interpreter interpreter /* NOTE: Parent interpreter. */
            )
        {
            CheckDisposed();

            if (interpreter == null)
            {
                return;
            }

            lock (interpreter.SyncRoot) /* TRANSACTIONAL */
            {
                InterruptCallback oldInterruptCallback =
                    interpreter.InterruptCallback;

                StringList arguments = CallbackArguments;

                if (arguments != null) /* NOTE: Enabled? */
                {
                    if (oldInterruptCallback != null)
                    {
                        return;
                    }

                    if (interruptCallback == null)
                    {
                        interruptCallback = new InterruptCallback(
                            InterruptCallback);
                    }
                }
                else
                {
                    if (interruptCallback != null)
                    {
                        interruptCallback = null;
                    }

                    if (oldInterruptCallback == null)
                    {
                        return;
                    }
                }

                interpreter.InterruptCallback = interruptCallback;
            }
        }
示例#3
0
 public static extern int InterruptServiceRoutine(int pin, int interruptType, InterruptCallback handler);
示例#4
0
 internal static extern int AddInterrupt(int Pin, int InterruptType, InterruptCallback Delegate);
示例#5
0
 private static extern int Ext_AddInterrupt(int Pin, int InterruptType, InterruptCallback Delegate);