Skip to content

Commit

Permalink
Fixing SPI double-speed bug.
Browse files Browse the repository at this point in the history
Bad bit manipulation was causing the double-speed flag to be set incorrectly.
http://code.google.com/p/arduino/issues/detail?id=365
  • Loading branch information
damellis committed Oct 5, 2010
1 parent 224a7bf commit b248953
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libraries/SPI/SPI.cpp
Expand Up @@ -56,6 +56,6 @@ void SPIClass::setDataMode(uint8_t mode)
void SPIClass::setClockDivider(uint8_t rate)
{
SPCR = (SPCR & ~SPI_CLOCK_MASK) | (rate & SPI_CLOCK_MASK);
SPSR = (SPSR & ~SPI_2XCLOCK_MASK) | (rate & SPI_2XCLOCK_MASK);
SPSR = (SPSR & ~SPI_2XCLOCK_MASK) | ((rate >> 2) & SPI_2XCLOCK_MASK);
}

0 comments on commit b248953

Please sign in to comment.