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
12#pragma once
13
29
30#ifdef __cplusplus
31 extern "C" {
32#endif
33
34#include "thread.h"
35#include "ztimer.h"
36
40typedef struct {
41 void (*func)(void *);
42 void *args;
44
48typedef struct {
49 uint8_t k;
50 uint8_t Imax;
52 uint16_t c;
53 uint32_t Imin;
54 uint32_t I;
55 uint32_t t;
63} trickle_t;
64
74
88void trickle_start(kernel_pid_t pid, trickle_t *trickle, uint16_t msg_type,
89 uint32_t Imin, uint8_t Imax, uint8_t k);
90
96void trickle_stop(trickle_t *trickle);
97
104
113
120
121#ifdef __cplusplus
122}
123#endif
124
int16_t kernel_pid_t
Unique process identifier.
Definition sched.h:138
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:195
Trickle callback function with arguments.
Definition trickle.h:40
void * args
callback function arguments
Definition trickle.h:42
void(* func)(void *)
callback function pointer
Definition trickle.h:41
all state variables of a trickle timer
Definition trickle.h:48
uint32_t t
time within the current interval in ms
Definition trickle.h:55
msg_t msg
the msg_t to use for intervals
Definition trickle.h:60
uint32_t Imin
minimum interval size in ms
Definition trickle.h:53
uint8_t k
redundancy constant
Definition trickle.h:49
uint8_t Imax
maximum interval size, described as of Imin doublings in ms
Definition trickle.h:50
uint32_t I
current interval size in ms
Definition trickle.h:54
ztimer_t msg_timer
timer to send a msg_t to the target thread for a new interval
Definition trickle.h:61
trickle_callback_t callback
callback function and parameter that trickle calls after each interval
Definition trickle.h:58
kernel_pid_t pid
pid of trickles target thread
Definition trickle.h:57
uint16_t c
counter
Definition trickle.h:52
ztimer structure
Definition ztimer.h:319
ztimer API