Library that allows for higher resolution and speed than standard mbed PWM library using same syntax (drop-in replacement).
Diff: Device/FastPWM_STM_TIM_PinOut.cpp
- Revision:
- 20:3c609bc4ae9c
- Parent:
- 19:ba7a5bf634b3
- Child:
- 21:aa2884be5496
--- a/Device/FastPWM_STM_TIM_PinOut.cpp Mon Nov 10 16:36:19 2014 +0000 +++ b/Device/FastPWM_STM_TIM_PinOut.cpp Tue Jan 06 14:32:49 2015 +0000 @@ -92,4 +92,27 @@ } return NULL; } +#endif + +#if defined TARGET_NUCLEO_F072RB +__IO uint32_t* getChannel(TIM_TypeDef* pwm, PinName pin) { + switch (pin) { + // Channels 1 : PWMx/1 + case PA_2: case PA_6: case PA_4: case PA_7: case PA_8: case PB_1: case PB_4: case PB_8: case PB_9: case PB_14: case PC_6: + return &pwm->CCR1; + + // Channels 2 : PWMx/2 + case PA_3: case PA_9: case PB_5: case PC_7: case PB_15: + return &pwm->CCR2; + + // Channels 3 : PWMx/3 + case PA_10: case PB_0: case PC_8: + return &pwm->CCR3; + + // Channels 4 : PWMx/4 + case PA_11: case PC_9: + return &pwm->CCR4; + } + return NULL; +} #endif \ No newline at end of file