SPI.dmaSendAsync() has been added to SPI

Information on the latest releases
victor_pv
Posts: 1743
Joined: Mon Apr 27, 2015 12:12 pm

Re: SPI.dmaSendAsync() has been added to SPI

Post by victor_pv » Wed Aug 02, 2017 6:35 pm

Steve, currently you can use the dmaSend with a callback function, so it returns inmediately (similar to the async one, but with callback).
You set the callback function with:

Code: Select all

onTransmit(&func);
It will call func() when the transfer is completed.
To cancel the callback, you pass NULL as the argument:

Code: Select all

onTransmit(NULL);
I will try to write some documentation for those functions to add to the wiki and add some example code.
I have one sketch that uses it with sdFat and FreeRTOS, it switches to another task until the dmaSend callback is called, at which point switches back to the task that was waiting for the transfer to finish, and works really well for that, but it's kind or large for an example. I have to think on something smaller to show it off.

Post Reply