Add user callback interface to SPI class to enable DMA flow control#299
Open
xdylanm wants to merge 1 commit intoadafruit:masterfrom
Open
Add user callback interface to SPI class to enable DMA flow control#299xdylanm wants to merge 1 commit intoadafruit:masterfrom
xdylanm wants to merge 1 commit intoadafruit:masterfrom
Conversation
… for SPI transfers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I had a similar requirement as @BriscoeTech (see PR #234) for user-specified callbacks to enable full DMA flow control for SPI transfers.
Because of the way the DMA control currently works (depending on mode read, read/write, or write, only one DMA channel has an active callback), I keep duplicate pointers to the user's callback in a list matching spiPtr. This way, the existing dmaCallback can be extended without changing the current DMA descriptor table allocations (long transfers should be unaffected).
Resolves #225.
Related observation: without interrupts configured, begin/end Transfer are not really required, except config is private. Adding a public interface for config would clean that up, but I didn't put it in this PR.
Tested on the Metro Express M0 with a Mikroe EasyADC, software _SS control.