mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-16 11:21:18 +03:00
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
This commit is contained in:
@ -56,6 +56,6 @@ void SPIClass::setDataMode(uint8_t mode)
|
|||||||
void SPIClass::setClockDivider(uint8_t rate)
|
void SPIClass::setClockDivider(uint8_t rate)
|
||||||
{
|
{
|
||||||
SPCR = (SPCR & ~SPI_CLOCK_MASK) | (rate & SPI_CLOCK_MASK);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user