Rev 1136 | Rev 1138 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1136 | Rev 1137 | ||
|---|---|---|---|
| Line 39... | Line 39... | ||
| 39 | Input: - |
39 | Input: - |
| 40 | Returns: - |
40 | Returns: - |
| 41 | **************************************************************************/ |
41 | **************************************************************************/ |
| 42 | ISR(PCINT0_vect) { |
42 | ISR(PCINT0_vect) { |
| 43 | uint8_t p; |
43 | uint8_t p; |
| - | 44 | uint8_t rPinB=PINB; |
|
| - | 45 | uint8_t rPinC=PINC; |
|
| - | 46 | uint8_t rPinD=PIND; |
|
| 44 | 47 | ||
| 45 | /* Check which pin that have had a change and call the callback.*/ |
48 | /* Check which pin that have had a change and call the callback.*/ |
| 46 | //printf("I\n"); |
49 | //printf("I\n"); |
| 47 | for (p = 0; p < PCINT_NUM_PCINTS; p++) |
50 | for (p = 0; p < PCINT_NUM_PCINTS; p++) |
| 48 | { |
51 | { |
| 49 | if (pcints[p].pcintBit < 8) { |
52 | if (pcints[p].pcintBit < 8) { |
| 50 | if (pcints[p].lastStatus != (( |
53 | if (pcints[p].lastStatus != ((rPinB & (1 << pcints[p].pcintBit)) != 0)) { |
| 51 | pcints[p].lastStatus = (( |
54 | pcints[p].lastStatus = ((rPinB & (1 << pcints[p].pcintBit)) != 0); |
| 52 | pcints[p].callback(p, pcints[p].lastStatus); |
55 | pcints[p].callback(p, pcints[p].lastStatus); |
| 53 | } |
56 | } |
| 54 | } else if (pcints[p].pcintBit < 16) { |
57 | } else if (pcints[p].pcintBit < 16) { |
| 55 | if (pcints[p].lastStatus != (( |
58 | if (pcints[p].lastStatus != ((rPinC & (1 << pcints[p].pcintBit%8)) != 0)) { |
| 56 | pcints[p].lastStatus = (( |
59 | pcints[p].lastStatus = ((rPinC & (1 << pcints[p].pcintBit%8)) != 0); |
| 57 | pcints[p].callback(p, pcints[p].lastStatus); |
60 | pcints[p].callback(p, pcints[p].lastStatus); |
| 58 | } |
61 | } |
| 59 | } else if (pcints[p].pcintBit < 24) { |
62 | } else if (pcints[p].pcintBit < 24) { |
| 60 | if (pcints[p].lastStatus != (( |
63 | if (pcints[p].lastStatus != ((rPinD & (1 << pcints[p].pcintBit%8)) != 0)) { |
| 61 | pcints[p].lastStatus = (( |
64 | pcints[p].lastStatus = ((rPinD & (1 << pcints[p].pcintBit%8)) != 0); |
| 62 | pcints[p].callback(p, pcints[p].lastStatus); |
65 | pcints[p].callback(p, pcints[p].lastStatus); |
| 63 | } |
66 | } |
| 64 | } |
67 | } |
| 65 | } |
68 | } |
| 66 | 69 | ||