]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Adafruit BLE: Set SPI2X bit only when F_CPU is 8MHz (#6671)
authorfauxpark <fauxpark@gmail.com>
Sat, 7 Sep 2019 15:18:05 +0000 (01:18 +1000)
committerDrashna Jaelre <drashna@live.com>
Sat, 7 Sep 2019 15:18:05 +0000 (08:18 -0700)
tmk_core/protocol/lufa/adafruit_ble.cpp

index 1d8ae1038ba928e4a99362775149361d868b8191..505794a80c96a848e5922dfde8ee685ef04adf72 100644 (file)
@@ -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