From 4ea434796bb1f5bcc9d44bfcd0d9d66b8476faa9 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Tue, 25 May 2021 23:28:48 -0400 Subject: stm32: Support spi1 on PB4/PB5/PB3 on stm32f103 and stm32f2 Signed-off-by: Kevin O'Connor --- src/stm32/stm32f1.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/stm32/stm32f1.c') diff --git a/src/stm32/stm32f1.c b/src/stm32/stm32f1.c index 57007615..c0ae35fa 100644 --- a/src/stm32/stm32f1.c +++ b/src/stm32/stm32f1.c @@ -154,6 +154,12 @@ gpio_peripheral(uint32_t gpio, uint32_t mode, int pullup) if (gpio == GPIO('B', 8) || gpio == GPIO('B', 9)) stm32f1_alternative_remap(AFIO_MAPR_I2C1_REMAP_Msk, AFIO_MAPR_I2C1_REMAP); + } else if (func == 5) { + // SPI + if (gpio == GPIO('B', 3) || gpio == GPIO('B', 4) + || gpio == GPIO('B', 5)) + stm32f1_alternative_remap(AFIO_MAPR_SPI1_REMAP_Msk, + AFIO_MAPR_SPI1_REMAP); } else if (func == 7) { // USART if (gpio == GPIO('B', 6) || gpio == GPIO('B', 7)) -- cgit v1.2.3-70-g09d2