Skip to content

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

Closed
projectgus wants to merge 1 commit into
micropython:masterfrom
projectgus:comment/zephyr_irq
Closed

zephyr: Make it clearer that gpio irqs can be hard or soft.#17095
projectgus wants to merge 1 commit into
micropython:masterfrom
projectgus:comment/zephyr_irq

Conversation

@projectgus
Copy link
Copy Markdown
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 <[email protected]>
@projectgus
Copy link
Copy Markdown
Contributor Author

@danicampora Is that clearer?

#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
Copy Markdown
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
Copy Markdown
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