Microchip® Advanced Software Framework

trickle_timer Struct Reference

A trickle timer.

This structure is used for declaring a trickle timer. In order for the timer to start running, the protocol must first populate the structure's fields by calling trickle_timer_set(). Protocol implementations must NOT modify the contents of this structure directly.

Protocol developers must also be careful to specify the values of Imin and Imax in such a way that the maximum interval size does not exceed the boundaries of clock_time_t

#include <trickle-timer.h>

Data Fields

uint8_t c
 c: Consistency Counter More...
 
trickle_timer_cb_t cb
 Protocol's own callback, invoked at time t within the current interval. More...
 
void * cb_arg
 Opaque pointer to be used as the argument of the protocol's callback. More...
 
struct ctimer ct
 A Callback timer used internally. More...
 
clock_time_t i_cur
 I: Current interval in clock_ticks. More...
 
uint8_t i_max
 Imax: Max number of doublings. More...
 
clock_time_t i_max_abs
 Maximum interval size in clock ticks (and not in number of doublings). More...
 
clock_time_t i_min
 Imin: Clock ticks. More...
 
clock_time_t i_start
 Start of this interval (absolute clock_time) More...
 
uint8_t k
 k: Redundancy Constant More...
 

uint8_t trickle_timer::c

c: Consistency Counter

Referenced by double_interval(), fire(), new_interval(), and trickle_timer_consistency().

trickle_timer_cb_t trickle_timer::cb

Protocol's own callback, invoked at time t within the current interval.

Referenced by fire(), and trickle_timer_set().

void* trickle_timer::cb_arg

Opaque pointer to be used as the argument of the protocol's callback.

Referenced by fire(), and trickle_timer_set().

struct ctimer trickle_timer::ct
clock_time_t trickle_timer::i_cur

I: Current interval in clock_ticks.

Referenced by double_interval(), get_t(), new_interval(), trickle_timer_inconsistency(), and trickle_timer_set().

uint8_t trickle_timer::i_max

Imax: Max number of doublings.

Referenced by trickle_timer_config().

clock_time_t trickle_timer::i_max_abs

Maximum interval size in clock ticks (and not in number of doublings).

This is a cached value of Imin << Imax used internally, so that we can have direct access to the maximum interval size without having to calculate it all the time

Referenced by trickle_timer_config().

clock_time_t trickle_timer::i_min
clock_time_t trickle_timer::i_start

Start of this interval (absolute clock_time)

Referenced by double_interval(), new_interval(), and trickle_timer_set().

uint8_t trickle_timer::k

k: Redundancy Constant

Referenced by fire(), and trickle_timer_config().