periodic.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2020 Kaspar Schleiser <kaspar@schleiser.de>
3  * SPDX-FileCopyrightText: 2020 Freie Universität Berlin
4  * SPDX-FileCopyrightText: 2020 Inria
5  * SPDX-License-Identifier: LGPL-2.1-only
6  */
7 
8 #pragma once
9 
69 #include <stdbool.h>
70 #include <stdint.h>
71 
72 #include "ztimer.h"
73 
74 #ifdef __cplusplus
75 extern "C" {
76 #endif
77 
81 #define ZTIMER_PERIODIC_KEEP_GOING true
82 
86 typedef bool (*ztimer_periodic_callback_t)(void *);
87 
91 typedef struct {
94  uint32_t interval;
97  void *arg;
99 
114  bool (*callback)(void *),
115  void *arg, uint32_t interval);
116 
129 
142 
151 
152 #ifdef __cplusplus
153 }
154 #endif
155 
uint32_t ztimer_now_t
type for ztimer_now() result
Definition: ztimer.h:308
ztimer device structure
Definition: ztimer.h:367
ztimer periodic structure
Definition: periodic.h:91
ztimer_clock_t * clock
clock for this timer
Definition: periodic.h:93
ztimer_periodic_callback_t callback
called on each trigger
Definition: periodic.h:96
void * arg
argument for callback
Definition: periodic.h:97
ztimer_now_t last
last trigger time
Definition: periodic.h:95
uint32_t interval
interval of this timer
Definition: periodic.h:94
ztimer_t timer
timer object used for this timer
Definition: periodic.h:92
ztimer structure
Definition: ztimer.h:316
bool(* ztimer_periodic_callback_t)(void *)
Type of callbacks in periodic timers.
Definition: periodic.h:86
void ztimer_periodic_stop(ztimer_periodic_t *timer)
Stop a periodic timer.
void ztimer_periodic_start_now(ztimer_periodic_t *timer)
Start or restart a periodic timer without initial timer delay.
void ztimer_periodic_start(ztimer_periodic_t *timer)
Start or restart a periodic timer.
void ztimer_periodic_init(ztimer_clock_t *clock, ztimer_periodic_t *timer, bool(*callback)(void *), void *arg, uint32_t interval)
Initialize a periodic timer structure.
ztimer API