Skip to content
master
Switch branches/tags
Code

Latest commit

61: Fix active low behavior of GPIO output pins r=eldruin a=MorganR

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:

 * calling `try_set_low` sets the voltage high
 * calling `try_set_high` sets the voltage low

This bug and the fix have been verified using [this test program](https://github.com/MorganR/active-low-test).

Co-authored-by: Morgan Roff <mroff@google.com>
0c1a0bb

Git stats

Files

Permalink
Failed to load latest commit information.

linux-embedded-hal

Implementation of the embedded-hal traits for Linux devices

This project is developed and maintained by the Embedded Linux team.

Documentation

Note that current v0.4.0-alpha.X releases track the unstable ['embedded-hal'] v1.0.0-alpha.Y. For bugfixes or backports please open PRs against the v0.3.x branch.

GPIO character device

Since Linux kernel v4.4 the use of sysfs GPIO was deprecated and replaced by the character device GPIO. See gpio-cdev documentation for details.

This crate includes feature flag gpio_cdev that exposes CdevPin as wrapper around LineHandle from gpio-cdev. To enable it update your Cargo.toml. Please note that in order to prevent LineHandle fd from closing you should assign to a variable, see cdev issue for more details.

linux-embedded-hal = { version = "0.3", features = ["gpio_cdev"] }

SysfsPin can be still used with feature flag gpio_sysfs.

Minimum Supported Rust Version (MSRV)

This crate is guaranteed to compile on stable Rust 1.36.0 and up. It might compile with older versions but that may change in any new patch release.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Code of Conduct

Contribution to this crate is organized under the terms of the Rust Code of Conduct, the maintainer of this crate, the HAL team, promises to intervene to uphold that code of conduct.