drivers/periph/gpio: make gpio_write() take a bool#20935
Merged
benpicco merged 1 commit intoRIOT-OS:masterfrom Oct 22, 2024
Merged
drivers/periph/gpio: make gpio_write() take a bool#20935benpicco merged 1 commit intoRIOT-OS:masterfrom
gpio_write() take a bool#20935benpicco merged 1 commit intoRIOT-OS:masterfrom
Conversation
gpio_write() take a bool
0e2bcf0 to
4627f66
Compare
maribu
approved these changes
Oct 22, 2024
Member
maribu
left a comment
There was a problem hiding this comment.
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.
dprigoshij
pushed a commit
to dprigoshij/RIOT
that referenced
this pull request
Mar 24, 2025
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.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 anintwhen a GPIO can only be either on or off.To avoid confusion, switch to
boolTesting procedure
Since a
boolis usually just anintin disguise, there should be no code or semantic changes.Issues/PRs references