Skip to content

[TOPIC-GPIO]: Support for legacy interrupt configuration breaks new API contract #19552

@pabigot

Description

@pabigot

In the original API development in #16648 and as merged to the topic branch gpio_pin_configure() was changed to not affect any interrupt configuration except GPIO_INT_DEBOUNCE.

In #19248 this decision was reverted, and gpio_pin_configure() was changed to include a call to gpio_pin_interrupt_configure(). #19248 (comment) questioned this and was answered with the point that this is necessary to support legacy API that configures both pin and interrupt in the same call. It was described as to-be-removed-later, but there are no details/plans for how to accomplish that.

This breaks the promised new API: it is no longer possible to do things like reconfigure pull state without affecting the interrupt configuration, because presence of GPIO_INT_DISABLED cannot be distinguished from a set of flags that does not touch the interrupt configuration, so pin configuration while interrupts are enabled will disable (or reconfigure) the interrupt.

A potential solution is to change GPIO_INT_DISABLED to be a non-zero value, and so support a new GPIO_INT_MODE_UNCHANGED mode that has no effect. This would not work on legacy code that intentionally disables interrupts by not providing any interrupt configuration flags in the call to gpio_pin_configure().

Metadata

Metadata

Assignees

Labels

area: APIChanges to public APIsarea: GPIObugThe issue is a bug, or the PR is fixing a bugpriority: mediumMedium impact/importance bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions