示例#1
0
        /// <summary>
        /// Disposes this instance and closes all open pins associated with this controller.
        /// </summary>
        /// <param name="disposing">True to dispose all instances, false to dispose only unmanaged resources</param>
        protected virtual void Dispose(bool disposing)
        {
            foreach (int pin in _openPins)
            {
                // The list contains the pin in the current NumberingScheme
                ClosePinCore(pin);
            }

            _openPins.Clear();
            _driver?.Dispose();
            _driver = null !;
        }
示例#2
0
 /// <summary>
 /// Initializes new instance of GpioController that will use the specified numbering scheme and driver.
 /// </summary>
 /// <param name="numberingScheme">The numbering scheme used to represent pins provided by the controller.</param>
 /// <param name="driver">The driver that manages all of the pin operations for the controller.</param>
 public GpioController(PinNumberingScheme numberingScheme, GpioDriver driver)
 {
     _driver         = driver;
     NumberingScheme = numberingScheme;
     _openPins       = new HashSet <int>();
 }
示例#3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GpioController"/> class that will use the specified numbering scheme and driver.
 /// </summary>
 /// <param name="numberingScheme">The numbering scheme used to represent pins provided by the controller.</param>
 /// <param name="driver">The driver that manages all of the pin operations for the controller.</param>
 public GpioController(PinNumberingScheme numberingScheme, GpioDriver driver)
 {
     _driver         = driver;
     NumberingScheme = numberingScheme;
     _openPins       = new ConcurrentDictionary <int, PinValue?>();
 }