/// <summary>
        /// Stop pin watcher
        /// </summary>
        public void StopWatcher()
        {
            for (int i = 0; i <= MAX_GPIO_NUMBER; i++)
            {
                watcher.RemoveAll();
            }

            watcher.Stop();
            watcher.PinsStateChanged -= PinsStateUpdate;
            watcher.Dispose();
            Log.Add("Pin Watcher finalized");
        }
Example #2
0
        protected void FinalizePins()
        {
            tagsState.Clear();
            foreach (GpioPin pin in watcher.GetAll())
            {
                if (pin.Tag != null)
                {
                    tagsState.Add(pin.Number, pin.Tag);
                }
            }

            for (int i = 0; i <= MainClass.MAX_GPIO_NUMBER; i++)
            {
                watcher.RemoveAll();
            }

            watcher.Stop();
            watcher.PinsStateChanged -= PinsStateUpdate;
            watcher.Dispose();
        }