Subversion Repositories Code-Repo

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
283 Kevin 1
#include "defines.h"
2
#include "INTERRUPTS.h"
3
#include "I2C1.h"
4
 
5
void Interrupt_Init() {
6
}
7
 
8
void Interrupt_Enable() {
9
    // Enable global and peripheral interrupts
10
    INTCONbits.PEIE = 1;
11
    INTCONbits.GIE = 1;
12
}
13
 
14
void Interrupt_Disable() {
15
    INTCONbits.PEIE = 0;
16
    INTCONbits.GIE = 0;
17
}
18
 
19
void interrupt InterruptHandler(void) {
20
    // We need to check the interrupt flag of each enabled high-priority interrupt to
21
    //  see which device generated this interrupt.  Then we can call the correct handler.
22
 
23
    // Check to see if we have an I2C interrupt
24
    if (PIR1bits.SSP1IF) {
25
 
26
        // Call the handler
27
        I2C1_Interrupt_Handler();
28
 
29
        // Clear the interrupt flag
30
        PIR1bits.SSP1IF = 0;
31
 
32
        return;
33
    }
34
}