mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
43 lines
1.0 KiB
C
43 lines
1.0 KiB
C
|
/*
|
||
|
* Copyright (C) 2021 Inria
|
||
|
*
|
||
|
* 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.
|
||
|
*/
|
||
|
|
||
|
/**
|
||
|
* @ingroup sys_event
|
||
|
* @{
|
||
|
*
|
||
|
* @file
|
||
|
* @brief Periodic Event Implementation
|
||
|
*
|
||
|
* @author Francisco Molina <francois-xavier.molina@inria.fr>
|
||
|
*
|
||
|
* @}
|
||
|
*/
|
||
|
#include "kernel_defines.h"
|
||
|
#include "ztimer.h"
|
||
|
#include "ztimer/periodic.h"
|
||
|
#include "event/periodic.h"
|
||
|
|
||
|
static int _event_periodic_callback(void *arg)
|
||
|
{
|
||
|
event_periodic_t *event_periodic = (event_periodic_t *)arg;
|
||
|
|
||
|
event_post(event_periodic->queue, event_periodic->event);
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
void event_periodic_init(event_periodic_t *event_periodic,
|
||
|
ztimer_clock_t *clock,
|
||
|
event_queue_t *queue, event_t *event)
|
||
|
{
|
||
|
ztimer_periodic_init(clock, &event_periodic->timer, _event_periodic_callback,
|
||
|
event_periodic, 0);
|
||
|
event_periodic->queue = queue;
|
||
|
event_periodic->event = event;
|
||
|
}
|