Skip to content

Commit b248953

Browse files
committed
Fixing SPI double-speed bug.
Bad bit manipulation was causing the double-speed flag to be set incorrectly. http://code.google.com/p/arduino/issues/detail?id=365
1 parent 224a7bf commit b248953

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libraries/SPI/SPI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,6 @@ void SPIClass::setDataMode(uint8_t mode)
5656
void SPIClass::setClockDivider(uint8_t rate)
5757
{
5858
SPCR = (SPCR & ~SPI_CLOCK_MASK) | (rate & SPI_CLOCK_MASK);
59-
SPSR = (SPSR & ~SPI_2XCLOCK_MASK) | (rate & SPI_2XCLOCK_MASK);
59+
SPSR = (SPSR & ~SPI_2XCLOCK_MASK) | ((rate >> 2) & SPI_2XCLOCK_MASK);
6060
}
6161

0 commit comments

Comments
 (0)