aboutsummaryrefslogtreecommitdiffstats
path: root/src/stm32/stm32f1.c
diff options
context:
space:
mode:
authorMichael Kurz <michi.kurz@googlemail.com>2021-03-03 05:02:20 +0100
committerGitHub <noreply@github.com>2021-03-02 23:02:20 -0500
commitab979a52cfdbc8184c9ad1747210d2a49bf719a2 (patch)
tree8c5c767db399a24168df5b4e2975f629f9fd8242 /src/stm32/stm32f1.c
parent5f80c84309f30a6363d1b9cd9999749b57de0ef0 (diff)
downloadkutter-ab979a52cfdbc8184c9ad1747210d2a49bf719a2.tar.gz
kutter-ab979a52cfdbc8184c9ad1747210d2a49bf719a2.tar.xz
kutter-ab979a52cfdbc8184c9ad1747210d2a49bf719a2.zip
stm32: Add support for STM32F1 I2C1 alternate pin mapping (#4012)
This adds support for the alternate pin mapping of I2C1 on PB8/9 in STM32F1 devices Signed-off-by: Michael Kurz <michi.kurz@gmail.com>
Diffstat (limited to 'src/stm32/stm32f1.c')
-rw-r--r--src/stm32/stm32f1.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/stm32/stm32f1.c b/src/stm32/stm32f1.c
index 886b7b91..6480b678 100644
--- a/src/stm32/stm32f1.c
+++ b/src/stm32/stm32f1.c
@@ -124,10 +124,16 @@ gpio_peripheral(uint32_t gpio, uint32_t mode, int pullup)
// way from other STM32s.
// Code below is emulating a few mappings to work like an STM32F4
uint32_t func = (mode >> 4) & 0xf;
- if(( gpio == GPIO('B', 8) || gpio == GPIO('B', 9)) &&
- func == 9) { // CAN
- stm32f1_alternative_remap(AFIO_MAPR_CAN_REMAP_Msk,
- AFIO_MAPR_CAN_REMAP_REMAP2);
+ if (gpio == GPIO('B', 8) || gpio == GPIO('B', 9)) {
+ if (func == 9) {
+ // CAN
+ stm32f1_alternative_remap(AFIO_MAPR_CAN_REMAP_Msk,
+ AFIO_MAPR_CAN_REMAP_REMAP2);
+ } else if (func == 4) {
+ // I2C1 Alt
+ stm32f1_alternative_remap(AFIO_MAPR_I2C1_REMAP_Msk,
+ AFIO_MAPR_I2C1_REMAP);
+ }
}
// Add more as needed
}