altos: Set TeleMega v2.0 PWM to support servos
authorKeith Packard <keithp@keithp.com>
Sun, 10 Jan 2016 23:44:08 +0000 (15:44 -0800)
committerKeith Packard <keithp@keithp.com>
Sun, 10 Jan 2016 23:45:21 +0000 (15:45 -0800)
Typical servos use a 50Hz signal with less than 10% duty cycle. Set
the divider to 10 and the range to 64000 to provide a reasonable level
of detail down in the low range.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/telemega-v2.0/ao_pins.h

index d796826cbc4ac13687518e488a093f169834ae1d..a0c7cc46632e2cd6402dffb296f7dc288349d4dc 100644 (file)
@@ -387,10 +387,10 @@ struct ao_adc {
  */
 
 #define NUM_PWM                        4
-#define PWM_MAX                        1023
+#define PWM_MAX                        64000
 #define AO_PWM_TIMER           stm_tim4
 #define AO_PWM_TIMER_ENABLE    STM_RCC_APB1ENR_TIM4EN
-#define AO_PWM_TIMER_SCALE     1
+#define AO_PWM_TIMER_SCALE     10
 
 #define AO_PWM_0_GPIO          (&stm_gpiod)
 #define AO_PWM_0_PIN           12