Subversion Repositories Code-Repo

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
312 Kevin 1
#include "defines.h"
2
#include "INTERRUPTS.h"
3
#include "IOC.h"
315 Kevin 4
#include "SPI.h"
316 Kevin 5
#include "TIMER.h"
312 Kevin 6
 
7
void Interrupt_Init() {
8
}
9
 
10
void Interrupt_Enable() {
11
    // Enable global and peripheral interrupts
12
    INTCONbits.PEIE = 1;
13
    INTCONbits.GIE = 1;
14
}
15
 
16
void Interrupt_Disable() {
17
    INTCONbits.PEIE = 0;
18
    INTCONbits.GIE = 0;
19
}
20
 
21
void interrupt InterruptHandler(void) {
22
    // We need to check the interrupt flag of each enabled high-priority interrupt to
23
    //  see which device generated this interrupt.  Then we can call the correct handler.
24
 
316 Kevin 25
    if (PIR1bits.TMR2IF) {
26
 
27
        TIMER_2_Interrupt_Handler();
28
 
29
        PIR1bits.TMR2IF = 0;
30
        return;
31
    }
32
 
312 Kevin 33
    if (INTCONbits.IOCIF) {
34
        // Call the handler
35
        IOC_Interrupt_Handler();
36
 
37
        INTCONbits.IOCIF = 0;
38
 
39
        return;
40
    }
41
 
42
 
43
}