Initial import of onewire-to-usb bridge
[onewire] / interrupts.c
1 /******************************************************************************/
2 /*Files to Include                                                            */
3 /******************************************************************************/
4
5 #if defined(__XC)
6     #include <xc.h>         /* XC8 General Include File */
7 #elif defined(HI_TECH_C)
8     #include <htc.h>        /* HiTech General Include File */
9 #endif
10
11 #include <stdint.h>         /* For uint8_t definition */
12 #include <stdbool.h>        /* For true/false definition */
13 #include "user.h"
14
15 /******************************************************************************/
16 /* Interrupt Routines                                                         */
17 /******************************************************************************/
18
19 /* Baseline devices don't have interrupts. Unfortunately the baseline detection 
20  * macro is named _PIC12 */
21
22 #ifndef _PIC12
23
24 void interrupt isr(void)
25 {
26     /* This code stub shows general interrupt handling.  Note that these
27     conditional statements are not handled within 3 seperate if blocks.
28     Do not use a seperate if block for each interrupt flag to avoid run
29     time errors. */
30
31     if (PIE1bits.TXIE && PIR1bits.TXIF)
32         msg_sendnext();
33
34     if (PIE1bits.RCIE && PIR1bits.RCIF)
35         msg_recvnext();
36
37     if (T1CONbits.TMR1ON && PIR1bits.TMR1IF) {
38         timer_rollover();
39     }
40     
41 #if 0
42
43     /* TODO Add interrupt routine code here. */
44
45     /* Determine which flag generated the interrupt */
46     if(<Interrupt Flag 1>)
47     {
48         <Interrupt Flag 1=0>; /* Clear Interrupt Flag 1 */
49     }
50     else if (<Interrupt Flag 2>)
51     {
52         <Interrupt Flag 2=0>; /* Clear Interrupt Flag 2 */
53     }
54     else
55     {
56         /* Unhandled interrupts */
57     }
58
59 #endif
60
61 }
62 #endif
63
64