summaryrefslogtreecommitdiff
path: root/tmk_core
diff options
context:
space:
mode:
authorfauxpark <fauxpark@gmail.com>2019-09-08 01:18:05 +1000
committerFlorian Didron <fdidron@users.noreply.github.com>2019-10-01 10:21:12 +0900
commitabc9586c2a6f6411eb086988d004b68e21199e98 (patch)
tree53541da4f922f2b2c6cd7b3cf7738ce61b6e07e4 /tmk_core
parentcd7aba09ee55ea72b4960c2583ca94f8d34c88a7 (diff)
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.cpp5
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 1d8ae1038b..505794a80c 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;
// Initialize 4Mhz MSBFIRST MODE0
void SPI_init(struct SPI_Settings *spi) {
spi->spcr = _BV(SPE) | _BV(MSTR);
+#if F_CPU == 8000000
+ // For MCUs running at 8MHz (such as Feather 32U4, or 3.3V Pro Micros) we set the SPI doublespeed bit
spi->spsr = _BV(SPI2X);
-
- static_assert(SpiBusSpeed == F_CPU / 2, "hard coded at 4Mhz");
+#endif
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
// Ensure that SS is OUTPUT High