xtimer: add xtimer_set_timeout_flag64()
This commit is contained in:
parent
55cc34fd17
commit
58e381979f
@ -398,6 +398,7 @@ static inline bool xtimer_less64(xtimer_ticks64_t a, xtimer_ticks64_t b);
|
|||||||
*/
|
*/
|
||||||
int xtimer_mutex_lock_timeout(mutex_t *mutex, uint64_t us);
|
int xtimer_mutex_lock_timeout(mutex_t *mutex, uint64_t us);
|
||||||
|
|
||||||
|
#if defined(MODULE_CORE_THREAD_FLAGS) || defined(DOXYGEN)
|
||||||
/**
|
/**
|
||||||
* @brief Set timeout thread flag after @p timeout
|
* @brief Set timeout thread flag after @p timeout
|
||||||
*
|
*
|
||||||
@ -409,6 +410,17 @@ int xtimer_mutex_lock_timeout(mutex_t *mutex, uint64_t us);
|
|||||||
*/
|
*/
|
||||||
void xtimer_set_timeout_flag(xtimer_t *t, uint32_t timeout);
|
void xtimer_set_timeout_flag(xtimer_t *t, uint32_t timeout);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set timeout thread flag after @p timeout
|
||||||
|
*
|
||||||
|
* See xtimer_set_timeout_flag() for more information.
|
||||||
|
*
|
||||||
|
* @param[in] t timer struct to use
|
||||||
|
* @param[in] timeout timeout in usec
|
||||||
|
*/
|
||||||
|
void xtimer_set_timeout_flag64(xtimer_t *t, uint64_t timeout);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(MODULE_CORE_MSG) || defined(DOXYGEN)
|
#if defined(MODULE_CORE_MSG) || defined(DOXYGEN)
|
||||||
/**
|
/**
|
||||||
* @brief Set a timer that sends a message
|
* @brief Set a timer that sends a message
|
||||||
|
|||||||
@ -255,11 +255,22 @@ static void _set_timeout_flag_callback(void* arg)
|
|||||||
thread_flags_set(arg, THREAD_FLAG_TIMEOUT);
|
thread_flags_set(arg, THREAD_FLAG_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void xtimer_set_timeout_flag(xtimer_t *t, uint32_t timeout)
|
static void _set_timeout_flag_prepare(xtimer_t *t)
|
||||||
{
|
{
|
||||||
t->callback = _set_timeout_flag_callback;
|
t->callback = _set_timeout_flag_callback;
|
||||||
t->arg = (thread_t *)sched_active_thread;
|
t->arg = (thread_t *)sched_active_thread;
|
||||||
thread_flags_clear(THREAD_FLAG_TIMEOUT);
|
thread_flags_clear(THREAD_FLAG_TIMEOUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
void xtimer_set_timeout_flag(xtimer_t *t, uint32_t timeout)
|
||||||
|
{
|
||||||
|
_set_timeout_flag_prepare(t);
|
||||||
xtimer_set(t, timeout);
|
xtimer_set(t, timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void xtimer_set_timeout_flag64(xtimer_t *t, uint64_t timeout)
|
||||||
|
{
|
||||||
|
_set_timeout_flag_prepare(t);
|
||||||
|
xtimer_set64(t, timeout);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user