lpc_timers.h File Reference
#include <stdint.h>
#include "LPC17xx.h"
Include dependency graph for lpc_timers.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  lpc_timer_t { lpc_timer0, lpc_timer1, lpc_timer2, lpc_timer3 }
 

Functions

void lpc_timer_enable (const lpc_timer_t timer, const uint32_t us_per_tick)
 
uint32_t lpc_timer_get_value (const lpc_timer_t timer)
 
void lpc_timer_set_value (const lpc_timer_t timer, const uint32_t value)
 

Detailed Description

This API provides a means to start a simple timer, and get/set the timer value 20140610: Initial

Enumeration Type Documentation

The type of timers supported by LPC17xx Note that for the SJ-One project, lpc_timer1 is being used by lpc_sys.c to carry out several background services and capture IR receiver signals.

Enumerator
lpc_timer0 
lpc_timer1 
lpc_timer2 
lpc_timer3 

Function Documentation

void lpc_timer_enable ( const lpc_timer_t  timer,
const uint32_t  us_per_tick 
)

Enables and starts the timer with the given tick rate

Parameters
[in]timerThe timer type
[in]us_per_tickThe resolution of each tick
Note
The logic requires the CPU to be running at greater than or equal to 1Mhz
Postcondition
The timer's clock divider is set to (CPU clock)/1
uint32_t lpc_timer_get_value ( const lpc_timer_t  timer)

Get the value of the timer

Parameters
[in]timerThe timer type
Returns
The value of the timer
void lpc_timer_set_value ( const lpc_timer_t  timer,
const uint32_t  value 
)

Set the value of the timer; you normally shouldn't do this as the hardware is ticking the timer in the background but you can use it to reset it to zero.

Parameters
[in]timerThe timer type
[in]valueThe value to set.