driver: timer: stm32_lptim set_timeout limit values
set the min and max values of the given ticks from 0 to LPTIM_TIMEBASE which is the full register value In case the timeout is FOREVER, then lptimer is stopped Signed-off-by: Francois Ramu <francois.ramu@st.com>
This commit is contained in:
parent
3894c6ee50
commit
fcfcc1d6ea
1 changed files with 1 additions and 11 deletions
|
@ -193,17 +193,7 @@ void z_clock_set_timeout(s32_t ticks, bool idle)
|
|||
* treated identically: it simply indicates the kernel would like the
|
||||
* next tick announcement as soon as possible.
|
||||
*/
|
||||
if (ticks <= (s32_t)1) {
|
||||
ticks = 1;
|
||||
} else {
|
||||
ticks = (ticks - 1);
|
||||
}
|
||||
/* maximise Tick to keep next_arr on 32bit values,
|
||||
* in anycase the ARR cannot exceed LPTIM_TIMEBASE
|
||||
*/
|
||||
if (ticks > (s32_t)0xFFFF) {
|
||||
ticks = 0xFFFF;
|
||||
}
|
||||
ticks = MAX(MIN(ticks - 1, (s32_t)LPTIM_TIMEBASE), 1);
|
||||
|
||||
k_spinlock_key_t key = k_spin_lock(&lock);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue