mirror of
git://soft.sys114.com/klipper
synced 2026-02-13 10:10:33 +09:00
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>
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user