@@ -310,7 +310,14 @@ bool Adafruit_SPIDevice::write(uint8_t *buffer, size_t len,
310
310
_spi->transferBytes (buffer, nullptr , len);
311
311
}
312
312
} else
313
- #elif defined(ARDUINO_ARCH_SAMD)
313
+ #elif defined(ARDUINO_ARCH_SAMD) && defined(_ADAFRUIT_ZERODMA_H_)
314
+ // The variant of transfer() used below currently only exists in the Adafruit core.
315
+ // It causes a build failure when building against the main Arduino SAMD core.
316
+ // Unfortunately there doesn't seem to be a supported #define that this code
317
+ // can use to tell which core it's building against. This hack
318
+ // (checking for the include guard that gets defined when the Adafruit core's
319
+ // SPI.h includes Adafruit_ZeroDMA.h) works for now, but it should be improved
320
+ // when possible.
314
321
if (_spi) {
315
322
if (prefix_len > 0 ) {
316
323
_spi->transfer (prefix_buffer, nullptr , prefix_len);
@@ -423,7 +430,14 @@ bool Adafruit_SPIDevice::write_then_read(uint8_t *write_buffer,
423
430
_spi->transferBytes (write_buffer, nullptr , write_len);
424
431
}
425
432
} else
426
- #elif defined(ARDUINO_ARCH_SAMD)
433
+ #elif defined(ARDUINO_ARCH_SAMD) && defined(_ADAFRUIT_ZERODMA_H_)
434
+ // The variant of transfer() used below currently only exists in the Adafruit core.
435
+ // It causes a build failure when building against the main Arduino SAMD core.
436
+ // Unfortunately there doesn't seem to be a supported #define that this code
437
+ // can use to tell which core it's building against. This hack
438
+ // (checking for the include guard that gets defined when the Adafruit core's
439
+ // SPI.h includes Adafruit_ZeroDMA.h) works for now, but it should be improved
440
+ // when possible.
427
441
if (_spi) {
428
442
if (write_len > 0 ) {
429
443
_spi->transfer (write_buffer, nullptr , write_len);
0 commit comments