fix: Missing first channel in PPM stream (#3598)
This commit is contained in:
@@ -46,7 +46,10 @@ static void module_timer_send(void* ctx, const etx_timer_config_t* cfg,
|
||||
const void* pulses, uint16_t length)
|
||||
{
|
||||
auto timer = (const stm32_pulse_timer_t*)ctx;
|
||||
if (!stm32_pulse_if_not_running_disable(timer)) return;
|
||||
if (!stm32_pulse_if_not_running_disable(timer)) {
|
||||
LL_DMA_DeInit(timer->DMAx, timer->DMA_Stream);
|
||||
return;
|
||||
}
|
||||
|
||||
// Set polarity
|
||||
stm32_pulse_set_polarity(timer, cfg->polarity);
|
||||
|
||||
@@ -298,12 +298,12 @@ void stm32_pulse_start_dma_req(const stm32_pulse_timer_t* tim,
|
||||
// Enable TC IRQ
|
||||
LL_DMA_EnableIT_TC(tim->DMAx, tim->DMA_Stream);
|
||||
|
||||
// Reset counter close to overflow
|
||||
if (IS_TIM_32B_COUNTER_INSTANCE(tim->TIMx)) {
|
||||
LL_TIM_SetCounter(tim->TIMx, 0xFFFFFFFF);
|
||||
} else {
|
||||
LL_TIM_SetCounter(tim->TIMx, 0xFFFF);
|
||||
}
|
||||
// Reset counter
|
||||
LL_TIM_SetCounter(tim->TIMx, 0x00);
|
||||
|
||||
// only on PWM (preloads the first period)
|
||||
if (ocmode == LL_TIM_OCMODE_PWM1)
|
||||
LL_TIM_GenerateEvent_UPDATE(tim->TIMx);
|
||||
|
||||
LL_TIM_EnableDMAReq_UPDATE(tim->TIMx);
|
||||
LL_DMA_EnableStream(tim->DMAx, tim->DMA_Stream);
|
||||
|
||||
Reference in New Issue
Block a user