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  */
23 #ifndef TRICKLE_H
24 #define TRICKLE_H
26 #ifdef __cplusplus
27  extern "C" {
28 #endif
30 #include "xtimer.h"
31 #include "thread.h"
37 typedef struct {
38  void (*func)(void *);
39  void *args;
43 typedef struct {
44  uint8_t k;
45  uint8_t Imax;
46  uint16_t c;
47  uint32_t Imin;
48  uint32_t I;
49  uint32_t t;
54  uint64_t msg_time;
57 } trickle_t;
67 void trickle_reset_timer(trickle_t *trickle);
82 void trickle_start(kernel_pid_t pid, trickle_t *trickle, uint16_t msg_type,
83  uint32_t Imin, uint8_t Imax, uint8_t k);
90 void trickle_stop(trickle_t *trickle);
106 void trickle_interval(trickle_t *trickle);
113 void trickle_callback(trickle_t *trickle);
115 #ifdef __cplusplus
116 }
117 #endif
119 #endif /* TRICKLE_H */
xtimer_t msg_timer
xtimer to send a msg_t to the target thread for a new interval
Definition: trickle.h:55
int16_t kernel_pid_t
Unique process identifier.
Definition: kernel_types.h:83
uint32_t Imin
minimum interval size
Definition: trickle.h:47
all state variables for a trickle timer
Definition: trickle.h:43
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:39
Threading API.
a generic callback function with arguments that is called by trickle periodically ...
Definition: trickle.h:37
trickle_callback_t callback
the callback function and parameter that trickle is calling after each interval
Definition: trickle.h:51
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
Definition: trickle.h:49
uint8_t k
redundancy constant
Definition: trickle.h:44
uint8_t Imax
maximum interval size, described as doublings
Definition: trickle.h:45
xtimer timer structure
Definition: xtimer.h:70
kernel_pid_t pid
pid of trickles target thread
Definition: trickle.h:50
uint16_t c
Definition: trickle.h:46
uint32_t I
current interval size
Definition: trickle.h:48
uint64_t msg_time
interval in ms
Definition: trickle.h:54
msg_t msg
the msg_t to use for intervals
Definition: trickle.h:53
void trickle_callback(trickle_t *trickle)
is called after the callback interval is over and calls the callback function