contiki-os/contiki — pull request #158 by g-oikonomou (2013-03-12 16:23:45+00:00)
Title: Trickle Timer Library (RFC 6206)

This adds a library for Trickle Timers. It handles resets, interval doublings and TX suppression internally and it (optionally) compensates for clock drift. Lastly, it takes into account the fact that some platforms use 16bit clocks and some others 32bit. So, for example, it checks if `Imin << Imax` would exceed our clock's boundaries. It can calculate the maximum Imax for a given Imin depending on the platform's clock etc. All those checks can be #defined off to reduce code size.

The idea is to make it easier for people to develop new trickle-based algorithms or protocols; they can focus on the networking aspect without having to worry about reading / interpreting / implementing trickle. It also gives us a single point of reference for optimisations, bug fixes etc, not to mention possible code/ram footprint savings when a single firmware image needs to implement multiple trickle-based mechanisms.

This has been tested on cc2530s and Sensinodes (16-bit clock_time_t) and in Cooja for Sky motes.