Rev 122 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 122 | Rev 124 | ||
|---|---|---|---|
| Line 2... | Line 2... | ||
| 2 | * |
2 | * |
| 3 | * IR reciver module |
3 | * IR reciver module |
| 4 | * |
4 | * |
| 5 | ********************************************************************* |
5 | ********************************************************************* |
| 6 | * FileName: $HeadURL: https://svn.auml.se/svn/HomeAutomation/trunk/EmbeddedSoftware/PIC/canIR/Source/IRec.c $ |
6 | * FileName: $HeadURL: https://svn.auml.se/svn/HomeAutomation/trunk/EmbeddedSoftware/PIC/canIR/Source/IRec.c $ |
| 7 | * Last changed: $LastChangedDate: 2006-11-18 |
7 | * Last changed: $LastChangedDate: 2006-11-18 22:14:33 +0100 (Sat, 18 Nov 2006) $ |
| 8 | * By: $LastChangedBy: johboh $ |
8 | * By: $LastChangedBy: johboh $ |
| 9 | * Revision: $Revision: |
9 | * Revision: $Revision: 124 $ |
| 10 | ********************************************************************/ |
10 | ********************************************************************/ |
| 11 | 11 | ||
| 12 | #include <IRec.h> |
12 | #include <IRec.h> |
| 13 | 13 | ||
| 14 | #include <CAN.h> |
14 | #include <CAN.h> |
| Line 83... | Line 83... | ||
| 83 | CCP1CONbits.CCP1M0=~CCP1CONbits.CCP1M0; |
83 | CCP1CONbits.CCP1M0=~CCP1CONbits.CCP1M0; |
| 84 | 84 | ||
| 85 | // Disable interrupt |
85 | // Disable interrupt |
| 86 | PIR1bits.CCP1IF=0; |
86 | PIR1bits.CCP1IF=0; |
| 87 | 87 | ||
| - | 88 | // If found RC5 och RC5X startbit... |
|
| 88 | if (started==TRUE && (type==IR_RC5 || type==IR_RC5X)) |
89 | if (started==TRUE && (type==IR_RC5 || type==IR_RC5X)) |
| 89 | { |
90 | { |
| - | 91 | // Parse message |
|
| 90 | 92 | ||
| 91 | if ((t2-250)<timediff && timediff<(t2+250) && second==FALSE) |
93 | if ((t2-250)<timediff && timediff<(t2+250) && second==FALSE) |
| 92 | { |
94 | { |
| 93 | if (bitIndex==0) toggle=lastbit; |
95 | if (bitIndex==0) toggle=lastbit; |
| 94 | if (bitIndex>=1 && bitIndex<=5) addr+=(lastbit<<(5-bitIndex)); |
96 | if (bitIndex>=1 && bitIndex<=5) addr+=(lastbit<<(5-bitIndex)); |
| Line 131... | Line 133... | ||
| 131 | } |
133 | } |
| 132 | 134 | ||
| 133 | } // if started and type == RC5 or RC5X |
135 | } // if started and type == RC5 or RC5X |
| 134 | 136 | ||
| 135 | 137 | ||
| - | 138 | // If RC6... |
|
| 136 | if (started==TRUE && type==IR_RC6) |
139 | if (started==TRUE && type==IR_RC6) |
| 137 | { |
140 | { |
| 138 | 141 | ||
| 139 | if ((t1-250)<timediff && timediff<(t1+250) && second==FALSE) |
142 | if ((t1-250)<timediff && timediff<(t1+250) && second==FALSE) |
| 140 | { |
143 | { |