nRF51 SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages

Timer Example Application main file. More...

Macros

#define TIMER_DELAY_MS   (100UL)
 
#define GPIO_TOGGLE_PIN   (8)
 

Enumerations

enum  timer_t {
  TIMER0 = 0,
  TIMER1,
  TIMER2,
  TIMER0 = 0,
  TIMER1,
  TIMER2
}
 

Functions

static void nrf_timer_delay_ms (timer_t timer, uint_fast16_t volatile number_of_ms)
 Function for using the peripheral hardware timers to generate an event after requested number of milliseconds. More...
 
int main (void)
 Function for main application entry.
 
static volatile NRF_TIMER_Type * timer_init (timer_t timer)
 Function for timer initialization.
 

Detailed Description

This file contains the source code for a sample application using Timer0, Timer1 and Timer2.

example_board_setup_a.jpg
Use board setup A for this example.

Macro Definition Documentation

#define TIMER_DELAY_MS   (100UL)

Timer Delay in milli-seconds.

#define GPIO_TOGGLE_PIN   (8)

gpio pin to toggle after delay.

Enumeration Type Documentation

enum timer_t
Enumerator
TIMER0 

Timer 0 module, base address at 0x40008000.

TIMER1 

Timer 1 module, base address at 0x40009000.

TIMER2 

Timer 2 module, base address at 0x4000A000.

TIMER0 

Timer 0 module, base address at 0x40008000.

TIMER1 

Timer 1 module, base address at 0x40009000.

TIMER2 

Timer 2 module, base address at 0x4000A000.

Function Documentation

static void nrf_timer_delay_ms ( timer_t  timer,
uint_fast16_t volatile  number_of_ms 
)
static
Parameters
[in]timerTimer to be used for delay, values from p_timer
[in]number_of_msNumber of milliseconds the timer will count.
Note
This function will power ON the requested timer, wait until the delay, and then power OFF that timer.