-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drivers/periph/gpio: make gpio_write()
take a bool
#20935
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
benpicco
requested review from
MrKevinWeiss,
aabadie,
vincent-d,
dylad,
keestux,
kaspar030,
gschorcht,
bergzand,
basilfx,
nandojve,
kYc0o and
maribu
as code owners
October 22, 2024 14:35
github-actions
bot
added
Platform: native
Platform: This PR/issue effects the native platform
Platform: MSP
Platform: This PR/issue effects MSP-based platforms
Platform: ARM
Platform: This PR/issue effects ARM-based platforms
Platform: AVR
Platform: This PR/issue effects AVR-based platforms
Area: drivers
Area: Device drivers
Platform: ESP
Platform: This PR/issue effects ESP-based platforms
Platform: RISC-V
Platform: This PR/issue effects RISC-V-based platforms
Area: cpu
Area: CPU/MCU ports
labels
Oct 22, 2024
benpicco
changed the title
drivers/periph/gpio: make gpio_write() take a bool
drivers/periph/gpio: make Oct 22, 2024
gpio_write()
take a bool
benpicco
added
Type: cleanup
The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation
CI: ready for build
If set, CI server will compile all applications for all available boards for the labeled PR
labels
Oct 22, 2024
benpicco
force-pushed
the
gpio_write-bool
branch
from
October 22, 2024 14:39
0e2bcf0
to
4627f66
Compare
maribu
approved these changes
Oct 22, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Normally I would say this is not fit for a last minute merge before branching of the release branch, but your release manager authority should allow you to do just that :-)
maribu
added a commit
to maribu/RIOT
that referenced
this pull request
Oct 22, 2024
Since RIOT-OS#20935 gpio_write() uses a `bool` instead of an `int`. This does the same treatment for `gpio_read()`. This does indeed add an instruction to `gpio_read()` implementations. However, users caring about an instruction more are better served with `gpio_ll_read()` anyway. And `gpio_read() == 1` is often seen in newcomer's code, which would now work as expected.
maribu
added a commit
to maribu/RIOT
that referenced
this pull request
Oct 23, 2024
Since RIOT-OS#20935 gpio_write() uses a `bool` instead of an `int`. This does the same treatment for `gpio_read()`. This does indeed add an instruction to `gpio_read()` implementations. However, users caring about an instruction more are better served with `gpio_ll_read()` anyway. And `gpio_read() == 1` is often seen in newcomer's code, which would now work as expected.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Area: cpu
Area: CPU/MCU ports
Area: drivers
Area: Device drivers
CI: ready for build
If set, CI server will compile all applications for all available boards for the labeled PR
Platform: ARM
Platform: This PR/issue effects ARM-based platforms
Platform: AVR
Platform: This PR/issue effects AVR-based platforms
Platform: ESP
Platform: This PR/issue effects ESP-based platforms
Platform: MSP
Platform: This PR/issue effects MSP-based platforms
Platform: native
Platform: This PR/issue effects the native platform
Platform: RISC-V
Platform: This PR/issue effects RISC-V-based platforms
Type: cleanup
The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Contribution description
There is no reason for
gpio_write()
to take anint
when a GPIO can only be either on or off.To avoid confusion, switch to
bool
Testing procedure
Since a
bool
is usually just anint
in disguise, there should be no code or semantic changes.Issues/PRs references