Subversion Repositories Code-Repo

Rev

Rev 329 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
329 Kevin 1
#include "defines.h"
2
#include "INTERRUPTS.h"
3
#include "I2C1.h"
4
#include "UART.h"
5
#include "IOC.h"
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
 
25
    // Check to see if we have an I2C interrupt
26
    if (PIR1bits.SSP1IF) {
27
 
28
        // Call the handler
29
        I2C1_Interrupt_Handler();
30
 
31
        // Clear the interrupt flag
32
        PIR1bits.SSP1IF = 0;
33
 
34
//        return;
35
    }
36
 
37
    // Check for an IOC interrupt
38
    if (INTCONbits.IOCIF) {
39
 
40
        // Call the handler
41
        IOC_Interrupt_Handler();
42
 
43
        // Clear the interrupt flag
44
        INTCONbits.IOCIF = 0;
45
 
46
//        return;
47
    }
48
 
49
//    if (PIR1bits.RCIF) {
50
//
51
//        // Call the handler
52
//        UART_RX_Interrupt_Handler();
53
//
54
//        // Clear the interrupt flag
55
//        PIR1bits.RCIF = 0;
56
//
57
//        return;
58
//    }
59
 
60
//    if (PIR1bits.TXIF) {
61
//
62
//        // Call the handler
63
//        UART_TX_Interrupt_Handler();
64
//
65
//        // Clear the interrupt flag
66
//        PIR1bits.TXIF = 0;
67
//
68
//        return;
69
//    }
70
 
71
}