Interface: tos.interfaces.Timer
interface Timer
This interface provides a generic timer that can be used to generate
events at regular intervals.
- Author:
-
Su Ping
-
Sam Madden
-
David Gay
- Modified:
-
7/16/02
Commands
command result_t start(char type, uint32_t interval)
command result_t stop()
Events
event result_t fired()
Commands - Details
start
command result_t start(char type, uint32_t interval)
- Parameters:
-
type
- The type of timer to start. Valid values include
'TIMER_REPEAT' for a timer that fires repeatedly, or
'TIMER_ONE_SHOT' for a timer that fires once.
-
interval
- The timer interval in binary milliseconds (1/1024
second). Note that the
timer cannot support an arbitrary range of intervals.
(Unfortunately this interface does not specify the valid range
of timer intervals, which are specific to a platform.)
- Returns:
-
Returns SUCCESS if the timer could be started with the
given type and interval. Returns FAIL if the type is not
one of TIMER_REPEAT or TIMER_ONE_SHOT, if the timer rate is
too high, or if there are too many timers currently active.
stop
command result_t stop()
- Returns:
-
SUCCESS if the timer could be stopped, or FAIL if the timer
is not running or the timer ID is out of range.
Events - Details
fired
event result_t fired()