periph/gpio: add gpio_update_int() class of functions #13925
Closed
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
It can be desirable to change the function or behavior associated with a GPIO interrupt.
Currently this can only be achieved by calling
gpio_init_int()
again, which not only does lots of unnecessary and possibly time-consuming work, but also forces to expose the GPIO configuration to callers that only want to change the callback argument.As proposed in #12082 (comment) this introduces three new functions:
gpio_init_int()
must have been called successfully before onpin
, so no error checking is needed which greatly simplifies the implementation.If the API is acceptable, I will update the remaining GPIO drivers.
stm32f1/periph/gpio.c
mips_pic32_common/periph/gpio.c
lpc1768/periph/gpio.c
stm32_common/periph/gpio.c
efm32/periph/gpio.c
native/periph/gpio.c
lm4f120/periph/gpio.c
fe310/periph/gpio.c
esp8266/periph/gpio.c
msp430fxyz/periph/gpio.c
cc26xx_cc13xx/periph/gpio.c
cc2538/periph/gpio.c
esp32/periph/gpio.c
lpc2387/periph/gpio.c
kinetis/periph/gpio.c
atmega_common/periph/gpio.c
sam0_common/periph/gpio.c
nrf5x_common/periph/gpio.c
sam3/periph/gpio.c
ezr32wg/periph/gpio.c
Testing procedure
The following program should alternate between the two messages with each press of a button.
Issues/PRs references
alternative to #12082