void sensor_delay_ms(uint32_t msecs) { if (msecs >= CONVERT_TICKS_TO_MS(1)) { T_SEMAPHORE sem = semaphore_create(0); semaphore_take(sem, (int)msecs + 1); /* details in FIRE-5618 */ semaphore_delete(sem); } else { wait_ticks(msecs * AON_CNT_TICK_PER_MS); } }
void sensor_delay_ms(uint32_t msecs) { if (msecs >= CONVERT_TICKS_TO_MS(1)) { T_SEMAPHORE sem = semaphore_create(0); /* Ensure that we will wait at least 'msecs' millisecond as if semaphore_take is called * right before the timer tick interrupt it will be released immediately */ semaphore_take(sem, (int)msecs + 1); semaphore_delete(sem); } else { wait_ticks(msecs * AON_CNT_TICK_PER_MS); } }
/** * Return the current tick converted in milliseconds. * * Authorized execution levels: task, fiber * * @warning: the return value is false in interrupt context. * * @return current tick converted in milliseconds */ uint32_t get_time_ms(void) { return (uint32_t)CONVERT_TICKS_TO_MS(sys_tick_get_32()); }
/** * Return the current tick converted in milliseconds. * * Authorized execution levels: task, fiber, ISR * * @return current tick converted in milliseconds */ uint32_t get_time_ms(void) { return ( (uint32_t) CONVERT_TICKS_TO_MS(_GET_TICK())); }