Interface: moteiv.tos.lib.timer.Counter

interface Counter<typedef precision_tag, typedef size_type>

A Counter counts time in some units and in some width, signaling overflow.

A Counter is parameterised by its "precision" (milliseconds, microseconds, etc), identified by a type. This prevents, e.g., unintentionally mixing components expecting milliseconds with those expecting microseconds as those interfaces have a different type.

A Counter's second parameter is its "width", i.e., the number of bits used to represent time values. Width is indicated by including the appropriate size integer type as a Counter parameter.

See TEP102 for more details.

Parameters:
precision_tag - A type indicating the precision of this Counter.
size_type - An integer type representing time values for this Counter.
Author:
Cory Sharp <cssharp@eecs.berkeley.edu>

Commands
command void clearOverflow() Cancel a pending overflow interrupt.
command size_type get() Return counter value.
command bool isOverflowPending() Return TRUE if an overflow event will occur after the outermost atomic block is exits.

Events
event void overflow() Signals that the current time has overflowed.

Commands - Details

clearOverflow

command void clearOverflow()

Cancel a pending overflow interrupt.

get

command size_type get()

Return counter value. Counters start at boot - some time sources may stop counting while the processor is in low-power mode.

Returns:
Current counter value.

isOverflowPending

command bool isOverflowPending()

Return TRUE if an overflow event will occur after the outermost atomic block is exits. FALSE otherwise.

Returns:
Counter pending overflow status.

Events - Details

overflow

event void overflow()

Signals that the current time has overflowed. That is, the current time has wrapped around from its maximum value to zero.