~ruther/qmk_firmware

0d94730da05c9ba1375357cebedd54648463b0b8 — fauxpark 6 years ago 91bd211
Adafruit BLE: Set SPI2X bit only when F_CPU is 8MHz (#6671)

1 files changed, 3 insertions(+), 2 deletions(-)

M tmk_core/protocol/lufa/adafruit_ble.cpp
M tmk_core/protocol/lufa/adafruit_ble.cpp => tmk_core/protocol/lufa/adafruit_ble.cpp +3 -2
@@ 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