Very small optimization.

This commit is contained in:
Andrew J. Kroll 2013-12-28 14:43:21 -05:00
parent 8a9f16ed38
commit 3ee654bb12

View file

@ -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)));