1
0
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:
Francisco Molina 2022-02-23 09:36:49 +01:00
parent 59208722ad
commit b4a70fc29c
5 changed files with 2 additions and 84 deletions

View File

@ -539,13 +539,8 @@ ifneq (,$(filter event_timeout_ztimer,$(USEMODULE)))
endif
ifneq (,$(filter event_timeout,$(USEMODULE)))
ifneq (,$(filter event_timeout_ztimer,$(USEMODULE)))
USEMODULE += ztimer_usec
else
ifeq (,$(filter ztimer_usec,$(USEMODULE)))
USEMODULE += xtimer
endif
endif
USEMODULE += event_timeout_ztimer
USEMODULE += ztimer_usec
endif
ifneq (,$(filter event_periodic,$(USEMODULE)))

View File

@ -49,24 +49,7 @@ config MODULE_EVENT_TIMEOUT_ZTIMER
config MODULE_EVENT_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 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

View File

@ -2,10 +2,4 @@ SRC := event.c
SUBMODULES := 1
ifneq (,$(filter event_timeout_ztimer,$(USEMODULE)))
ifneq (,$(filter ztimer_usec,$(USEMODULE)))
SUBMODULES_NO_SRC += timeout.c
endif
endif
include $(RIOTBASE)/Makefile.base

View File

@ -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);
}

View File

@ -38,11 +38,7 @@
#define EVENT_TIMEOUT_H
#include "event.h"
#if IS_USED(MODULE_EVENT_TIMEOUT_ZTIMER) || IS_USED(MODULE_ZTIMER_USEC)
#include "ztimer.h"
#else
#include "xtimer.h"
#endif
#ifdef __cplusplus
extern "C" {
@ -52,19 +48,12 @@ extern "C" {
* @brief Timeout Event structure
*/
typedef struct {
#if IS_USED(MODULE_EVENT_TIMEOUT_ZTIMER)
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 */
#else
xtimer_t timer; /**< ztimer object used for timeout */
#endif
event_queue_t *queue; /**< event queue to post event to */
event_t *event; /**< event to post after timeout */
} event_timeout_t;
#if IS_USED(MODULE_EVENT_TIMEOUT_ZTIMER) || DOXYGEN
/**
* @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,
event_queue_t *queue, event_t *event);
#endif
#if IS_USED(MODULE_EVENT_TIMEOUT) || DOXYGEN
/**