1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

sys/event/timeout: add timeout_clear() function

This commit is contained in:
Hauke Petersen 2018-01-09 14:37:45 +01:00
parent 2f4a7e28e9
commit 03dccb568d
2 changed files with 17 additions and 0 deletions

View File

@ -26,3 +26,8 @@ void event_timeout_set(event_timeout_t *event_timeout, uint32_t timeout)
{
xtimer_set(&event_timeout->timer, timeout);
}
void event_timeout_clear(event_timeout_t *event_timeout)
{
xtimer_remove(&event_timeout->timer);
}

View File

@ -74,6 +74,18 @@ void event_timeout_init(event_timeout_t *event_timeout, event_queue_t *queue, ev
*/
void event_timeout_set(event_timeout_t *event_timeout, uint32_t timeout);
/**
* @brief Clear a timeout event
*
* Calling this function will cancel the timeout by removing its underlying
* timer. If the timer has already fired before calling this function, the
* connected event will be put already into the given event queue and this
* function does not have any effect.
*
* @param[in] event_timeout event_timeout context object to use
*/
void event_timeout_clear(event_timeout_t *event_timeout);
#ifdef __cplusplus
}
#endif