/// <summary> /// Handles GPIO changes (rising and falling PWM signal), recording them to the decoder queue. /// </summary> /// <remarks> /// Main hardware routine which triggers the input translation process. /// This code must run as quickly as possible else we could miss the next event! /// </remarks> 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(); }
/// <summary> /// Handles GPIO changes (rising and falling PWM signal), recording them to the decoder queue. /// </summary> /// <remarks> /// Main hardware routine which triggers the input translation process. /// This code must run as quickly as possible else we could miss the next event! /// </remarks> 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(); }