stm32/gpio: Remove duplicate prototypes#3671
Open
kasjer wants to merge 2 commits into
Open
Conversation
c755309 to
21ad874
Compare
sjanc
approved these changes
Jun 8, 2026
Function hal_gpio_init_af() has only one implementation but every MCU had it's own prototype of same function. Now prototype is move to common place and redundant versions are removed
There is hal_gpio_init_af() function that configures pin function. Now additional function hal_gpio_init_fun() is added that has only one argument instead of 4. Pin number, AF number pull-up/down and open drain specification is combined in one uint32_t value. This will make it easy to have pin function configuration in syscfg as single value created with new macro: MCU_AFIO_GPIO_PP() Before that if pin for some was configurable in syscfg additionally AF number could be needed for some function that has different AF numbers for same function on different pins. i.e. STM32_QSPI_FLASH_CS_PIN: MCU_AFIO_GPIO_PP(MCU_GPIO_PORTC(2), 10, 0, 0) could be used and later pin can be configured like this hal_gpio_init_fun(MYNEWT_VAL_STM32_QSPI_FLASH_CS_PIN) No need to extract additional information from syscfg Signed-off-by: Jerzy Kasenberg <jerzy@apache.org>
21ad874 to
765835b
Compare
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.
One function:
has many instances of prototype now only one stays
Convenience function
int hal_gpio_init_fun(uint32_t pin)added.Function will allow easy configuration pin with function with single value from syscfg.
i.e.
could be used and later pin can be configured like this
Before function AF number has to be configured in separate syscfg value of hardcoded (which was OK for some functions but may not be OK for many others)