timeouts: Use the new timeout API
Port the code to use the new timeout API. Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This commit is contained in:
parent
811363a384
commit
ebf0a6f11c
|
@ -137,7 +137,7 @@ void ClockP_start(ClockP_Handle handle)
|
|||
period = obj->period * 1000 / CONFIG_SYS_CLOCK_TICKS_PER_SEC;
|
||||
}
|
||||
|
||||
k_timer_start(&obj->timer, timeout, period);
|
||||
k_timer_start(&obj->timer, K_MSEC(timeout), K_MSEC(period));
|
||||
|
||||
obj->active = true;
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ void ClockP_stop(ClockP_Handle handle)
|
|||
*/
|
||||
void ClockP_usleep(uint32_t usec)
|
||||
{
|
||||
k_sleep((s32_t)usec);
|
||||
k_sleep(K_USEC(usec));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -48,21 +48,16 @@ static SemaphoreP_Status dpl_sem_pool_free(struct k_sem *sem)
|
|||
}
|
||||
|
||||
/* timeout comes in and out as milliSeconds: */
|
||||
static int32_t dpl_convert_timeout(uint32_t timeout)
|
||||
static k_timeout_t dpl_convert_timeout(uint32_t timeout)
|
||||
{
|
||||
int32_t zephyr_timeout;
|
||||
|
||||
switch(timeout) {
|
||||
case SemaphoreP_NO_WAIT:
|
||||
zephyr_timeout = K_NO_WAIT;
|
||||
break;
|
||||
return K_NO_WAIT;
|
||||
case SemaphoreP_WAIT_FOREVER:
|
||||
zephyr_timeout = K_FOREVER;
|
||||
break;
|
||||
return K_FOREVER;
|
||||
default:
|
||||
zephyr_timeout = timeout;
|
||||
return K_MSEC(timeout);
|
||||
}
|
||||
return zephyr_timeout;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue