#include <LPC17xx.h>
#include <stdlib.h>
#include "timer.h"
Go to the source code of this file.
|
_PRIVATE TIMER_InterruptHandler | handlers [TIM_COUNT *TIM_INT_SRC_COUNT] = {NULL} |
| Array of function pointers to the interrupt handlers for each TIMER peripheral. The array is of size TIM_COUNT * TIM_INT_SRC_COUNT, where TIM_COUNT is 4 and TIM_INT_SRC_COUNT is the number of interrupt sources (4 match registers and 2 capture channels, although the latter are not implemented in this library).
|
|
◆ clear_interrupt()
Clears the interrupt flag for the specified source.
- Note
- IR expects a 1 to clear the interrupt flag.
Definition at line 39 of file timer_irq.c.
40{
41 switch (which)
42 {
43 case 0:
45 break;
46 case 1:
48 break;
49 case 2:
51 break;
52 case 3:
54 break;
55 }
56}
#define SET_BIT(reg, bit)
◆ TIMER0_IRQHandler()
void TIMER0_IRQHandler |
( |
void |
| ) |
|
|
extern |
Definition at line 72 of file timer_irq.c.
73{
75 {
79 }
80
82 {
86 }
87
89 {
93 }
94
96 {
100 }
101}
_PRIVATE bool who_did_interrupt(u8 which, u8 source)
Checks the TIMER's Interrupt Register and returns whether the interrupt was triggered by the specifie...
_PRIVATE void clear_interrupt(u8 which, u8 source)
Clears the interrupt flag for the specified source.
_PRIVATE TIMER_InterruptHandler handlers[TIM_COUNT *TIM_INT_SRC_COUNT]
Array of function pointers to the interrupt handlers for each TIMER peripheral. The array is of size ...
◆ TIMER1_IRQHandler()
void TIMER1_IRQHandler |
( |
void |
| ) |
|
|
extern |
Definition at line 103 of file timer_irq.c.
104{
106 {
110 }
111
113 {
117 }
118
120 {
124 }
125
127 {
131 }
132}
◆ TIMER2_IRQHandler()
void TIMER2_IRQHandler |
( |
void |
| ) |
|
|
extern |
Definition at line 134 of file timer_irq.c.
135{
137 {
141 }
142
144 {
148 }
149
151 {
155 }
156
158 {
162 }
163}
◆ TIMER3_IRQHandler()
void TIMER3_IRQHandler |
( |
void |
| ) |
|
|
extern |
Definition at line 165 of file timer_irq.c.
166{
168 {
172 }
173
175 {
179 }
180
182 {
186 }
187
189 {
193 }
194}
◆ TIMER_SetInterruptHandler()
Sets the interrupt handler for a TIMER peripheral, on a specific source between the 4 match registers and 2 capture channels (enum TIMER_InterruptSource).
- Parameters
-
timer | TIMER peripheral |
source | Interrupt source (enum TIMER_InterruptSource) |
handler | Function pointer to the interrupt handler: void function(void) |
Definition at line 60 of file timer_irq.c.
◆ TIMER_UnsetInterruptHandler()
void TIMER_UnsetInterruptHandler |
( |
TIMER |
timer, |
|
|
u8 |
source |
|
) |
| |
Unsets the interrupt handler for a TIMER peripheral, on a specific source between the 4 match registers and 2 capture channels (enum TIMER_InterruptSource).
- Parameters
-
timer | TIMER peripheral |
source | Interrupt source (enum TIMER_InterruptSource) |
Definition at line 65 of file timer_irq.c.
◆ who_did_interrupt()
Checks the TIMER's Interrupt Register and returns whether the interrupt was triggered by the specified source, which is of type TIMER_Interrupt_Source.
- Parameters
-
source | A TIMER_Interrupt_Source object |
- Note
- IR has bits [0..3] for the 4 MR available, and 2 bits [4, 5] for the 2 capture channels, that have NOT been implemented in this library yet. Hence, although they've been added to the enum for completeness, they won't work (return false).
Definition at line 20 of file timer_irq.c.
21{
22 switch (which)
23 {
24 case 0:
25 return LPC_TIM0->IR & (1 << source);
26 case 1:
27 return LPC_TIM1->IR & (1 << source);
28 case 2:
29 return LPC_TIM2->IR & (1 << source);
30 case 3:
31 return LPC_TIM3->IR & (1 << source);
32 }
33
34 return false;
35}
◆ handlers
Array of function pointers to the interrupt handlers for each TIMER peripheral. The array is of size TIM_COUNT * TIM_INT_SRC_COUNT, where TIM_COUNT is 4 and TIM_INT_SRC_COUNT is the number of interrupt sources (4 match registers and 2 capture channels, although the latter are not implemented in this library).
- Note
- This array is updated by TIMER_SetInterruptHandler() and TIMER_UnsetInterruptHandler().
Definition at line 10 of file timer_irq.c.