Merge pull request #1524 from blckmn/f3_led_fix

DMA initialisation moved.
This commit is contained in:
J Blackman 2016-11-11 07:39:44 +11:00 committed by GitHub
commit e82e4465f1
5 changed files with 11 additions and 17 deletions

View File

@ -40,7 +40,7 @@
#include "io.h"
#include "light_ws2811strip.h"
#if defined(STM32F1)
#if defined(STM32F1) || defined(STM32F3)
uint8_t ledStripDMABuffer[WS2811_DMA_BUFFER_SIZE];
#else
uint32_t ledStripDMABuffer[WS2811_DMA_BUFFER_SIZE];

View File

@ -67,7 +67,7 @@ void setStripColors(const hsvColor_t *colors);
bool isWS2811LedStripReady(void);
#if defined(STM32F1)
#if defined(STM32F1) || defined(STM32F3)
extern uint8_t ledStripDMABuffer[WS2811_DMA_BUFFER_SIZE];
#else
extern uint32_t ledStripDMABuffer[WS2811_DMA_BUFFER_SIZE];

View File

@ -89,7 +89,9 @@ void ws2811LedStripHardwareInit(ioTag_t ioTag)
TIM_CtrlPWMOutputs(timer, ENABLE);
/* configure DMA */
/* DMA1 Channel6 Config */
dmaInit(timerHardware->dmaIrqHandler, OWNER_LED_STRIP, 0);
dmaSetHandler(timerHardware->dmaIrqHandler, WS2811_DMA_IRQHandler, NVIC_PRIO_WS2811_DMA, 0);
dmaChannel = timerHardware->dmaChannel;
DMA_DeInit(dmaChannel);
@ -113,9 +115,6 @@ void ws2811LedStripHardwareInit(ioTag_t ioTag)
DMA_ITConfig(dmaChannel, DMA_IT_TC, ENABLE);
dmaInit(timerHardware->dmaIrqHandler, OWNER_LED_STRIP, 0);
dmaSetHandler(timerHardware->dmaIrqHandler, WS2811_DMA_IRQHandler, NVIC_PRIO_WS2811_DMA, 0);
ws2811Initialised = true;
}

View File

@ -66,6 +66,8 @@ void ws2811LedStripHardwareInit(ioTag_t ioTag)
IOInit(ws2811IO, OWNER_LED_STRIP, RESOURCE_OUTPUT, 0);
IOConfigGPIOAF(ws2811IO, IO_CONFIG(GPIO_Mode_AF, GPIO_Speed_50MHz, GPIO_OType_PP, GPIO_PuPd_UP), timerHardware->alternateFunction);
dmaInit(timerHardware->dmaIrqHandler, OWNER_LED_STRIP, 0);
dmaSetHandler(timerHardware->dmaIrqHandler, WS2811_DMA_IRQHandler, NVIC_PRIO_WS2811_DMA, 0);
RCC_ClockCmd(timerRCC(timer), ENABLE);
/* Compute the prescaler value */
@ -109,7 +111,7 @@ void ws2811LedStripHardwareInit(ioTag_t ioTag)
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Word;
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Word;
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;
DMA_InitStructure.DMA_Mode = DMA_Mode_Normal;
DMA_InitStructure.DMA_Priority = DMA_Priority_High;
DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;
@ -120,9 +122,6 @@ void ws2811LedStripHardwareInit(ioTag_t ioTag)
DMA_ITConfig(dmaChannel, DMA_IT_TC, ENABLE);
dmaInit(timerHardware->dmaIrqHandler, OWNER_LED_STRIP, 0);
dmaSetHandler(timerHardware->dmaIrqHandler, WS2811_DMA_IRQHandler, NVIC_PRIO_WS2811_DMA, 0);
ws2811Initialised = true;
}

View File

@ -107,6 +107,9 @@ void ws2811LedStripHardwareInit(ioTag_t ioTag)
TIM_CCxCmd(timer, timerHardware->channel, TIM_CCx_Enable);
TIM_Cmd(timer, ENABLE);
dmaInit(timerHardware->dmaIrqHandler, OWNER_LED_STRIP, 0);
dmaSetHandler(timerHardware->dmaIrqHandler, WS2811_DMA_IRQHandler, NVIC_PRIO_WS2811_DMA, 0);
stream = timerHardware->dmaStream;
/* configure DMA */
DMA_Cmd(stream, DISABLE);
@ -123,10 +126,6 @@ void ws2811LedStripHardwareInit(ioTag_t ioTag)
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Word;
DMA_InitStructure.DMA_Mode = DMA_Mode_Normal;
DMA_InitStructure.DMA_Priority = DMA_Priority_VeryHigh;
DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Enable;
DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_1QuarterFull;
DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;
DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;
DMA_Init(stream, &DMA_InitStructure);
TIM_DMACmd(timer, timerDmaSource(timerHardware->channel), ENABLE);
@ -134,9 +133,6 @@ void ws2811LedStripHardwareInit(ioTag_t ioTag)
DMA_ITConfig(stream, DMA_IT_TC, ENABLE);
DMA_ClearITPendingBit(stream, dmaFlag_IT_TCIF(stream));
dmaInit(timerHardware->dmaIrqHandler, OWNER_LED_STRIP, 0);
dmaSetHandler(timerHardware->dmaIrqHandler, WS2811_DMA_IRQHandler, NVIC_PRIO_WS2811_DMA, 0);
ws2811Initialised = true;
}