Only write to *active once, even when GPIO_ACTIVE_LOW is set.

This commit is contained in:
Ian Lepore 2017-01-07 22:55:23 +00:00
parent d663d5ca23
commit ee2c73e559

View File

@ -178,9 +178,10 @@ gpio_pin_is_active(gpio_pin_t pin, bool *active)
return (rv);
}
*active = tmp != 0;
if (pin->flags & GPIO_ACTIVE_LOW)
*active = !(*active);
*active = tmp == 0;
else
*active = tmp != 0;
return (0);
}