diff options
Diffstat (limited to 'src/stm32/stm32f1.c')
-rw-r--r-- | src/stm32/stm32f1.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/stm32/stm32f1.c b/src/stm32/stm32f1.c index 6480b678..ae8fcd67 100644 --- a/src/stm32/stm32f1.c +++ b/src/stm32/stm32f1.c @@ -134,6 +134,35 @@ gpio_peripheral(uint32_t gpio, uint32_t mode, int pullup) stm32f1_alternative_remap(AFIO_MAPR_I2C1_REMAP_Msk, AFIO_MAPR_I2C1_REMAP); } + } else if ((gpio == GPIO('A', 15) + || gpio == GPIO('B', 3)) && (func == 1)) { + // TIM2 CH1/2 + stm32f1_alternative_remap(AFIO_MAPR_TIM2_REMAP_PARTIALREMAP1_Msk, + AFIO_MAPR_TIM2_REMAP_PARTIALREMAP1); + } else if ((gpio == GPIO('B', 10) + || gpio == GPIO('B', 11)) && (func == 1)) { + // TIM2 CH3/4 + stm32f1_alternative_remap(AFIO_MAPR_TIM2_REMAP_PARTIALREMAP2_Msk, + AFIO_MAPR_TIM2_REMAP_PARTIALREMAP2); + } else if ((gpio == GPIO('B', 4) + || gpio == GPIO('B', 5)) && (func == 2)) { + // TIM3 partial remap + stm32f1_alternative_remap(AFIO_MAPR_TIM3_REMAP_PARTIALREMAP_Msk, + AFIO_MAPR_TIM3_REMAP_PARTIALREMAP); + } else if ((gpio == GPIO('C', 6) + || gpio == GPIO('C', 7) + || gpio == GPIO('C', 8) + || gpio == GPIO('C', 9)) && (func == 2)) { + // TIM3 full remap + stm32f1_alternative_remap(AFIO_MAPR_TIM3_REMAP_FULLREMAP_Msk, + AFIO_MAPR_TIM3_REMAP_FULLREMAP); + } else if ((gpio == GPIO('D', 12) + || gpio == GPIO('D', 13) + || gpio == GPIO('D', 14) + || gpio == GPIO('D', 15)) && (func == 2)) { + // TIM4 + stm32f1_alternative_remap(AFIO_MAPR_TIM4_REMAP_Msk, + AFIO_MAPR_TIM4_REMAP); } // Add more as needed } |