Ejemplo n.º 1
0
 /// <summary>
 /// Start pin watcher on all pins
 /// </summary>
 public void StartWatcher()
 {
     watcher = new PinWatcher(PIN_START_INTERVAL, PINS);
     watcher.PinsStateChanged += PinsStateUpdate;
     watcher.Start();
     Log.Add("Pin Watcher initiated");
 }
Ejemplo n.º 2
0
        protected void InitializePins(Gpio gpio, bool restoreTags)
        {
            GpioPin[] pins = new GpioPin[MainClass.MAX_GPIO_NUMBER + 1];
            for (int i = 0; i <= MainClass.MAX_GPIO_NUMBER; i++)
            {
                pins[i] = gpio.GetPin(i);
                if (restoreTags && tagsState.ContainsKey(pins[i].Number))
                {
                    pins[i].Tag = tagsState[pins[i].Number];
                }
                WritePinState(pins[i]);
            }

            tagsState.Clear();

            watcher = new PinWatcher(PIN_START_INTERVAL, pins);
            watcher.PinsStateChanged += PinsStateUpdate;
            watcher.Start();
        }