mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-17 05:15:25 +03:00
CC3D - Add WS2812 Led Strip Support (on S5_OUT)
This commit is contained in:
parent
4b0fed8f07
commit
997c427e09
2 changed files with 16 additions and 12 deletions
|
@ -31,12 +31,20 @@ void ws2811LedStripHardwareInit(void)
|
||||||
|
|
||||||
uint16_t prescalerValue;
|
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);
|
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
|
||||||
/* GPIOA Configuration: TIM3 Channel 1 as alternate function push-pull */
|
/* GPIOA Configuration: TIM3 Channel 1 as alternate function push-pull */
|
||||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6;
|
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6;
|
||||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
|
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
|
||||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||||
GPIO_Init(GPIOA, &GPIO_InitStructure);
|
GPIO_Init(GPIOA, &GPIO_InitStructure);
|
||||||
|
#endif
|
||||||
|
|
||||||
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE);
|
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE);
|
||||||
/* Compute the prescaler value */
|
/* Compute the prescaler value */
|
||||||
|
|
|
@ -267,25 +267,21 @@ pwmOutputConfiguration_t *pwmInit(drv_pwm_config_t *init)
|
||||||
continue;
|
continue;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(STM32F10X_MD)
|
#if defined(STM32F10X_MD) && !defined(CC3D)
|
||||||
#define LED_STRIP_PWM PWM4
|
#define LED_STRIP_TIMER TIM3
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(STM32F303xC) && !(defined(CHEBUZZF3) || defined(NAZE32PRO))
|
#if defined(CC3D)
|
||||||
#define LED_STRIP_PWM PWM2
|
#define LED_STRIP_TIMER TIM2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CHEBUZZF3)
|
#if defined(STM32F303xC)
|
||||||
#define LED_STRIP_PWM PWM2
|
#define LED_STRIP_TIMER TIM16
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(NAZE32PRO)
|
#ifdef LED_STRIP_TIMER
|
||||||
#define LED_STRIP_PWM PWM13
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef LED_STRIP_PWM
|
|
||||||
// skip LED Strip output
|
// skip LED Strip output
|
||||||
if (init->useLEDStrip && timerIndex == LED_STRIP_PWM)
|
if (init->useLEDStrip && timerHardware[timerIndex].tim == LED_STRIP_TIMER)
|
||||||
continue;
|
continue;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue