diff options
author | Keith Packard <keithp@keithp.com> | 2015-12-25 23:20:29 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2015-12-25 23:20:29 -0800 |
commit | 742f7c834bb5d651d2bebf2069d4e8facc33390d (patch) | |
tree | 3e788eb5b228717467a802a882a1d348a7b0acc1 /src/telemega-v2.0 | |
parent | 8aa0ab9fe9ca41f6d520d388973164bc0c599a06 (diff) |
altos: Get stm32l pwm driver working
Fix the CCMR1_OC1PE and CCMR2_OC3PE values.
Disable clock when no PWM outputs are running.
Fix the apb1enr value for the timer.
Set ARR value to PWM_MAX - 1 -- ARR is off by one.
Sets the GPIO pins to 40MHz bandwidth for sharper edges.
Tested on EasyMega, but that code is not included as it breaks the
companion protocol.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/telemega-v2.0')
-rw-r--r-- | src/telemega-v2.0/ao_pins.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/telemega-v2.0/ao_pins.h b/src/telemega-v2.0/ao_pins.h index b88dd08c..ed5935b4 100644 --- a/src/telemega-v2.0/ao_pins.h +++ b/src/telemega-v2.0/ao_pins.h @@ -387,8 +387,20 @@ struct ao_adc { */ #define NUM_PWM 4 -#define PWM_MAX 1024 +#define PWM_MAX 1023 #define AO_PWM_TIMER stm_tim4 #define AO_PWM_TIMER_ENABLE STM_RCC_APB1ENR_TIM4EN +#define AO_PWM_0_GPIO (&stm_gpiod) +#define AO_PWM_0_PIN 12 + +#define AO_PWM_1_GPIO (&stm_gpiod) +#define AO_PWM_1_PIN 13 + +#define AO_PWM_2_GPIO (&stm_gpiod) +#define AO_PWM_2_PIN 14 + +#define AO_PWM_3_GPIO (&stm_gpiod) +#define AO_PWM_3_PIN 15 + #endif /* _AO_PINS_H_ */ |