Emlid.WindowsIot.Hardware.Boards.Navio.NavioRCInputDevice.OnInputPinValueChanged C# (CSharp) Method

OnInputPinValueChanged() private method

Handles GPIO changes (rising and falling PWM signal), recording them to the decoder queue.
Main hardware routine which triggers the input translation process. This code must run as quickly as possible else we could miss the next event!
private OnInputPinValueChanged ( Windows.Devices.Gpio.GpioPin sender, Windows.Devices.Gpio.GpioPinValueChangedEventArgs arguments ) : void
sender Windows.Devices.Gpio.GpioPin
arguments Windows.Devices.Gpio.GpioPinValueChangedEventArgs
return void
        private void OnInputPinValueChanged(GpioPin sender, GpioPinValueChangedEventArgs arguments)
        {
            // Get PWM value
            var time = StopwatchExtensions.GetTimestampInMicroseconds();
            var level = arguments.Edge == GpioPinEdge.RisingEdge;
            var value = new PwmValue(time, level);

            // Queue for processing
            _valueBuffer.Enqueue(value);
            _valueTrigger.Set();
        }