Contiki 2.6

System_timer

Functions that provide access to the system clock. More...

Functions

int16u halInternalStartSystemTimer (void)
 Initializes the system tick.
int16u halCommonGetInt16uMillisecondTick (void)
 Returns the current system time in system ticks, as a 16-bit value.
int32u halCommonGetInt32uMillisecondTick (void)
 Returns the current system time in system ticks, as a 32-bit value.
int16u halCommonGetInt16uQuarterSecondTick (void)
 Returns the current system time in quarter second ticks, as a 16-bit value.

Detailed Description

Functions that provide access to the system clock.

A single system tick (as returned by halCommonGetInt16uMillisecondTick() and halCommonGetInt32uMillisecondTick() ) is approximately 1 millisecond.

A single quarter-second tick (as returned by halCommonGetInt16uQuarterSecondTick() ) is approximately 0.25 seconds.

The values used by the time support functions will wrap after an interval. The length of the interval depends on the length of the tick and the number of bits in the value. However, there is no issue when comparing time deltas of less than half this interval with a subtraction, if all data types are the same.

See system-timer.h for source code.


Function Documentation

int16u halCommonGetInt16uMillisecondTick ( void  )

Returns the current system time in system ticks, as a 16-bit value.

Returns:
The least significant 16 bits of the current system time, in system ticks.

Returns the current system time in system ticks, as a 16-bit value.

With 1024 clock ticks per second, a single clock tick occurs every 0.9769625 milliseconds, and a rollover of the 16-bit timer occurs every 64 seconds.

Definition at line 35 of file system-timer.c.

References halCommonGetInt32uMillisecondTick().

int16u halCommonGetInt16uQuarterSecondTick ( void  )

Returns the current system time in quarter second ticks, as a 16-bit value.

Returns:
The least significant 16 bits of the current system time, in system ticks multiplied by 256.

Definition at line 40 of file system-timer.c.

References halCommonGetInt32uMillisecondTick().

int32u halCommonGetInt32uMillisecondTick ( void  )

Returns the current system time in system ticks, as a 32-bit value.

Returns:
The least significant 32 bits of the current system time, in system ticks.

Returns the current system time in system ticks, as a 32-bit value.

With 1024 clock ticks per second, a single clock tick occurs every 0.9769625 milliseconds, and a rollover of the 32-bit timer occurs approximately every 48.5 days.

Definition at line 50 of file system-timer.c.

Referenced by halCommonGetInt16uMillisecondTick(), and halCommonGetInt16uQuarterSecondTick().

int16u halInternalStartSystemTimer ( void  )

Initializes the system tick.

Returns:
Time to update the async registers after RTC is started (units of 100 microseconds).

ENABLE_OSC32K

Definition at line 74 of file micro-common.c.

References halInternalCalibrateSlowRc().

Referenced by halInit().