-
Notifications
You must be signed in to change notification settings - Fork 2k
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
cpu/sam0_common/periph_gpio_ll: fix gpio_get_port() and gpio_ll_query_conf() #20999
cpu/sam0_common/periph_gpio_ll: fix gpio_get_port() and gpio_ll_query_conf() #20999
Conversation
It turns out that the legacy GPIO API and GPIO LL may disagree on what the GPIO base address is: GPIO LL will use the IOBUS as base address no matter what, the legacy GPIO API will use the APB as base address unless `periph_gpio_fast_read` is used. If the APIs disagree, we need to do impedance matching.
Wouldn't it be less trouble if GPIO LL behaved the same wrt the use of |
Well, there is no reason to ever write slow. Only for reading there is a power penalty to pay for fast access. That is why GPIO LL is always using the IOBUS for output (if there is an IOBUS mapping), and APB for read only when The end game is also to get rid of |
For the other MCUs, we take the input register state instead of the output register state when the pin is configured as input. Let's do the same here, as this is a lot more useful and intuitive.
Backport provided in #21008 |
Thx :) |
Contribution description
gpio_get_port()
It turns out that the legacy GPIO API and GPIO LL may disagree on what the GPIO base address is: GPIO LL will use the IOBUS as base address no matter what, the legacy GPIO API will use the APB as base address unless
periph_gpio_fast_read
is used.If the APIs disagree, we need to do impedance matching.
gpio_ll_query_conf()
For the other MCUs, we take the input register state instead of the output register state when the pin is configured as input. Let's do the same here, as this is a lot more useful and intuitive.
Testing procedure
gpio_query_conf(gpio_get_port(GPIO_PIN(PA, 1)), gpio_get_pin_num(GPIO_PIN(PA, 1));
should no longer run into a blown assertion.Issues/PRs references
None