You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The actual value (0, non-zero) is modeling "active" state for the line which can be inverted in the kernel via the active-low setting. I could see is_active and set_active as an API that modeled what this is in the kernel being something that make sense. This could be in addition to the value or as a full replacement.
Whenever I wrap a C library or API in a language that has a bool type (C++, Rust, etc), I usually prefer to convert the C integer boolean (0, non-zero) to a bool to be a little more explicit about the possible values, and remove ambiguities. But it's no big deal either way.
Possibly relevant. I've been working on a reusable abstraction for logic levels.
The idea is to abstract over whether an I/O line is active high or low and only expose whether or not it is currently asserted.
i can't find it right now but i believe there is discussion about introducing a LogicLevel (or similar) enum along with some more gpio accessors somewhere amongst our issues and PRs.
Activity
posborne commentedon Sep 26, 2018
The actual value (0, non-zero) is modeling "active" state for the line which can be inverted in the kernel via the active-low setting. I could see
is_active
andset_active
as an API that modeled what this is in the kernel being something that make sense. This could be in addition to the value or as a full replacement.fpagliughi commentedon Sep 30, 2018
Whenever I wrap a C library or API in a language that has a bool type (C++, Rust, etc), I usually prefer to convert the C integer boolean (0, non-zero) to a bool to be a little more explicit about the possible values, and remove ambiguities. But it's no big deal either way.
rubberduck203 commentedon Aug 18, 2020
Possibly relevant. I've been working on a reusable abstraction for logic levels.
The idea is to abstract over whether an I/O line is active high or low and only expose whether or not it is currently asserted.
https://github.com/rubberduck203/switch-hal
ryankurte commentedon Aug 22, 2020
i can't find it right now but i believe there is discussion about introducing a
LogicLevel
(or similar) enum along with some more gpio accessors somewhere amongst our issues and PRs.