I would like to be able to do something like
uint32_t myBuffer[352];
//Define the pin we will use for output
int myPin = 22;
int Location = 10;
myDMA = new DMAChannel();
myDMA.disable();
myDMA.attachInterrupt(UpdateLocation);
myDMA.interruptAtCompletion();
//output 23 bytes of the buffer starting at Location
myDMA.sourceBuffer((uint8_t *)myBuffer[Location],23);
//output data serially on myPin
myDMA.destination(myPin );
// set 8 cycle wait between output bits
myDMA.TCD->BWC = 11b;
myDMA.transferSize(1);
myDMA.disableOnCompletion();
myDMA.triggerContinuously();
myDMA.enable();
void UpdateLocation(void){
//logic that updates the location to a different spot in the buffer
Location += 18;
myDMA.disable();
myDMA.sourceBuffer((uint8_t *)myBuffer[Location], 23);
myDMA.enable();
}
void loop() {
//do some stuff
if (condition) { myDMA.start(); }
//do other stuff
}