Skip to content

Commit 6820324

Browse files
committed
Fix: Using a delay(1) statement causes a minimum delay of 1 microsecond between two consecutive 8-bit data bursts.
This is turning the high-data-rate SPI bus into a very slow-data-rate bus.
1 parent 8d7a96b commit 6820324

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

libraries/SPI/SPI.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ uint8_t ArduinoSPI::transfer(uint8_t data) {
180180
while ((SPI_EVENT_TRANSFER_COMPLETE != _spi_cb_event[_cb_event_idx]) && timeout_ms)
181181
{
182182
timeout_ms--;
183-
delay(1);
183+
__NOP();
184184
}
185185
if (SPI_EVENT_TRANSFER_ABORTED == _spi_cb_event[_cb_event_idx])
186186
{
@@ -201,7 +201,7 @@ uint16_t ArduinoSPI::transfer16(uint16_t data) {
201201
while ((SPI_EVENT_TRANSFER_COMPLETE != _spi_cb_event[_cb_event_idx]) && timeout_ms)
202202
{
203203
timeout_ms--;
204-
delay(1);
204+
__NOP();
205205
}
206206
if (SPI_EVENT_TRANSFER_ABORTED == _spi_cb_event[_cb_event_idx])
207207
{
@@ -221,7 +221,7 @@ void ArduinoSPI::transfer(void *buf, size_t count) {
221221
while ((SPI_EVENT_TRANSFER_COMPLETE != _spi_cb_event[_cb_event_idx]) && timeout_ms)
222222
{
223223
timeout_ms--;
224-
delay(1);
224+
__NOP();
225225
}
226226
if (SPI_EVENT_TRANSFER_ABORTED == _spi_cb_event[_cb_event_idx])
227227
{

0 commit comments

Comments
 (0)