1,6 → 1,7 |
#include "maindefs.h" |
#include "uart.h" |
#include "i2c.h" |
#include "spi.h" |
#include "interrupts.h" |
|
//---------------------------------------------------------------------------- |
20,6 → 21,7 |
IPR1bits.TX1IP = 1; // USART1 TX interrupt |
// IPR3bits.RC2IP = 1; // USART2 RX interrupt |
IPR1bits.SSPIP = 1; // I2C interrupt |
IPR3bits.SSP2IP = 1; // MSSP2 (SPI2) interrupt |
|
// Low priority interrupts |
|
101,6 → 103,28 |
// We need to check the interrupt flag of each enabled high-priority interrupt to |
// see which device generated this interrupt. Then we can call the correct handler. |
|
// Check to see if we have an SPI2 interrupt |
if (PIR3bits.SSP2IF) { |
// Call the handler |
SPI2_Recv_Interrupt_Handler(); |
|
// Clear the interrupt flag |
PIR3bits.SSP2IF = 0; |
|
return; |
} |
|
// Check to see if we have an I2C interrupt |
if (PIR1bits.SSPIF) { |
// Call the handler |
I2C_Interrupt_Handler(); |
|
// Clear the interrupt flag |
PIR1bits.SSPIF = 0; |
|
return; |
} |
|
// Check to see if we have an interrupt on USART1 RX |
if (PIR1bits.RC1IF) { |
// Call the interrupt handler |
112,6 → 136,7 |
return; |
} |
|
#ifndef _DEBUG // Disable UART1 TX interrupt for debug mode (using printf) |
// Check to see if we have an interrupt on USART1 TX |
if (PIR1bits.TX1IF) { |
// Call the interrupt handler |
122,6 → 147,7 |
|
return; |
} |
#endif |
|
// // Check to see if we have an interrupt on USART2 RX |
// if (PIR3bits.RC2IF) { |
132,18 → 158,7 |
// // Clear the interrupt flag |
// PIR3bits.RC2IF = 0; |
// } |
|
// Check to see if we have an I2C interrupt |
if (PIR1bits.SSPIF) { |
// Call the handler |
I2C_Interrupt_Handler(); |
|
// Clear the interrupt flag |
PIR1bits.SSPIF = 0; |
|
return; |
} |
} |
|
//---------------------------------------------------------------------------- |
// Low priority interrupt routine |