stm32: Add hardware PWM support for STM32F1
This adds hardware PWM support for STM32F1 processors. This should also work for STM32 F0/F2/F4 processors, but I don't have one of those to test it. Signed-off-by: Michael Kurz <michi.kurz@gmail.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
committed by
Kevin O'Connor
parent
39188e1cf3
commit
59c4c49893
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user