Skip to content

Commit 7bb0d18

Browse files
Merge pull request #386 from homeodor/master
Add bool dmaBusy()
2 parents 6f4981e + 0548084 commit 7bb0d18

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Adafruit_SPITFT.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,6 +1171,19 @@ void Adafruit_SPITFT::dmaWait(void) {
11711171
#endif
11721172
}
11731173

1174+
/*!
1175+
@brief Check if DMA transfer is active. Always returts false if DMA
1176+
is not enabled.
1177+
@return true if DMA is enabled and transmitting data, false otherwise.
1178+
*/
1179+
bool Adafruit_SPITFT::dmaBusy(void) const {
1180+
#if defined(USE_SPI_DMA) && (defined(__SAMD51__) || defined(ARDUINO_SAMD_ZERO))
1181+
return dma_busy;
1182+
#else
1183+
return false;
1184+
#endif
1185+
}
1186+
11741187
/*!
11751188
@brief Issue a series of pixels, all the same color. Not self-
11761189
contained; should follow startWrite() and setAddrWindow() calls.

Adafruit_SPITFT.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ class Adafruit_SPITFT : public Adafruit_GFX {
234234
void dmaWait(void);
235235
// Used by writePixels() in some situations, but might have rare need in
236236
// user code, so it's public...
237+
bool dmaBusy(void) const; // true if DMA is used and busy, false otherwise
237238
void swapBytes(uint16_t *src, uint32_t len, uint16_t *dest = NULL);
238239

239240
// These functions are similar to the 'write' functions above, but with

0 commit comments

Comments
 (0)