Implement PIO based interrupt service handler #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello Michael, I find some people didn't use PIO based interrupt handler for sam4s correctly. The PIO interrupt example shows that
pio_handler()is one of the generic handler, which is called when any of interrupt occurs atPORT_A. People may not realize thatpio_handler()is shared across allPORT_Aperipherals.Furthermore, for those who didn't realize how "Dynamic Vector Table" works, would like to add an additional interrupt source at
PORT_A, will possibly go wrong by replacing current interrupt handler with the new one. As a result, multiple interrupt sources would trigger the same interrupt whereas they aren't suppose to do so.To make it clear, I introduced
pio_irq_init(), which would register PIO based interrupt handler, is called when corresponding PIO interrupt is generated. Internally,pio_irq_common_handlerwill find out which PIO generates interrupt based on the information inPIO_IMRandPIO_ISR, according to datasheet.However I don't have wacky racer board to test with. I have also included an example showing how to use PIO interrupt correctly.