-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
cpu/sam0_common: implement periph_gpio_ll and periph_gpio_ll_irq #20189
Conversation
5552b4d
to
c939c63
Compare
c939c63
to
06c2d95
Compare
When using level triggered IRQs, a new IRQ flag may already have been set while the IRQ callback is executed. Hence, we cannot just toggle the output, but rather should drive it low/high for a level trigger on high/low. Also test `gpio_ll_query_conf()` for the disconnected state as well.
06c2d95
to
67b3815
Compare
Rebased on
|
I tried this on
and I get
|
PA21 seems to be connected to Could you try it again with other GPIOs? |
Ah indeed, works with PA04/05, PA14/15 |
I get a different failure on
|
{ | ||
if (port_num >= ARRAY_SIZE(exti_config)) { | ||
return -1; | ||
} |
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.
Can this be an assert()
?
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 call sites of get_exti_num()
actually do:
assume((unsigned)exti_num < IRQS_NUMOF);
That should cover this as well, but also gives the compiler information about what values are to be expected within exti_config
.
Good catch! That would have been a nasty race condition bug that could have caused lots of pain and tears. For me it now works correctly. |
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.
Please squash
Co-authored-by: benpicco <benpicco@googlemail.com>
Co-authored-by: benpicco <benpicco@googlemail.com>
cdc840e
to
1484d30
Compare
Thx :) |
Improving the test in 891c627 had the side effect that lots of boards now fail the test 😅 (But the issues it detects are indeed very real.) |
Contribution description
This implements
periph_gpio_ll
andperiph_gpio_ll_irq
for SAM0 based MCUs.Testing procedure
Issues/PRs references