Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adafruit BLE: Set SPI2X bit only when F_CPU is 8MHz #6671

Merged
merged 1 commit into from
Sep 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions tmk_core/protocol/lufa/adafruit_ble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down