Loading...
Searching...
No Matches
trickle.h
Go to the documentation of this file.
1/*
2 * Trickle constants and prototypes
3 *
4 * Copyright (C) 2013, 2014 INRIA.
5 * 2017 HAW Hamburg
6 *
7 * This file is subject to the terms and conditions of the GNU Lesser
8 * General Public License v2.1. See the file LICENSE in the top level
9 * directory for more details.
10 */
11
28#ifndef TRICKLE_H
29#define TRICKLE_H
30
31#ifdef __cplusplus
32 extern "C" {
33#endif
34
35#include "thread.h"
36#include "ztimer.h"
37
41typedef struct {
42 void (*func)(void *);
43 void *args;
45
49typedef struct {
50 uint8_t k;
51 uint8_t Imax;
53 uint16_t c;
54 uint32_t Imin;
55 uint32_t I;
56 uint32_t t;
64} trickle_t;
65
75
89void trickle_start(kernel_pid_t pid, trickle_t *trickle, uint16_t msg_type,
90 uint32_t Imin, uint8_t Imax, uint8_t k);
91
97void trickle_stop(trickle_t *trickle);
98
105
114
121
122#ifdef __cplusplus
123}
124#endif
125
126#endif /* TRICKLE_H */
int16_t kernel_pid_t
Unique process identifier.
Definition sched.h:139
void trickle_increment_counter(trickle_t *trickle)
increments the counter by one
void trickle_stop(trickle_t *trickle)
stops the trickle timer
void trickle_callback(trickle_t *trickle)
is called after the interval is over and executes callback function
void trickle_reset_timer(trickle_t *trickle)
resets the trickle timer
void trickle_interval(trickle_t *trickle)
is called after the interval is over and calculates the next interval
void trickle_start(kernel_pid_t pid, trickle_t *trickle, uint16_t msg_type, uint32_t Imin, uint8_t Imax, uint8_t k)
start the trickle timer
Describes a message object which can be sent between threads.
Definition msg.h:196
Trickle callback function with arguments.
Definition trickle.h:41
void * args
callback function arguments
Definition trickle.h:43
all state variables of a trickle timer
Definition trickle.h:49
uint32_t t
time within the current interval in ms
Definition trickle.h:56
msg_t msg
the msg_t to use for intervals
Definition trickle.h:61
uint32_t Imin
minimum interval size in ms
Definition trickle.h:54
uint8_t k
redundancy constant
Definition trickle.h:50
uint8_t Imax
maximum interval size, described as of Imin doublings in ms
Definition trickle.h:51
uint32_t I
current interval size in ms
Definition trickle.h:55
ztimer_t msg_timer
timer to send a msg_t to the target thread for a new interval
Definition trickle.h:62
trickle_callback_t callback
callback function and parameter that trickle calls after each interval
Definition trickle.h:59
kernel_pid_t pid
pid of trickles target thread
Definition trickle.h:58
uint16_t c
counter
Definition trickle.h:53
ztimer structure
Definition ztimer.h:318
ztimer API