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:
Carles Cufi 2020-05-04 12:24:52 +02:00 committed by Carles Cufí
parent 811363a384
commit ebf0a6f11c
2 changed files with 6 additions and 11 deletions

View File

@ -137,7 +137,7 @@ void ClockP_start(ClockP_Handle handle)
period = obj->period * 1000 / CONFIG_SYS_CLOCK_TICKS_PER_SEC; 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; obj->active = true;
} }
@ -158,7 +158,7 @@ void ClockP_stop(ClockP_Handle handle)
*/ */
void ClockP_usleep(uint32_t usec) void ClockP_usleep(uint32_t usec)
{ {
k_sleep((s32_t)usec); k_sleep(K_USEC(usec));
} }
/* /*

View File

@ -48,21 +48,16 @@ static SemaphoreP_Status dpl_sem_pool_free(struct k_sem *sem)
} }
/* timeout comes in and out as milliSeconds: */ /* 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) { switch(timeout) {
case SemaphoreP_NO_WAIT: case SemaphoreP_NO_WAIT:
zephyr_timeout = K_NO_WAIT; return K_NO_WAIT;
break;
case SemaphoreP_WAIT_FOREVER: case SemaphoreP_WAIT_FOREVER:
zephyr_timeout = K_FOREVER; return K_FOREVER;
break;
default: default:
zephyr_timeout = timeout; return K_MSEC(timeout);
} }
return zephyr_timeout;
} }