rfLPC
A low level library for using NXP's LPC17xx SoC. Config is given for MBED prototyping board
timer.h File Reference

TIMER0/1/2/3 device driver. More...

#include "../nxp/LPC17xx.h"
#include "../clock.h"
#include "../tools.h"
#include "../interrupt.h"

Go to the source code of this file.

Enumerations

enum  rflpc_timer_t {
  RFLPC_TIMER0,
  RFLPC_TIMER1,
  RFLPC_TIMER2,
  RFLPC_TIMER3,
  RFLPC_TIMER_PWM
}
 Value to use for the timer value in functions. More...
 
enum  rflpc_timer_match_t {
  RFLPC_TIMER_MATCH0,
  RFLPC_TIMER_MATCH1,
  RFLPC_TIMER_MATCH2,
  RFLPC_TIMER_MATCH3
}
 Match registers for interrupt generation. More...
 
enum  {
  RFLPC_TIMER_IRQ_ON_MATCH = 1,
  RFLPC_TIMER_RESET_ON_MATCH = 2,
  RFLPC_TIMER_STOP_ON_MATCH = 4
}
 Options for interrupt generation. More...
 

Functions

void rflpc_timer_enable (rflpc_timer_t timer)
 Power and clock the given timer. More...
 
void rflpc_timer_disable (rflpc_timer_t timer)
 disable the given timer More...
 
int rflpc_timer_running (rflpc_timer_t timer)
 Query the running state of the timer. More...
 
void rflpc_timer_set_clock (rflpc_timer_t timer, rflpc_clock_divider_t divider)
 Sets the cpu clock divider for a given timer. More...
 
void rflpc_timer_set_callback (rflpc_timer_t timer, rflpc_irq_handler_t callback)
 Sets the timer interrupt callback. More...
 
void rflpc_timer_start (rflpc_timer_t timer)
 starts the given timer. More...
 
void rflpc_timer_stop (rflpc_timer_t timer)
 Stops the timer. More...
 
void rflpc_timer_reset (rflpc_timer_t timer)
 Resets the timer. More...
 
uint32_t rflpc_timer_get_counter (rflpc_timer_t timer)
 Returns the timer counter value. More...
 
uint32_t rflpc_timer_get_pre_scale_counter (rflpc_timer_t timer)
 Returns the prescale counter value. More...
 
uint32_t rflpc_timer_get_pre_scale_register (rflpc_timer_t timer)
 Returns the value of the prescale register. More...
 
void rflpc_timer_set_counter (rflpc_timer_t timer, uint32_t value)
 Sets the timer counter value. More...
 
void rflpc_timer_set_pre_scale_counter (rflpc_timer_t timer, uint32_t value)
 Sets the prescale counter value. More...
 
void rflpc_timer_set_pre_scale_register (rflpc_timer_t timer, uint32_t value)
 Sets the value of the prescale register. More...
 
void rflpc_timer_set_match_value (rflpc_timer_t timer, rflpc_timer_match_t match_register, uint32_t match_value)
 Set the match register value for a given timer. More...
 
void rflpc_timer_set_irq_on_match (rflpc_timer_t timer, rflpc_timer_match_t match_register, uint32_t options)
 Enable IRQ generation when the timer counter reaches the value of a match register. More...
 
void rflpc_timer_reset_irq (rflpc_timer_t timer, rflpc_timer_match_t match_register)
 Reset the irq for a given match register. More...
 
int rflpc_timer_test_irq (rflpc_timer_t timer, rflpc_timer_match_t match_register)
 Check if an interrupt has been generated for a given match register. More...
 

Detailed Description

TIMER0/1/2/3 device driver.

Definition in file timer.h.