driver: timer: stm32_lptim: fix autoreload value

Autoreload value must be decrement by one

Signed-off-by: Julien D'Ascenzio <julien.dascenzio@paratronic.fr>
This commit is contained in:
Julien D'Ascenzio 2020-05-07 16:03:36 +02:00 committed by Carles Cufí
commit e20d7890ef

View file

@ -163,7 +163,7 @@ int z_clock_driver_init(struct device *device)
} else {
/* LPTIM1 is triggered on a Tick period */
LL_LPTIM_SetAutoReload(LPTIM1, COUNT_PER_TICK);
LL_LPTIM_SetAutoReload(LPTIM1, COUNT_PER_TICK - 1);
}
/* Start the LPTIM counter in continuous mode */
@ -237,7 +237,7 @@ void z_clock_set_timeout(s32_t ticks, bool idle)
/ (CONFIG_SYS_CLOCK_TICKS_PER_SEC);
/* add count unit from the expected nb of Ticks */
next_arr = next_arr + ((u32_t)(ticks) * LPTIM_CLOCK)
/ CONFIG_SYS_CLOCK_TICKS_PER_SEC + 1;
/ CONFIG_SYS_CLOCK_TICKS_PER_SEC - 1;
/* maximise to TIMEBASE */
if (next_arr > LPTIM_TIMEBASE) {