Ensure timer dma source is disabled before resetting during motor write.

This commit is contained in:
blckmn 2017-01-09 22:08:14 +11:00
parent fbbc43e3d2
commit b7940f19e2
1 changed files with 5 additions and 3 deletions

View File

@ -82,9 +82,11 @@ void pwmWriteDigital(uint8_t index, uint16_t value)
packet <<= 1;
}
DMA_ClearITPendingBit(motor->timerHardware->dmaStream, motor->dmaFlag);
DMA_SetCurrDataCounter(motor->timerHardware->dmaStream, MOTOR_DMA_BUFFER_SIZE);
DMA_Cmd(motor->timerHardware->dmaStream, ENABLE);
DMA_Stream_TypeDef *stream = motor->timerHardware->dmaStream;
TIM_DMACmd(motor->timerHardware->tim, motor->timerDmaSource, DISABLE);
DMA_SetCurrDataCounter(stream, MOTOR_DMA_BUFFER_SIZE);
DMA_ClearITPendingBit(stream, motor->dmaFlag);
DMA_Cmd(stream, ENABLE);
}
void pwmCompleteDigitalMotorUpdate(uint8_t motorCount)