Wixel SDK
Functions
time.h File Reference
#include <cc2511_map.h>

Go to the source code of this file.

Functions

void timeInit ()
 
uint32 getMs ()
 
 ISR (T4, 0)
 
void delayMicroseconds (uint8 microseconds)
 
void delayMs (uint16 milliseconds)
 

Detailed Description

This module helps you keep track of time in milliseconds. Calling timeInit() sets up a timer (Timer 4) to overflow every millisecond (approximately). You can read the time at any time by calling getMs(). For the interrupt to work, you must write

include <time.h>

or

include <wixel.h>

in the source file that contains your main() function. Also, you must call boardClockInit() or else the timing will be wrong.

Both boardClockInit() and timeInit() are called from systemInit(), so you can simply call systemInit() to initialize everything.

Definition in file time.h.

Function Documentation

void delayMicroseconds ( uint8  microseconds)
Parameters
microsecondsThe number of microseconds delay; any value between 0 and 255.

This function delays for the specified number of microseconds using a simple loop. If an interrupt occurs during this function, the delay will be longer than specified.

void delayMs ( uint16  milliseconds)
Parameters
millisecondsThe number of milliseconds delay; any value between 0 and 65535.

This function delays for the specified number of milliseconds using a simple loop. If an interrupt occurs during this function, the delay will be slightly longer than specified.

Definition at line 43 of file time.c.

uint32 getMs ( )

Returns the number of milliseconds that have elapsed since timeInit() was called.

Definition at line 19 of file time.c.

ISR ( T4  ,
 
)

This interrupt fires once per millisecond (approximately) and increments timeMs.

Definition at line 13 of file time.c.

void timeInit ( )

Initializes the library. This sets up Timer 4 to tick (approximately) every millisecond and enables the Timer 4 interrupt. Note that you will also have to call boardClockInit() or systemInit(), to get the system clock running at the right speed, otherwise the millisecond timing will be off by a large factor.

This function is called by systemInit().

Definition at line 29 of file time.c.