rfLPC
A low level library for using NXP's LPC17xx SoC. Config is given for MBED prototyping board
Repetitive Interrupt Timer

This timer provide a simple mean to get a repetitive interrupt. More...

Functions

static void rflpc_rit_enable ()
 Enables the RIT. More...
 
static uint32_t rflpc_rit_get_counter_value ()
 Gets the current value of the rit counter.
 
static void rflpc_rit_set_counter_value (uint32_t value)
 Sets the current value of the rit counter.
 
static void rflpc_rit_clear_pending_interrupt ()
 clears the pending interrupt. More...
 
void rflpc_rit_set_callback (uint32_t comp_value, uint32_t mask, int reset_on_match, rflpc_irq_handler_t c)
 sets the RIT interrupt callback and configure the RIT interrupt. More...
 

Detailed Description

This timer provide a simple mean to get a repetitive interrupt.

When the timer is started, it is incremented at each CPU clock tick and can be configured to generate an interruption when its counter matches a value/mask pair

Function Documentation

static void rflpc_rit_clear_pending_interrupt ( )
inlinestatic

clears the pending interrupt.

Should be called at the end of your callback to prevent the interruption to be generated again

Definition at line 58 of file rit.h.

static void rflpc_rit_enable ( )
inlinestatic

Enables the RIT.

By default, it is turned off. See PCONP register, user manual, p.63

Definition at line 45 of file rit.h.

void rflpc_rit_set_callback ( uint32_t  comp_value,
uint32_t  mask,
int  reset_on_match,
rflpc_irq_handler_t  c 
)

sets the RIT interrupt callback and configure the RIT interrupt.

The interrupt handler will be called when the counter value reaches value for the bits zeroed in the mask If reset on match is true, then when the counter match the comp_value, the counter is reset to 0

For example, if you want the timer to be called each time the 7th bit is equal to one:

  • comp_value should be set to 1 << 7
  • mask should be set to ~(1 << 7)