|
Contiki 3.x
|
Files | |
| file | clock.c |
| Software clock implementation for the nRF52. | |
Functions | |
| static void | rtc_handler (nrf_drv_rtc_int_type_t int_type) |
| Function for handling the RTC0 interrupts. More... | |
| static void | lfclk_config (void) |
| Function starting the internal LFCLK XTAL oscillator. | |
| static void | rtc_config (void) |
| Function initialization and configuration of RTC driver instance. | |
| void | clock_init (void) |
| Initialize the clock library. More... | |
| CCIF clock_time_t | clock_time (void) |
| Get the current clock time. More... | |
| CCIF 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 dt) |
| 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. More... | |
Variables | |
| const nrf_drv_rtc_t | rtc = NRF_DRV_RTC_INSTANCE(PLATFORM_RTC_INSTANCE_ID) |
| RTC instance used for platform clock. | |
| void clock_delay | ( | unsigned int | i | ) |
Obsolete delay function but we implement it here since some code still uses it.
Obsolete delay function but we implement it here since some code still uses it.
Definition at line 162 of file clock.c.
References clock_delay_usec().
| void clock_delay_usec | ( | uint16_t | dt | ) |
| 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.
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 111 of file clock.c.
References lfclk_config(), and rtc_config().
| CCIF 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.
Get the current value of the platform seconds.
The comparison avoids the need to disable clock interrupts for an atomic read of the four-byte variable.
| CCIF clock_time_t clock_time | ( | void | ) |
Get the current clock time.
This function returns the current system clock time.
Get the current clock time.
When 16 bit it typically wraps every 10 minutes. The comparison avoids the need to disable clock interrupts for an atomic read of the multi-byte variable.
| void clock_wait | ( | clock_time_t | t | ) |
Wait for a given number of ticks.
| t | How many ticks. |
Definition at line 142 of file clock.c.
References clock_time(), and start().
|
static |
Function for handling the RTC0 interrupts.
| int_type | Type of interrupt to be handled |
Definition at line 71 of file clock.c.
Referenced by rtc_config().
1.8.6