surround faster speed in ifdef so it only gets used for STM32L0 platform

pull/77/head
Liam 2020-11-05 13:53:33 +01:00 committed by Daniele Lacamera
parent 579871f72e
commit 4e823af012
1 changed files with 4 additions and 0 deletions

View File

@ -155,7 +155,11 @@ void spi_init(int polarity, int phase)
spi_tpm2_pin_setup();
APB2_CLOCK_ER |= SPI1_APB2_CLOCK_ER_VAL;
spi1_reset();
#ifdef PLATFORM_stm32l0
SPI1_CR1 = SPI_CR1_MASTER | (polarity << 1) | (phase << 0);
#else
SPI1_CR1 = SPI_CR1_MASTER | (5 << 3) | (polarity << 1) | (phase << 0);
#endif
SPI1_CR2 |= SPI_CR2_SSOE;
SPI1_CR1 |= SPI_CR1_SPI_EN;
}