Apps     Components     Interfaces     All Files     Source Tree     source: tos.interfaces.Clock.nc

Interface: Clock

The hardware clock interface.

Components providing this interface:
tos.platform.mica.HPLClock
tos.system.ClockC

Components requiring this interface:
tos.system.TimerM

Commands

Events

Commands - Details

setRate

result_t setRate(char interval, char scale)

Set the clock rate. For the specific meanings of interval and scale, refer to the processor data sheet. For the mica and rene:

     Clock scale
         0 - off
         1 - 32768 ticks/second
         2 - 4096 ticks/second
         3 - 1024 ticks/second
         4 - 512 ticks/second
         5 - 256 ticks/second
         6 - 128 ticks/second
         7 - 32 ticks/second
 

Interval is how many ticks per clock firing. For example, setRate(160,7) will result in an event every 160/32 seconds. See also: Clock.h for predefined macros:

  interval      scale         result
  TOS_I1000PS   TOS_S1000PS   1000 ticks/sec
  TOS_I100PS    TOS_S100PS     100 ticks/sec
  TOS_I10PS     TOS_S10PS       10 ticks/sec
  TOS_I4096PS   TOS_S4096PS   4096 ticks/sec
  TOS_I2048PS   TOS_S2048PS   2048 ticks/sec
  TOS_I1024PS   TOS_S1024PS   1024 ticks/sec
  TOS_I512PS    TOS_S512PS     512 ticks/sec
  TOS_I256PS    TOS_S256PS     256 ticks/sec
  TOS_I128PS    TOS_S128PS     128 ticks/sec
  TOS_I64PS     TOS_S64PS       64 ticks/sec
  TOS_I32PS     TOS_S32PS       32 ticks/sec
  TOS_I16PS     TOS_S16PS       16 ticks/sec
  TOS_I8PS      TOS_S8PS         8 ticks/sec
  TOS_I4PS      TOS_S4PS         4 ticks/sec
  TOS_I2PS      TOS_S2PS         2 ticks/sec
  TOS_I1PS      TOS_S1PS         1 tick/sec
  TOS_I0PS      TOS_S0PS         0 ticks/sec (clock off)