Interface: moteiv.tos.lib.timer.Timer2
interface Timer2<typedef precision_tag>
A Timer is TinyOS's general purpose timing interface. For more precise
timing, you may wish to use a (platform-specific) component offering
an Alarm interface.
A Timer 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.
See TEP102 for more details.
- Parameters:
-
precision_tag
- A type indicating the precision of this Alarm.
- Author:
-
Cory Sharp, Moteiv Corporation <info@moteiv.com>
Commands
command uint32_t getdt()
command uint32_t getNow()
command uint32_t gett0()
command bool isOneShot()
command bool isRunning()
command void startOneShot(uint32_t dt)
command void startOneShotAt(uint32_t t0, uint32_t dt)
command void startPeriodic(uint32_t dt)
command void startPeriodicAt(uint32_t t0, uint32_t dt)
command void stop()
Events
event void fired()
Commands - Details
getdt
command uint32_t getdt()
- Returns:
-
Timer's interval.
getNow
command uint32_t getNow()
- Returns:
-
Current time.
gett0
command uint32_t gett0()
- Returns:
-
Timer's base time.
isOneShot
command bool isOneShot()
- Returns:
-
TRUE for one-shot timers, FALSE for periodic timers.
isRunning
command bool isRunning()
- Returns:
-
TRUE if the timer is still running.
startOneShot
command void startOneShot(uint32_t dt)
- Parameters:
-
dt
- Time until the timer fires.
startOneShotAt
command void startOneShotAt(uint32_t t0, uint32_t dt)
- Parameters:
-
t0
- Base time for timer.
-
dt
- Time until the timer fires.
startPeriodic
command void startPeriodic(uint32_t dt)
- Parameters:
-
dt
- Time until the timer fires.
startPeriodicAt
command void startPeriodicAt(uint32_t t0, uint32_t dt)
- Parameters:
-
t0
- Base time for timer.
-
dt
- Time until the timer fires.
stop
command void stop()
Events - Details
fired
event void fired()