-
Notifications
You must be signed in to change notification settings - Fork 90
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
feat(PeriphDrivers)!: Add support for configuring GPIO Drive Strength #673
Conversation
/clang-format-run |
/clang-format-run |
…k into feat/gpio_drvstr
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.
The addition of SetDriveStrength
is good.
I'm a little concerned about adding the drive strength to the GPIO config struct. Existing code will have the struct member uninitialized. I just tested this and got "16", for example:
The switch statement for MXC_GPIO_RevA_SetDriveStrength
is well written, so in this case we initialize with drive strength 0 in the default case handler. But there is a non-zero chance that we hit 0, 1, 2, or 3, which will unexpectedly change the drive strength.
Drive strength is also only relevant in output mode.
I don't want to make you jump out of a window considering the number of files and pin config structs changed here... but I'm in favor of just adding the helper function and leaving the config struct unmodified.
No worries. Adding the new parameter in the Note: support for GPIO drive strength was not added initially due to the varying drive strength name types, but the latest user guides have been updated with consistent drive strength names across all parts which helps for code name stability. The new Good call on the drive strength only being relevant in output mode. I've added a check where this setting is ignored if the pin function is set to input mode. There are alternate functions where this setting is still used though such as the SPI pins for high-speed transactions. |
…#673) Co-authored-by: sihyung-maxim <sihyung-maxim@users.noreply.github.com>
Description
This PR adds a new configuration option to select the drive strength level for GPIO pins.
Support for GPIO drive strength was not added initially due to the varying drive strength name types, but the latest user guides have been updated with consistent drive strength names across all parts which help for code name stability.
Breaking change due to the new parameter with the
mxc_gpio_cfg_t
struct and theMXC_GPIO_Config(...)
function now sets the drive strength. The newdrvstr
parameter was added to the struct because this was how themxc_gpio_cfg_t
was originally intended to be when it was first created.Checklist Before Requesting Review