Skip to content

Add user callback interface to SPI class to enable DMA flow control #299

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xdylanm
Copy link

@xdylanm xdylanm commented May 19, 2021

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.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SPI DMA complete callback
1 participant