cpu/cc2538: Distinguish between GPIO_OD and GPIO_OD_PU#21488
Merged
crasbe merged 1 commit intoRIOT-OS:masterfrom May 14, 2025
Merged
cpu/cc2538: Distinguish between GPIO_OD and GPIO_OD_PU#21488crasbe merged 1 commit intoRIOT-OS:masterfrom
crasbe merged 1 commit intoRIOT-OS:masterfrom
Conversation
gschorcht
reviewed
May 13, 2025
| GPIO_IN_PU = ((uint8_t)OVERRIDE_PULLUP), /**< input, pull-up */ | ||
| GPIO_OUT = ((uint8_t)OVERRIDE_ENABLE), /**< output */ | ||
| GPIO_OD = (0xff), /**< not supported */ | ||
| GPIO_OD_PU = (0xff) /**< not supported */ |
Contributor
There was a problem hiding this comment.
I wonder if it wouldn't be more logical to change the value for GPIO_OD instead of GPIO_OD_PU to 0xfe to have the values in ascending order, as an enumeration normally does.
Contributor
Author
There was a problem hiding this comment.
Sure.
Edit: from a compiler or program standpoint, it shouldn't make a difference anyway, but I'm all for style too :)
gschorcht
approved these changes
May 14, 2025
Contributor
gschorcht
left a comment
There was a problem hiding this comment.
Small change that should work also without having the possibility to test it. It is the exactly same way as handled for other CPUs, e.g. cpu/sam0_common.
Contributor
|
Please squash. |
The CC2538 does not support "Open Drain" or "Open Drain with Pullup" outputs. However problems can arrise from setting both macros to the same value. This commit sets them to separate values which are both invalid to avoid conflicts with other applications.
Contributor
Author
|
Thanks for reviewing :) |
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
The CC2538 does not support "Open Drain" or "Open Drain with Pullup" outputs. However problems can arrise from setting both macros to the same value. This commit sets them to separate values which are both invalid to avoid conflicts with other applications.
The value of
0xf0was chosen arbitrarily, but it is still very far away from the valid values:RIOT/cpu/cc2538/include/cc2538_gpio.h
Lines 304 to 313 in 04a1698
Testing procedure
Unfortunately I don't have the hardware to test this, but the changes should be fairly obvious.
Issues/PRs references
Prerequisite for #10688.