Skip to content

Commit 871666a

Browse files
authored
Improve GpioControllerValueChanged (#9)
1 parent 74a317a commit 871666a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

System.Device.Gpio/GpioController.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,16 +269,16 @@ private void GpioControllerValueChanged(
269269
// sanity check
270270
if(gpioPin != null)
271271
{
272-
if (((gpioPin.GpioEvents & PinEventTypes.Falling) == PinEventTypes.Falling)
273-
&& ((e.ChangeType & PinEventTypes.Falling) == PinEventTypes.Falling))
272+
if (gpioPin.GpioEvents.HasFlag(PinEventTypes.Falling)
273+
&& e.ChangeType.HasFlag(PinEventTypes.Falling))
274274
{
275275
gpioPin.GpioPinChange.Invoke(
276276
this,
277277
new PinValueChangedEventArgs(PinEventTypes.Falling, gpioPin.PinNumber));
278278
}
279279

280-
if (((gpioPin.GpioEvents & PinEventTypes.Rising) == PinEventTypes.Rising)
281-
&& ((e.ChangeType & PinEventTypes.Rising) == PinEventTypes.Rising))
280+
if (gpioPin.GpioEvents.HasFlag(PinEventTypes.Rising)
281+
&& e.ChangeType.HasFlag(PinEventTypes.Rising))
282282
{
283283
gpioPin.GpioPinChange.Invoke(
284284
this,

0 commit comments

Comments
 (0)