Fix WS2812 LED initialisation.

The timer was not being initialised correctly, it only worked by
accident due to timer configuration of other timer channels.  This
explained why TIM3 didn't work in the mapping exclusion for the CC3D and
why for the LEDs to work correctly TIM2 had to be specified so that TIM3
was actually accidentally initialised still.
This commit is contained in:
Dominic Clifton 2014-07-26 17:44:17 +01:00
parent 4e284b3e41
commit c9b5334f16
3 changed files with 4 additions and 1 deletions

View File

@ -62,6 +62,7 @@ void ws2811LedStripHardwareInit(void)
TIM_OCInitStructure.TIM_Pulse = 0;
TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High;
TIM_OC1Init(TIM3, &TIM_OCInitStructure);
TIM_OC1PreloadConfig(TIM3, TIM_OCPreload_Enable);
TIM_CtrlPWMOutputs(TIM3, ENABLE);

View File

@ -66,6 +66,8 @@ void ws2811LedStripHardwareInit(void)
TIM_OCInitStructure.TIM_Pulse = 0;
TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High;
TIM_OC1Init(TIM16, &TIM_OCInitStructure);
TIM_OC1PreloadConfig(TIM3, TIM_OCPreload_Enable);
TIM_CtrlPWMOutputs(TIM16, ENABLE);

View File

@ -272,7 +272,7 @@ pwmOutputConfiguration_t *pwmInit(drv_pwm_config_t *init)
#endif
#if defined(CC3D)
#define LED_STRIP_TIMER TIM2
#define LED_STRIP_TIMER TIM3
#endif
#if defined(STM32F303xC)