Trickle Timer

Implementation of a generic Trickle Algorithm (RFC 6206)

void trickle_reset_timer(trickle_t * trickle)

resets the trickle timer

Parameters

trickle:the trickle timer

void trickle_start(kernel_types.h::kernel_pid_t pid, trickle_t * trickle, uint16_t msg_type, uint32_t Imin, uint8_t Imax, uint8_t k)

start the trickle timer

Parameters

pid:target thread
trickle:trickle timer
msg_type:msg.h::msg_t::type for messages
Imin:minimum interval in ms
Imax:maximum interval in ms
k:redundancy constant

void trickle_stop(trickle_t * trickle)

stops the trickle timer

Parameters

trickle:trickle timer

void trickle_increment_counter(trickle_t * trickle)

increments the counter by one

Parameters

trickle:trickle timer

void trickle_interval(trickle_t * trickle)

is called after the interval is over and calculates the next interval

Parameters

trickle:trickle timer

void trickle_callback(trickle_t * trickle)

is called after the interval is over and executes callback function

Parameters

trickle:trickle timer

struct trickle_callback_t

Trickle callback function with arguments.

void(* func()

callback function pointer

void * args

callback function arguments

struct trickle_t

all state variables of a trickle timer

uint8_t k

redundancy constant

uint8_t Imax

maximum interval size, described as of Imin doublings in ms

uint16_t c

counter

uint32_t Imin

minimum interval size in ms

uint32_t I

current interval size in ms

uint32_t t

time within the current interval in ms

kernel_types.h::kernel_pid_t pid

pid of trickles target thread

trickle_callback_t callback

callback function and parameter that trickle calls after each interval

msg_t msg

the msg_t to use for intervals

xtimer.h::xtimer_t msg_timer

xtimer to send a msg_t to the target thread for a new interval