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  */
28 #ifndef TRICKLE_H
29 #define TRICKLE_H
31 #ifdef __cplusplus
32  extern "C" {
33 #endif
35 #include "xtimer.h"
36 #include "thread.h"
41 typedef struct {
42  void (*func)(void *);
43  void *args;
49 typedef 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;
74 void trickle_reset_timer(trickle_t *trickle);
89 void trickle_start(kernel_pid_t pid, trickle_t *trickle, uint16_t msg_type,
90  uint32_t Imin, uint8_t Imax, uint8_t k);
97 void trickle_stop(trickle_t *trickle);
104 void trickle_increment_counter(trickle_t *trickle);
113 void trickle_interval(trickle_t *trickle);
120 void trickle_callback(trickle_t *trickle);
122 #ifdef __cplusplus
123 }
124 #endif
126 #endif /* TRICKLE_H */
xtimer_t msg_timer
xtimer to send a msg_t to the target thread for a new interval
Definition: trickle.h:62
int16_t kernel_pid_t
Unique process identifier.
Definition: kernel_types.h:83
uint32_t Imin
minimum interval size in ms
Definition: trickle.h:54
all state variables of a trickle timer
Definition: trickle.h:49
void trickle_reset_timer(trickle_t *trickle)
resets the trickle timer
void trickle_increment_counter(trickle_t *trickle)
increments the counter by one
void trickle_stop(trickle_t *trickle)
stops the trickle timer
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
void * args
callback function arguments
Definition: trickle.h:43
Threading API.
Trickle callback function with arguments.
Definition: trickle.h:41
trickle_callback_t callback
callback function and parameter that trickle calls after each interval
Definition: trickle.h:59
xtimer interface definitions
Describes a message object which can be sent between threads.
Definition: msg.h:184
void trickle_interval(trickle_t *trickle)
is called after the interval is over and calculates the next interval
uint32_t t
time within the current interval in ms
Definition: trickle.h:56
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
xtimer timer structure
Definition: xtimer.h:70
kernel_pid_t pid
pid of trickles target thread
Definition: trickle.h:58
uint16_t c
Definition: trickle.h:53
uint32_t I
current interval size in ms
Definition: trickle.h:55
msg_t msg
the msg_t to use for intervals
Definition: trickle.h:61
void trickle_callback(trickle_t *trickle)
is called after the interval is over and executes callback function