Beispiel #1
0
        internal ArduinoGpioControllerDriver(FirmataDevice device, IReadOnlyCollection <SupportedPinConfiguration> supportedPinConfigurations)
        {
            _device = device ?? throw new ArgumentNullException(nameof(device));
            _supportedPinConfigurations = supportedPinConfigurations ?? throw new ArgumentNullException(nameof(supportedPinConfigurations));
            _callbackContainers         = new Dictionary <int, CallbackContainer>();
            _waitForEventResetEvent     = new AutoResetEvent(false);
            _callbackContainersLock     = new object();
            _pinModes        = new ConcurrentDictionary <int, PinMode>();
            _outputPinValues = new ConcurrentDictionary <int, PinValue?>();
            _logger          = this.GetCurrentClassLogger();

            PinCount = _supportedPinConfigurations.Count;
            _device.DigitalPortValueUpdated += FirmataOnDigitalPortValueUpdated;
        }
Beispiel #2
0
 /// <summary>
 /// This is internally called when the command handler is registered
 /// </summary>
 internal void Registered(FirmataDevice firmata, ArduinoBoard board)
 {
     _firmata = firmata;
     _board   = board;
     _firmata.OnSysexReply += OnSysexDataInternal;
 }