Skip to content

Commit 3c7a2d5

Browse files
committed
Added a isBusy() method to SPI calls to allow non-blocking polling of the DMA transfer status.
1 parent dcc531f commit 3c7a2d5

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

Diff for: libraries/SPI/SPI.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,12 @@ void SPIClass::waitForTransfer(void) {
458458
while(dma_busy);
459459
}
460460

461+
/* returns the current DMA transfer status to allow non-blocking polling */
462+
bool SPIClass::isBusy(void) {
463+
return dma_busy;
464+
}
465+
466+
461467
// End DMA-based SPI transfer() code ---------------------------------------
462468

463469
void SPIClass::attachInterrupt() {

Diff for: libraries/SPI/SPI.h

+1
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ class SPIClass {
120120
void transfer(const void* txbuf, void* rxbuf, size_t count,
121121
bool block = true);
122122
void waitForTransfer(void);
123+
bool isBusy(void);
123124

124125
// Transaction Functions
125126
void usingInterrupt(int interruptNumber);

0 commit comments

Comments
 (0)