예제 #1
0
        public SpiInterface(SpiDevice device, IGpioController controller, int dcPin, int rstPin)
        {
            _device     = device ?? throw new ArgumentNullException(nameof(device));
            _controller = controller ?? throw new ArgumentNullException(nameof(controller));
            _dcPin      = dcPin;
            _rstPin     = rstPin;

            _disposables.Add(_controller.OpenPinAsDisposable(_dcPin, PinMode.Output));
            _disposables.Add(_controller.OpenPinAsDisposable(_rstPin, PinMode.Output));

            // Reset device
            _controller.Write(_rstPin, PinValue.Low);
            _controller.Write(_rstPin, PinValue.High);
        }