Files | Functions | Variables

Implementation of the clock module for the CC26xx and CC13xx. More...


file  clock.c
 Software clock implementation for the TI CC13xx/CC26xx.


void clock_init (void)
 Initialize the clock library. More...
clock_time_t clock_time (void)
 Get the current clock time. More...
unsigned long clock_seconds (void)
 Get the current value of the platform seconds. More...
void clock_wait (clock_time_t i)
 Wait for a given number of ticks. More...
void clock_delay_usec (uint16_t len)
 Delay a given number of microseconds. More...
void clock_delay (unsigned int i)
 Obsolete delay function but we implement it here since some code still uses it.


static volatile uint64_t count
 Num. More...

Detailed Description

Implementation of the clock module for the CC26xx and CC13xx.

The software clock uses the facilities provided by the AON RTC driver

Function Documentation

◆ clock_delay_usec()

void clock_delay_usec ( uint16_t  dt)

Delay a given number of microseconds.

dtHow many microseconds to delay.
Interrupts could increase the delay by a variable amount.

Definition at line 158 of file clock.c.

◆ clock_init()

void clock_init ( void  )

Initialize the clock library.

This function initializes the clock library and should be called from the main() function of the system.

Initialize the clock library.

We initialise the SysTick to fire 128 interrupts per second, giving us a value of 128 for CLOCK_SECOND

We also initialise GPT0:Timer A, which is used by clock_delay_usec(). We use 16-bit range (individual), count-down, one-shot, no interrupts. The prescaler is computed according to the system clock in order to get 1 tick per usec.

Definition at line 64 of file clock.c.

References count.

◆ clock_seconds()

unsigned long clock_seconds ( void  )

Get the current value of the platform seconds.

This could be the number of seconds since startup, or since a standard epoch.

The value.

Definition at line 143 of file clock.c.

◆ clock_time()

clock_time_t clock_time ( void  )

Get the current clock time.

This function returns the current system clock time.

The current clock time, measured in system ticks.

Definition at line 125 of file clock.c.

◆ clock_wait()

void clock_wait ( clock_time_t  t)

Wait for a given number of ticks.

tHow many ticks.

Definition at line 149 of file clock.c.

Variable Documentation

◆ count

volatile uint64_t count


fractions in sub-second. Important to cast to 64-bit

Definition at line 50 of file clock.c.

Referenced by clock_init(), clock_time(), rpl_neighbor_count(), and servo_position().