nRF51 SDK
|
Real Time Counter Example Application main file. More...
Macros | |
#define | GPIO_TOGGLE_TICK_EVENT (8) |
#define | GPIO_TOGGLE_COMPARE_EVENT (9) |
#define | LFCLK_FREQUENCY (32768UL) |
#define | RTC_FREQUENCY (8UL) |
#define | COMPARE_COUNTERTIME (3UL) |
#define | COUNTER_PRESCALER ((LFCLK_FREQUENCY/RTC_FREQUENCY) - 1) /* f = LFCLK/(prescaler + 1) */ |
Functions | |
static void | lfclk_config (void) |
Function starting the internal LFCLK XTAL oscillator. | |
static void | rtc_config (void) |
Function for configuring the RTC with TICK to 100Hz and COMPARE0 to 10 sec. | |
static void | gpio_config (void) |
Function for Configuring PIN8 and PIN9 as outputs. | |
void | RTC0_IRQHandler () |
: Function for handling the RTC0 interrupts. Triggered on TICK and COMPARE0 match. | |
int | main (void) |
Function for application main entry. | |
This file contains the source code for a sample application using the Real Time Counter (RTC).
#define GPIO_TOGGLE_TICK_EVENT (8) |
Pin number to toggle when there is a tick event in RTC.
#define GPIO_TOGGLE_COMPARE_EVENT (9) |
Pin number to toggle when there is compare event in RTC.
#define LFCLK_FREQUENCY (32768UL) |
LFCLK frequency in Hertz, constant.
#define RTC_FREQUENCY (8UL) |
Required RTC working clock RTC_FREQUENCY Hertz. Changable.
#define COMPARE_COUNTERTIME (3UL) |
Get Compare event COMPARE_TIME seconds after the counter starts from 0.