Skip to content
Snippets Groups Projects
Unverified Commit fb2beb43 authored by Kaspar Schleiser's avatar Kaspar Schleiser Committed by GitHub
Browse files

Merge pull request #8875 from Josar/pr/xtimer64

sys/include/xtimer: Added xtimer_set64()
parents b117638f bb7acca3
Branches
No related tags found
No related merge requests found
...@@ -291,6 +291,27 @@ static inline void xtimer_set_wakeup64(xtimer_t *timer, uint64_t offset, kernel_ ...@@ -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); 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 * @brief remove a timer
* *
......
/* /*
* Copyright (C) 2015 Kaspar Schleiser <kaspar@schleiser.de> * 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 * 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 * General Public License v2.1. See the file LICENSE in the top level
...@@ -13,8 +14,11 @@ ...@@ -13,8 +14,11 @@
* @{ * @{
* @file * @file
* @brief xtimer implementation * @brief xtimer implementation
*
* @author Kaspar Schleiser <kaspar@schleiser.de> * @author Kaspar Schleiser <kaspar@schleiser.de>
* @author Joakim Nohlgård <joakim.nohlgard@eistec.se> * @author Joakim Nohlgård <joakim.nohlgard@eistec.se>
* @author Josua Arndt <jarndt@ias.rwth-aachen.de>
*
*/ */
#ifndef XTIMER_IMPLEMENTATION_H #ifndef XTIMER_IMPLEMENTATION_H
#define XTIMER_IMPLEMENTATION_H #define XTIMER_IMPLEMENTATION_H
...@@ -217,6 +221,12 @@ static inline void xtimer_set(xtimer_t *timer, uint32_t offset) ...@@ -217,6 +221,12 @@ static inline void xtimer_set(xtimer_t *timer, uint32_t offset)
_xtimer_set(timer, _xtimer_ticks_from_usec(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) static inline int xtimer_msg_receive_timeout(msg_t *msg, uint32_t timeout)
{ {
return _xtimer_msg_receive_timeout(msg, _xtimer_ticks_from_usec(timeout)); return _xtimer_msg_receive_timeout(msg, _xtimer_ticks_from_usec(timeout));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment