@@ -236,7 +236,7 @@ void SPIClass::transfer(void *buf, size_t count)
236
236
}
237
237
238
238
// Pointer to SPIClass object, one per DMA channel.
239
- static SPIClass *spiPtr[DMAC_CH_NUM] = { 0 }; // Inits list to NULL
239
+ static SPIClass *spiPtr[DMAC_CH_NUM] = { 0 }; // Legit inits list to NULL
240
240
241
241
void SPIClass::dmaCallback (Adafruit_ZeroDMA *dma) {
242
242
// dmaCallback() receives an Adafruit_ZeroDMA object. From this we can get
@@ -247,7 +247,7 @@ void SPIClass::dmaCallback(Adafruit_ZeroDMA *dma) {
247
247
}
248
248
249
249
void SPIClass::transfer (const void * txbuf, void * rxbuf, size_t count,
250
- bool background ) {
250
+ bool block ) {
251
251
252
252
// If receiving data and the RX DMA channel is not yet allocated...
253
253
if (rxbuf && (readChannel.getChannel () >= DMAC_CH_NUM)) {
@@ -312,20 +312,20 @@ void SPIClass::transfer(const void* txbuf, void* rxbuf, size_t count,
312
312
// We could set up a descriptor chain, but that gets more
313
313
// complex. For now, instead, break up long transfers into
314
314
// chunks of 65,535 bytes max...these transfers are all
315
- // blocking, regardless of the "background " argument, except
315
+ // blocking, regardless of the "block " argument, except
316
316
// for the last one which will observe the background request.
317
317
// The fractional part is done first, so for any "partially
318
- // backgrounded " transfers like these at least it's the
319
- // largest single-descriptor transfer possible that occurs
320
- // in the background, rather than the tail end.
318
+ // blocking " transfers like these at least it's the largest
319
+ // single-descriptor transfer possible that occurs in the
320
+ // background, rather than the tail end.
321
321
int bytesThisPass;
322
- bool block ;
322
+ bool blockThisPass ;
323
323
if (count > 65535 ) { // Too big for 1 descriptor
324
- block = true ;
324
+ blockThisPass = true ;
325
325
bytesThisPass = count % 65535 ; // Fractional part
326
326
if (!bytesThisPass) bytesThisPass = 65535 ;
327
327
} else {
328
- block = !background ;
328
+ blockThisPass = block ;
329
329
bytesThisPass = count;
330
330
}
331
331
@@ -353,7 +353,7 @@ void SPIClass::transfer(const void* txbuf, void* rxbuf, size_t count,
353
353
dma_busy = true ;
354
354
writeChannel.startJob ();
355
355
count -= bytesThisPass;
356
- if (block ) {
356
+ if (blockThisPass ) {
357
357
while (dma_busy);
358
358
}
359
359
}
0 commit comments