Merge pull request #3978 from sambas/betaflightF7
Fix F7 digital pwm and ledstrip
This commit is contained in:
commit
66985c5665
|
@ -38,17 +38,15 @@ static TIM_HandleTypeDef TimHandle;
|
|||
static uint16_t timerChannel = 0;
|
||||
static bool timerNChannel = false;
|
||||
|
||||
void HAL_TIM_PWM_PulseFinishedCallback(TIM_HandleTypeDef *htim)
|
||||
{
|
||||
if (htim->Instance == TimHandle.Instance) {
|
||||
//HAL_TIM_PWM_Stop_DMA(&TimHandle,WS2811_TIMER_CHANNEL);
|
||||
ws2811LedDataTransferInProgress = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void WS2811_DMA_IRQHandler(dmaChannelDescriptor_t* descriptor)
|
||||
{
|
||||
HAL_DMA_IRQHandler(TimHandle.hdma[descriptor->userParam]);
|
||||
if(timerNChannel) {
|
||||
HAL_TIMEx_PWMN_Stop_DMA(&TimHandle,timerChannel);
|
||||
} else {
|
||||
HAL_TIM_PWM_Stop_DMA(&TimHandle,timerChannel);
|
||||
}
|
||||
ws2811LedDataTransferInProgress = 0;
|
||||
}
|
||||
|
||||
void ws2811LedStripHardwareInit(ioTag_t ioTag)
|
||||
|
@ -86,7 +84,7 @@ void ws2811LedStripHardwareInit(ioTag_t ioTag)
|
|||
|
||||
ws2811IO = IOGetByTag(ioTag);
|
||||
IOInit(ws2811IO, OWNER_LED_STRIP, 0);
|
||||
IOConfigGPIOAF(ws2811IO, IO_CONFIG(GPIO_MODE_AF_PP, GPIO_SPEED_FREQ_VERY_HIGH, GPIO_PULLUP), timerHardware->alternateFunction);
|
||||
IOConfigGPIOAF(ws2811IO, IO_CONFIG(GPIO_MODE_AF_PP, GPIO_SPEED_FREQ_VERY_HIGH, GPIO_PULLDOWN), timerHardware->alternateFunction);
|
||||
|
||||
__DMA1_CLK_ENABLE();
|
||||
|
||||
|
|
|
@ -83,6 +83,11 @@ static void motor_DMA_IRQHandler(dmaChannelDescriptor_t* descriptor)
|
|||
{
|
||||
motorDmaOutput_t * const motor = &dmaMotors[descriptor->userParam];
|
||||
HAL_DMA_IRQHandler(motor->TimHandle.hdma[motor->timerDmaSource]);
|
||||
if (motor->timerHardware->output & TIMER_OUTPUT_N_CHANNEL) {
|
||||
HAL_TIMEx_PWMN_Stop_DMA(&motor->TimHandle,motor->timerHardware->channel);
|
||||
} else {
|
||||
HAL_TIM_PWM_Stop_DMA(&motor->TimHandle,motor->timerHardware->channel);
|
||||
}
|
||||
}
|
||||
|
||||
void pwmDshotMotorHardwareConfig(const timerHardware_t *timerHardware, uint8_t motorIndex, motorPwmProtocolTypes_e pwmProtocolType, uint8_t output)
|
||||
|
@ -96,7 +101,7 @@ void pwmDshotMotorHardwareConfig(const timerHardware_t *timerHardware, uint8_t m
|
|||
const uint8_t timerIndex = getTimerIndex(timer);
|
||||
|
||||
IOInit(motorIO, OWNER_MOTOR, RESOURCE_INDEX(motorIndex));
|
||||
IOConfigGPIOAF(motorIO, IO_CONFIG(GPIO_MODE_AF_PP, GPIO_SPEED_FREQ_VERY_HIGH, GPIO_PULLUP), timerHardware->alternateFunction);
|
||||
IOConfigGPIOAF(motorIO, IO_CONFIG(GPIO_MODE_AF_PP, GPIO_SPEED_FREQ_VERY_HIGH, GPIO_PULLDOWN), timerHardware->alternateFunction);
|
||||
|
||||
__DMA1_CLK_ENABLE();
|
||||
|
||||
|
|
Loading…
Reference in New Issue