1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-26 23:11:19 +01:00
Marian Buschsieweke f8029e8891
tests/sys: use SPDX copyright tags
Co-authored-by: crasbe <crasbe@gmail.com>
2025-11-22 08:48:27 +01:00

54 lines
1.3 KiB
C

/*
* SPDX-FileCopyrightText: 2022 ML!PA Consulting GmbH
* SPDX-License-Identifier: LGPL-2.1-only
*/
/**
* @ingroup tests
* @{
*
* @file
* @brief Periodic Callback test application
*
* @author Benjamin Valentin <benjamin.valentin@ml-pa.com>
*
* @}
*/
#include <stdio.h>
#include "event/deferred_callback.h"
#include "event/periodic_callback.h"
#include "event/thread.h"
static void _event_cb(void *ctx)
{
puts(ctx);
}
int main(void)
{
event_callback_t oneshot;
event_callback_oneshot(&oneshot, EVENT_PRIO_MEDIUM, _event_cb, "event 0");
event_deferred_callback_t d;
event_deferred_callback_post(&d, EVENT_PRIO_MEDIUM, ZTIMER_MSEC, 750, _event_cb, "event D");
event_periodic_callback_t a, b, c;
event_periodic_callback_init(&a, ZTIMER_MSEC, EVENT_PRIO_MEDIUM, _event_cb, "event A");
event_periodic_callback_init(&b, ZTIMER_MSEC, EVENT_PRIO_MEDIUM, _event_cb, "event B");
event_periodic_callback_init(&c, ZTIMER_MSEC, EVENT_PRIO_MEDIUM, _event_cb, "event C");
event_periodic_callback_set_count(&a, 6);
event_periodic_callback_set_count(&b, 3);
event_periodic_callback_set_count(&c, 2);
event_periodic_callback_start(&a, 502);
event_periodic_callback_start(&b, 1001);
event_periodic_callback_start(&c, 1500);
ztimer_sleep(ZTIMER_MSEC, 3020);
return 0;
}