lpc_timers.c File Reference
#include "lpc_timers.h"
#include "LPC17xx.h"
#include "lpc_sys.h"
Include dependency graph for lpc_timers.c:

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, uint32_t value)
 

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.