8000 zephyr: Make it clearer that gpio irqs can be hard or soft. by projectgus · Pull Request #17095 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content

zephyr: Make it clearer that gpio irqs can be hard or soft. #17095

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

Closed
wants to merge 1 commit into from

Conversation

projectgus
Copy link
Contributor

Summary

Quick follow-up to #16916 - the comment in the IRQ handler makes it sound like all Zephyr IRQs are hard, but actually hard and soft irqs are supported.

Testing

None, this change only updates a code comment.

This is just a comment change.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
@projectgus
Copy link
Contributor Author

@danicampora Is that clearer?

@@ -64,8 +64,11 @@ static void gpio_callback_handler(const struct device *port, struct gpio_callbac
machine_pin_irq_obj_t *irq = CONTAINER_OF(cb, machine_pin_irq_obj_t, callback);

#if MICROPY_STACK_CHECK
// This callback executes in an ISR context so the stack-limit check must be changed to
// use the ISR stack for the duration of this function (so that hard IRQ callbacks work).
// For irqs with hard=True, the callback executes in an ISR context so the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically gpio_callback_handler executes in an ISR context which is what I think I intended this comment to mean (and in the parenthesis the comment here mentions that it's so hard IRQ callbacks work).

I think it's worth keeping the statement that this C function executes in an ISR context and we want hard Python callbacks to behave correctly.

See #6146 for reference.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right I missed that "this callback" refers to the enclosing function and is not referring to the Python callback.

It's probably fine to leave it how it is.

@projectgus projectgus closed this Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0