SZS ez430-RF2480 1.0

ZigBee Sensor Network with synchronized time and time-stamped measurements.
clock.c File Reference

Clock implementation. More...

#include <msp430f2274.h>
#include "clock.h"
#include "im.h"
+ Include dependency graph for clock.c:

Go to the source code of this file.

Macros

#define CLOCK_DEFAULT_TICK_SIZE   250000
 Default tick size (ns) this may be changed as needed by the application.
 
#define CLOCK_TICK_SIZE_MAX   500000
 Maximum value that tick size can be adjusted to (ns).
 
#define CLOCK_NS_IN_ONE_S   1000000000
 Alias to avoid mistyping.
 
#define CLOCK_FLAGADJUSTING   1
 Flag bit to indicate that clock is adjusting.
 
#define CLOCK_FLAGCALLTICK   2
 Flag bit to schedule a delayed tick advance.
 
#define CLOCK_GETADJUSTING   clock_runningFlags & CLOCK_FLAGADJUSTING
 Macro to test if clock is adjusting.
 
#define CLOCK_SETADJUSTING   clock_runningFlags |= CLOCK_FLAGADJUSTING
 Macro to set adjusting flag.
 
#define CLOCK_CLEARADJUSTING   clock_runningFlags &= ~CLOCK_FLAGADJUSTING
 Macro to clear adjusting flag.
 
#define CLOCK_GETCALLTICK   clock_runningFlags & CLOCK_FLAGCALLTICK
 Macro to test if clock delayed tick is set.
 
#define CLOCK_SETCALLTICK   clock_runningFlags |= CLOCK_FLAGCALLTICK
 Macro to set delayed tick flag.
 
#define CLOCK_CLEARCALLTICK   clock_runningFlags &= ~CLOCK_FLAGCALLTICK
 Macro to clear delayed tick flag.
 

Functions

void clock_init ()
 Clock Initialization. More...
 
void clock_tick ()
 Clock tick. More...
 
void clock_checkDelayedTick ()
 Check delayed tick. More...
 
void clock_getTime (clock_timeStamp *destTime)
 Get time. More...
 
void clock_setTime (clock_timeStamp *sourceTime)
 Set time. More...
 
void clock_adjTime (int64_t *adjValue)
 Adjust time. More...
 
void clock_adjTimeValues (int64_t *adjValue, clock_timeStamp *time)
 Adjust time values. More...
 
void clock_adjTick (Int32 adjValue)
 Adjust tick. More...
 
int64_t clock_timeDiff (clock_timeStamp *t1, clock_timeStamp *t2)
 Time difference. More...
 

Variables

UInt32 clock_tickSize
 Tick size (ns) More...
 
clock_timeStamp clock_time
 Clock time.
 
UInt8 clock_runningFlags
 Flags for internal use.
 
UInt16 clock_ticksSinceSint
 Ticks since Sintonization. More...
 
int64_t clock_adjSumSinceSint
 Adjust sum since Sintonization. More...
 

Detailed Description

Clock implementation.

Definition in file clock.c.

Variable Documentation

int64_t clock_adjSumSinceSint

Adjust sum since Sintonization.

Sum of values of all adjusts since last sintonization. Used to sintonize (tune) the clock.

Definition at line 132 of file clock.c.

Referenced by clock_adjTime(), and clock_init().

UInt16 clock_ticksSinceSint

Ticks since Sintonization.

Tick count since last sintonization. Used to sintonize (tune) the clock.

Definition at line 124 of file clock.c.

Referenced by clock_adjTime(), clock_init(), and clock_tick().