-
Notifications
You must be signed in to change notification settings - Fork 2.1k
cpu/cc2538: Distinguish between GPIO_OD and GPIO_OD_PU #21488
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
Conversation
@@ -154,7 +154,7 @@ typedef enum { | |||
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 */ |
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.
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.
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.
Sure.
Edit: from a compiler or program standpoint, it shouldn't make a difference anyway, but I'm all for style too :)
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.
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
.
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.
Thanks for reviewing :) |
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
0xf0
was 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.