iotimer: Enable timer when configuring input capture

We provide a latency measurement in the input capture handler.
However, since the timer was not enabled, none of the counter were
running therefore all counters were zero, thus latency was also zero.

Since the HRT is used to provide a timestamp, the lack of the running
timer was never noticed. After enabling the timer, latency now correctly
shows 9-10 counts.
This commit is contained in:
Niklas Hauser 2023-05-31 17:07:06 +02:00 committed by Daniel Agar
parent ecb78ca207
commit 63b5c790b7
1 changed files with 5 additions and 3 deletions

View File

@ -898,11 +898,13 @@ int io_timer_set_enable(bool state, io_timer_channel_mode_t mode, io_timer_chann
case IOTimerChanMode_Dshot:
dier_bit = 0;
cr1_bit = state ? GTIM_CR1_CEN : 0;
break;
case IOTimerChanMode_PWMIn:
/* fallthrough */
case IOTimerChanMode_Capture:
cr1_bit = state ? GTIM_CR1_CEN : 0;
/* fallthrough */
case IOTimerChanMode_PWMIn:
break;
default: