FastPWM clone
Diff: Device/FastPWM_STM_TIM_PinOut.cpp
- Revision:
- 26:0c924507a81f
- Parent:
- 25:8b1bf34c72aa
- Child:
- 27:7f484dd7323d
--- a/Device/FastPWM_STM_TIM_PinOut.cpp Wed Sep 30 20:46:18 2015 +0000 +++ b/Device/FastPWM_STM_TIM_PinOut.cpp Sun Jan 31 08:29:35 2016 +0000 @@ -148,4 +148,63 @@ } return NULL; } +#endif + +#ifdef TARGET_NUCLEO_F303K8 +__IO uint32_t* getChannel(TIM_TypeDef* pwm, PinName pin) { + switch (pin) { + // Channels 1 + case PA_12: case PA_8: case PB_5: case PB_4: case PA_2: case PA_7: case PA_6: + // Channels 1N + case PB_7: case PB_6: + return &pwm->CCR1; + + // Channels 2 + case PA_9: case PA_4: case PA_3: + // Channels 2N + case PB_0: + return &pwm->CCR2; + + // Channels 3 + case PA_10: + // Channels 3N + case PB_1: case PF_0: + return &pwm->CCR3; + + // Channels 4 + case PA_11: + // Channels 4N + + return &pwm->CCR4; + } + return NULL; +} +#endif + + +#ifdef TARGET_NUCLEO_F446RE +__IO uint32_t* getChannel(TIM_TypeDef* pwm, PinName pin) { + switch (pin) { + // Channels 1 : PWMx/1 + case PA_0: case PA_5: case PA_6: case PB_6: case PA_8: case PB_4: + // Channels 1N + case PA_7: + return &pwm->CCR1; + + // Channels 2 : PWMx/2 + case PA_1: case PC_7: case PA_9: case PB_5: case PB_3: + // Channels 2N + case PB_0: + return &pwm->CCR2; + + // Channels 3 : PWMx/3 + case PB_8: case PB_10: case PA_10: case PA_2: + return &pwm->CCR3; + + // Channels 4 : PWMx/4 + case PB_9: case PA_3: + return &pwm->CCR4; + } + return NULL; +} #endif \ No newline at end of file