mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
sys/event/timeout: remove alternative xtimer implementation
The old event_timeout API is no soley implemented on top of ztimer_usec.
This commit is contained in:
parent
59208722ad
commit
b4a70fc29c
@ -539,13 +539,8 @@ ifneq (,$(filter event_timeout_ztimer,$(USEMODULE)))
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq (,$(filter event_timeout,$(USEMODULE)))
|
ifneq (,$(filter event_timeout,$(USEMODULE)))
|
||||||
ifneq (,$(filter event_timeout_ztimer,$(USEMODULE)))
|
USEMODULE += event_timeout_ztimer
|
||||||
USEMODULE += ztimer_usec
|
USEMODULE += ztimer_usec
|
||||||
else
|
|
||||||
ifeq (,$(filter ztimer_usec,$(USEMODULE)))
|
|
||||||
USEMODULE += xtimer
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq (,$(filter event_periodic,$(USEMODULE)))
|
ifneq (,$(filter event_periodic,$(USEMODULE)))
|
||||||
|
@ -49,24 +49,7 @@ config MODULE_EVENT_TIMEOUT_ZTIMER
|
|||||||
|
|
||||||
config MODULE_EVENT_TIMEOUT
|
config MODULE_EVENT_TIMEOUT
|
||||||
bool "Legacy API, support for triggering events after timeout"
|
bool "Legacy API, support for triggering events after timeout"
|
||||||
|
|
||||||
if MODULE_EVENT_TIMEOUT
|
|
||||||
|
|
||||||
choice EVENT_TIMEOUT_IMPLEMENTATION
|
|
||||||
bool "Event Timeout Implementation"
|
|
||||||
default EVENT_TIMEOUT_ON_XTIMER
|
|
||||||
|
|
||||||
config EVENT_TIMEOUT_ON_ZTIMER
|
|
||||||
bool "Use ztimer as backend"
|
|
||||||
select MODULE_EVENT_TIMEOUT_ZTIMER
|
select MODULE_EVENT_TIMEOUT_ZTIMER
|
||||||
select ZTIMER_USEC
|
select ZTIMER_USEC
|
||||||
|
|
||||||
config EVENT_TIMEOUT_ON_XTIMER
|
|
||||||
bool "Use xtimer as backend"
|
|
||||||
select MODULE_XTIMER if !ZTIMER_USEC
|
|
||||||
|
|
||||||
endchoice # EVENT_TIMEOUT_IMPLEMENTATION
|
|
||||||
|
|
||||||
endif # MODULE_EVENT_TIMEOUT
|
|
||||||
|
|
||||||
endif # MODULE_EVENT
|
endif # MODULE_EVENT
|
||||||
|
@ -2,10 +2,4 @@ SRC := event.c
|
|||||||
|
|
||||||
SUBMODULES := 1
|
SUBMODULES := 1
|
||||||
|
|
||||||
ifneq (,$(filter event_timeout_ztimer,$(USEMODULE)))
|
|
||||||
ifneq (,$(filter ztimer_usec,$(USEMODULE)))
|
|
||||||
SUBMODULES_NO_SRC += timeout.c
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
include $(RIOTBASE)/Makefile.base
|
include $(RIOTBASE)/Makefile.base
|
||||||
|
@ -1,42 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2017 Inria
|
|
||||||
* 2017 Freie Universität Berlin
|
|
||||||
* 2017 Kaspar Schleiser <kaspar@schleiser.de>
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* directory for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "kernel_defines.h"
|
|
||||||
#include "event/timeout.h"
|
|
||||||
#if IS_USED(MODULE_ZTIMER_USEC)
|
|
||||||
#include "ztimer/xtimer_compat.h"
|
|
||||||
#else
|
|
||||||
#include "xtimer.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void _event_timeout_callback(void *arg)
|
|
||||||
{
|
|
||||||
event_timeout_t *event_timeout = (event_timeout_t *)arg;
|
|
||||||
|
|
||||||
event_post(event_timeout->queue, event_timeout->event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void event_timeout_init(event_timeout_t *event_timeout, event_queue_t *queue, event_t *event)
|
|
||||||
{
|
|
||||||
event_timeout->timer.callback = _event_timeout_callback;
|
|
||||||
event_timeout->timer.arg = event_timeout;
|
|
||||||
event_timeout->queue = queue;
|
|
||||||
event_timeout->event = event;
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
@ -38,11 +38,7 @@
|
|||||||
#define EVENT_TIMEOUT_H
|
#define EVENT_TIMEOUT_H
|
||||||
|
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
#if IS_USED(MODULE_EVENT_TIMEOUT_ZTIMER) || IS_USED(MODULE_ZTIMER_USEC)
|
|
||||||
#include "ztimer.h"
|
#include "ztimer.h"
|
||||||
#else
|
|
||||||
#include "xtimer.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -52,19 +48,12 @@ extern "C" {
|
|||||||
* @brief Timeout Event structure
|
* @brief Timeout Event structure
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
#if IS_USED(MODULE_EVENT_TIMEOUT_ZTIMER)
|
|
||||||
ztimer_clock_t *clock; /**< ztimer clock to use */
|
ztimer_clock_t *clock; /**< ztimer clock to use */
|
||||||
#endif
|
|
||||||
#if IS_USED(MODULE_EVENT_TIMEOUT_ZTIMER) || IS_USED(MODULE_ZTIMER_USEC)
|
|
||||||
ztimer_t timer; /**< ztimer object used for timeout */
|
ztimer_t timer; /**< ztimer object used for timeout */
|
||||||
#else
|
|
||||||
xtimer_t timer; /**< ztimer object used for timeout */
|
|
||||||
#endif
|
|
||||||
event_queue_t *queue; /**< event queue to post event to */
|
event_queue_t *queue; /**< event queue to post event to */
|
||||||
event_t *event; /**< event to post after timeout */
|
event_t *event; /**< event to post after timeout */
|
||||||
} event_timeout_t;
|
} event_timeout_t;
|
||||||
|
|
||||||
#if IS_USED(MODULE_EVENT_TIMEOUT_ZTIMER) || DOXYGEN
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialize timeout event object
|
* @brief Initialize timeout event object
|
||||||
*
|
*
|
||||||
@ -75,7 +64,6 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
void event_timeout_ztimer_init(event_timeout_t *event_timeout, ztimer_clock_t *clock,
|
void event_timeout_ztimer_init(event_timeout_t *event_timeout, ztimer_clock_t *clock,
|
||||||
event_queue_t *queue, event_t *event);
|
event_queue_t *queue, event_t *event);
|
||||||
#endif
|
|
||||||
|
|
||||||
#if IS_USED(MODULE_EVENT_TIMEOUT) || DOXYGEN
|
#if IS_USED(MODULE_EVENT_TIMEOUT) || DOXYGEN
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user