rfLPC
A low level library for using NXP's LPC17xx SoC. Config is given for MBED prototyping board
rit.h
Go to the documentation of this file.
1 /* This file is part of rflpc. Copyright 2010-2011 Michael Hauspie
2  *
3  * rflpc is free software: you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation, either version 3 of the License, or
6  * (at your option) any later version.
7  *
8  * rflpc is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with rflpc. If not, see <http://www.gnu.org/licenses/>.
15  */
19 /*
20  Author: Michael Hauspie <michael.hauspie@univ-lille1.fr>
21  Created:
22  Time-stamp: <2012-03-21 09:21:01 (hauspie)>
23 
24  This files defines the driver for the Repetitive Interrupt Timer (user manual, p. 501)
25  */
26 
27 #ifndef __RFLPC_RIT_H__
28 #define __RFLPC_RIT_H__
29 
30 #ifdef RFLPC_CONFIG_ENABLE_RIT_TIMER
31 
32 #include "../nxp/LPC17xx.h"
33 #include "../interrupt.h"
34 
45 static inline void rflpc_rit_enable()
46 {
47  LPC_SC->PCONP |= (1UL << 16);
48 }
49 
51 static inline uint32_t rflpc_rit_get_counter_value() { return LPC_RIT->RICOUNTER; }
52 
54 static inline void rflpc_rit_set_counter_value(uint32_t value) { LPC_RIT->RICOUNTER = value; }
55 
58 static inline void rflpc_rit_clear_pending_interrupt() { LPC_RIT->RICTRL |= 1; }
59 
68 extern void rflpc_rit_set_callback(uint32_t comp_value, uint32_t mask, int reset_on_match, rflpc_irq_handler_t c);
69 
71 #endif /* ENABLE_RIT_TIMER */
72 
73 #endif
static void rflpc_rit_set_counter_value(uint32_t value)
Sets the current value of the rit counter.
Definition: rit.h:54
static uint32_t rflpc_rit_get_counter_value()
Gets the current value of the rit counter.
Definition: rit.h:51
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.
static void rflpc_rit_enable()
Enables the RIT.
Definition: rit.h:45
static void rflpc_rit_clear_pending_interrupt()
clears the pending interrupt.
Definition: rit.h:58
void(* rflpc_irq_handler_t)(void)
Interrupt handler type.
Definition: interrupt.h:62