Interface: moteiv.tos.lib.timer.Alarm
interface Alarm<typedef precision_tag, typedef size_type>
An Alarm is a low-level interface intended for precise timing.
An Alarm 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.
An Alarm'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 an Alarm parameter.
See TEP102 for more details.
- Parameters:
-
precision_tag
- A type indicating the precision of this Alarm.
-
size_type
- An integer type representing time values for this Alarm.
- Author:
-
Cory Sharp <cssharp@eecs.berkeley.edu>
Commands
command size_type getAlarm()
command size_type getNow()
command bool isRunning()
command void start(size_type dt)
command void startAt(size_type t0, size_type dt)
command void stop()
Events
event void fired()
Commands - Details
getAlarm
command size_type getAlarm()
- Returns:
-
Alarm time.
getNow
command size_type getNow()
- Returns:
-
Current time.
isRunning
command bool isRunning()
- Returns:
-
TRUE if the alarm is still running.
start
command void start(size_type dt)
- Parameters:
-
dt
- Time until the alarm fires.
startAt
command void startAt(size_type t0, size_type dt)
- Parameters:
-
t0
- Base time for alarm.
-
dt
- Alarm time as offset from t0.
stop
command void stop()
Events - Details
fired
event void fired()