From 871666ae12210af901f5c98335a3f1d01e55c2e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Sim=C3=B5es?= Date: Thu, 22 Oct 2020 14:54:39 +0100 Subject: [PATCH] Improve GpioControllerValueChanged (#9) --- System.Device.Gpio/GpioController.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/System.Device.Gpio/GpioController.cs b/System.Device.Gpio/GpioController.cs index 35888f3..d8a7445 100644 --- a/System.Device.Gpio/GpioController.cs +++ b/System.Device.Gpio/GpioController.cs @@ -269,16 +269,16 @@ private void GpioControllerValueChanged( // sanity check if(gpioPin != null) { - if (((gpioPin.GpioEvents & PinEventTypes.Falling) == PinEventTypes.Falling) - && ((e.ChangeType & PinEventTypes.Falling) == PinEventTypes.Falling)) + if (gpioPin.GpioEvents.HasFlag(PinEventTypes.Falling) + && e.ChangeType.HasFlag(PinEventTypes.Falling)) { gpioPin.GpioPinChange.Invoke( this, new PinValueChangedEventArgs(PinEventTypes.Falling, gpioPin.PinNumber)); } - if (((gpioPin.GpioEvents & PinEventTypes.Rising) == PinEventTypes.Rising) - && ((e.ChangeType & PinEventTypes.Rising) == PinEventTypes.Rising)) + if (gpioPin.GpioEvents.HasFlag(PinEventTypes.Rising) + && e.ChangeType.HasFlag(PinEventTypes.Rising)) { gpioPin.GpioPinChange.Invoke( this,