Adafruit_ZeroDMA
Adafruit_ZeroDMA copied to clipboard
Add option for setting block interrupts
To avoid dropouts in audio or video while using ping-pong style buffers it's necessary for the system to be notified when a buffer is done transmitting so a new buffer can be filled, but have the DMAC continue on seamlessly to the next descriptor in the list.
This can be done by setting desc->BTCTRL.bit.BLOCKACT = DMA_BLOCK_ACTION_INT
The current library fixes this bit to desc->BTCTRL.bit.BLOCKACT = DMA_BLOCK_ACTION_NOACT
and the user must change it manually in the descriptor.
It would be nice if we could add a setBlockact(action) method or something
I agree, it would be nice to have something explicit in the API. BTW I've made an example that makes use of this DMA_BLOCK_ACTION_INT mode, writing an audio buffer directly and then playing it seamlessly. It's not ping-pong, just a very short snippet of synthesized sine wave. https://github.com/dfl/Adafruit_ZeroDMA_I2S_DSP_example