sys/include/xtimer: Added xtimer_set64()
This commit is contained in:
parent
c23d85ab3a
commit
bb7acca31e
@ -291,6 +291,27 @@ static inline void xtimer_set_wakeup64(xtimer_t *timer, uint64_t offset, kernel_
|
||||
*/
|
||||
static inline void xtimer_set(xtimer_t *timer, uint32_t offset);
|
||||
|
||||
/**
|
||||
* @brief Set a timer to execute a callback at some time in the future, 64bit
|
||||
* version
|
||||
*
|
||||
* Expects timer->callback to be set.
|
||||
*
|
||||
* The callback specified in the timer struct will be executed @p offset_usec
|
||||
* microseconds in the future.
|
||||
*
|
||||
* @warning BEWARE! Callbacks from xtimer_set() are being executed in interrupt
|
||||
* context (unless offset < XTIMER_BACKOFF). DON'T USE THIS FUNCTION unless you
|
||||
* know *exactly* what that means.
|
||||
*
|
||||
* @param[in] timer the timer structure to use.
|
||||
* Its xtimer_t::target and xtimer_t::long_target
|
||||
* fields need to be initialized with 0 on first use
|
||||
* @param[in] offset_us time in microseconds from now specifying that timer's
|
||||
* callback's execution time
|
||||
*/
|
||||
static inline void xtimer_set64(xtimer_t *timer, uint64_t offset_us);
|
||||
|
||||
/**
|
||||
* @brief remove a timer
|
||||
*
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Kaspar Schleiser <kaspar@schleiser.de>
|
||||
* Copyright (C) 2016 Eistec AB
|
||||
* 2016 Eistec AB
|
||||
* 2018 Josua Arndt
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
@ -13,8 +14,11 @@
|
||||
* @{
|
||||
* @file
|
||||
* @brief xtimer implementation
|
||||
*
|
||||
* @author Kaspar Schleiser <kaspar@schleiser.de>
|
||||
* @author Joakim Nohlgård <joakim.nohlgard@eistec.se>
|
||||
* @author Josua Arndt <jarndt@ias.rwth-aachen.de>
|
||||
*
|
||||
*/
|
||||
#ifndef XTIMER_IMPLEMENTATION_H
|
||||
#define XTIMER_IMPLEMENTATION_H
|
||||
@ -217,6 +221,12 @@ static inline void xtimer_set(xtimer_t *timer, uint32_t offset)
|
||||
_xtimer_set(timer, _xtimer_ticks_from_usec(offset));
|
||||
}
|
||||
|
||||
static inline void xtimer_set64(xtimer_t *timer, uint64_t period_us)
|
||||
{
|
||||
uint64_t ticks = _xtimer_ticks_from_usec64(period_us);
|
||||
_xtimer_set64(timer, ticks, ticks >> 32);
|
||||
}
|
||||
|
||||
static inline int xtimer_msg_receive_timeout(msg_t *msg, uint32_t timeout)
|
||||
{
|
||||
return _xtimer_msg_receive_timeout(msg, _xtimer_ticks_from_usec(timeout));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user