diff options
| author | fauxpark <fauxpark@gmail.com> | 2019-09-08 01:18:05 +1000 |
|---|---|---|
| committer | Drashna Jaelre <drashna@live.com> | 2019-09-07 08:18:05 -0700 |
| commit | 0d94730da05c9ba1375357cebedd54648463b0b8 (patch) | |
| tree | 06af62ba84cede4776855cbac4abaa0007838dc2 /tmk_core | |
| parent | 91bd2117df4cc4d2be6c840103614f2245e54bd1 (diff) | |
| download | qmk_firmware-0d94730da05c9ba1375357cebedd54648463b0b8.tar.gz qmk_firmware-0d94730da05c9ba1375357cebedd54648463b0b8.zip | |
Adafruit BLE: Set SPI2X bit only when F_CPU is 8MHz (#6671)
Diffstat (limited to 'tmk_core')
| -rw-r--r-- | tmk_core/protocol/lufa/adafruit_ble.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tmk_core/protocol/lufa/adafruit_ble.cpp b/tmk_core/protocol/lufa/adafruit_ble.cpp index 1d8ae1038..505794a80 100644 --- a/tmk_core/protocol/lufa/adafruit_ble.cpp +++ b/tmk_core/protocol/lufa/adafruit_ble.cpp | |||
| @@ -151,9 +151,10 @@ static struct SPI_Settings spi; | |||
| 151 | // Initialize 4Mhz MSBFIRST MODE0 | 151 | // Initialize 4Mhz MSBFIRST MODE0 |
| 152 | void SPI_init(struct SPI_Settings *spi) { | 152 | void SPI_init(struct SPI_Settings *spi) { |
| 153 | spi->spcr = _BV(SPE) | _BV(MSTR); | 153 | spi->spcr = _BV(SPE) | _BV(MSTR); |
| 154 | #if F_CPU == 8000000 | ||
| 155 | // For MCUs running at 8MHz (such as Feather 32U4, or 3.3V Pro Micros) we set the SPI doublespeed bit | ||
| 154 | spi->spsr = _BV(SPI2X); | 156 | spi->spsr = _BV(SPI2X); |
| 155 | 157 | #endif | |
| 156 | static_assert(SpiBusSpeed == F_CPU / 2, "hard coded at 4Mhz"); | ||
| 157 | 158 | ||
| 158 | ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { | 159 | ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { |
| 159 | // Ensure that SS is OUTPUT High | 160 | // Ensure that SS is OUTPUT High |
