From 3ee654bb125d6943feee0223f9c271a32ad99b9d Mon Sep 17 00:00:00 2001 From: "Andrew J. Kroll" Date: Sat, 28 Dec 2013 14:43:21 -0500 Subject: [PATCH] Very small optimization. --- usbhost.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usbhost.h b/usbhost.h index e0ddcf81..adfff592 100644 --- a/usbhost.h +++ b/usbhost.h @@ -153,9 +153,10 @@ uint8_t* MAX3421e< SPI_SS, INTR >::bytesWr(uint8_t reg, uint8_t nbytes, uint8_t* data_p += nbytes; #else SPDR = (reg | 0x02); //set WR bit and send register number - while(nbytes--) { + while(nbytes) { while(!(SPSR & (1 << SPIF))); //check if previous byte was sent SPDR = (*data_p); // send next data byte + nbytes--; data_p++; // advance data pointer } while(!(SPSR & (1 << SPIF)));