altos: Switch PWM constants to end up exposing µsec
authorKeith Packard <keithp@keithp.com>
Sun, 10 Jan 2016 23:56:21 +0000 (15:56 -0800)
committerKeith Packard <keithp@keithp.com>
Sun, 10 Jan 2016 23:56:21 +0000 (15:56 -0800)
This changes the constants so the clock runs at 1MHz, making the step
1µsec each. Then make the period 20000 steps, or 20ms for a 50Hz
frequency as before.

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

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