Subversion Repositories Code-Repo

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
260 Kevin 1
#include "defines.h"
2
#include "INTERRUPTS.h"
3
#include "I2C1.h"
4
#include "I2C2.h"
5
 
6
void Interrupt_Init() {
7
 
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 SPI2 interrupt
26
//    if (PIR3bits.SSP2IF) {
27
//        // Call the handler
28
//        SPI2_Recv_Interrupt_Handler();
29
//
30
//        // Clear the interrupt flag
31
//        PIR3bits.SSP2IF = 0;
32
//
33
//        return;
34
//    }
35
 
36
    // Check to see if we have an I2C1 interrupt
37
    if (PIR1bits.SSP1IF) {
38
 
39
        // Call the handler
40
        I2C1_Interrupt_Handler();
41
 
42
        // Clear the interrupt flag
43
        PIR1bits.SSP1IF = 0;
44
 
45
        return;
46
    }
47
 
48
    // Check to see if we have an I2C2 interrupt
49
    if (PIR4bits.SSP2IF) {
50
        // Call the handler
51
        I2C2_Interrupt_Handler();
52
 
53
        // Clear the interrupt flag
54
        PIR4bits.SSP2IF = 0;
55
 
56
        return;
57
    }
58
 
59
//    // Check to see if we have an interrupt on USART1 RX
60
//    if (PIR1bits.RC1IF) {
61
//        // Call the interrupt handler
62
//        UART1_Recv_Interrupt_Handler();
63
//
64
//        // Clear the interrupt flag
65
//        PIR1bits.RC1IF = 0;
66
//
67
//        return;
68
//    }
69
 
70
//    // Check to see if we have an interrupt on USART1 TX
71
//    if (PIR1bits.TX1IF) {
72
//        // Call the interrupt handler
73
//        UART1_Send_Interrupt_Handler();
74
//
75
//        // Clear the interrupt flag
76
//        PIR1bits.TX1IF = 0;
77
//
78
//        return;
79
//    }
80
 
81
//    // Check to see if we have an interrupt on USART2 RX
82
//    if (PIR3bits.RC2IF) {
83
//        DBG_PRINT_INT("INT: UART2 RX\r\n");
84
//        // Call the interrupt handler
85
//        uart_2_recv_interrupt_handler();
86
//
87
//        // Clear the interrupt flag
88
//        PIR3bits.RC2IF = 0;
89
//    }
90
}