CC3D - Add WS2812 Led Strip Support (on S5_OUT)
This commit is contained in:
parent
4b0fed8f07
commit
997c427e09
|
@ -31,12 +31,20 @@ void ws2811LedStripHardwareInit(void)
|
|||
|
||||
uint16_t prescalerValue;
|
||||
|
||||
#ifdef CC3D
|
||||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
GPIO_Init(GPIOB, &GPIO_InitStructure);
|
||||
#else
|
||||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
|
||||
/* GPIOA Configuration: TIM3 Channel 1 as alternate function push-pull */
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
GPIO_Init(GPIOA, &GPIO_InitStructure);
|
||||
#endif
|
||||
|
||||
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE);
|
||||
/* Compute the prescaler value */
|
||||
|
|
|
@ -267,25 +267,21 @@ pwmOutputConfiguration_t *pwmInit(drv_pwm_config_t *init)
|
|||
continue;
|
||||
#endif
|
||||
|
||||
#if defined(STM32F10X_MD)
|
||||
#define LED_STRIP_PWM PWM4
|
||||
#if defined(STM32F10X_MD) && !defined(CC3D)
|
||||
#define LED_STRIP_TIMER TIM3
|
||||
#endif
|
||||
|
||||
#if defined(STM32F303xC) && !(defined(CHEBUZZF3) || defined(NAZE32PRO))
|
||||
#define LED_STRIP_PWM PWM2
|
||||
#if defined(CC3D)
|
||||
#define LED_STRIP_TIMER TIM2
|
||||
#endif
|
||||
|
||||
#if defined(CHEBUZZF3)
|
||||
#define LED_STRIP_PWM PWM2
|
||||
#if defined(STM32F303xC)
|
||||
#define LED_STRIP_TIMER TIM16
|
||||
#endif
|
||||
|
||||
#if defined(NAZE32PRO)
|
||||
#define LED_STRIP_PWM PWM13
|
||||
#endif
|
||||
|
||||
#ifdef LED_STRIP_PWM
|
||||
#ifdef LED_STRIP_TIMER
|
||||
// skip LED Strip output
|
||||
if (init->useLEDStrip && timerIndex == LED_STRIP_PWM)
|
||||
if (init->useLEDStrip && timerHardware[timerIndex].tim == LED_STRIP_TIMER)
|
||||
continue;
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue