rust-embedded / linux-embedded-hal

Implementation of the `embedded-hal` traits for Linux devices
Apache License 2.0
236 stars 40 forks source link

Fix active low behavior of GPIO output pins #61

Closed MorganR closed 3 years ago

MorganR commented 3 years ago

When an output pin is in active-low mode, the try_set_low and try_set_high functions currently incorrect behavior.

In keeping with the input behavior for try_is_high and try_is_low, "high" and "low" should refer to the actual output voltage. This works as expected for pins that are not in active-low mode, but if a pin is in active-low mode, then the opposite happens:

This bug and the fix have been verified using this test program.

rust-highfive commented 3 years ago

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nastevens (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

MorganR commented 3 years ago

Done

bors[bot] commented 3 years ago

Build succeeded: