Skip to content

Added a isBusy() method to SPI calls to allow non-blocking polling of… #279

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions libraries/SPI/SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,12 @@ void SPIClass::waitForTransfer(void) {
while(dma_busy);
}

/* returns the current DMA transfer status to allow non-blocking polling */
bool SPIClass::isBusy(void) {
return dma_busy;
}


// End DMA-based SPI transfer() code ---------------------------------------

void SPIClass::attachInterrupt() {
Expand Down
1 change: 1 addition & 0 deletions libraries/SPI/SPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class SPIClass {
void transfer(const void* txbuf, void* rxbuf, size_t count,
bool block = true);
void waitForTransfer(void);
bool isBusy(void);

// Transaction Functions
void usingInterrupt(int interruptNumber);
Expand Down