Rev 1518 | Rev 1826 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1518 | Rev 1524 | ||
|---|---|---|---|
| Line 8... | Line 8... | ||
| 8 | #define LOW_NOCH 4 |
8 | #define LOW_NOCH 4 |
| 9 | 9 | ||
| 10 | #define IO_HIGH 1 |
10 | #define IO_HIGH 1 |
| 11 | #define IO_LOW 0 |
11 | #define IO_LOW 0 |
| 12 | 12 | ||
| - | 13 | /* |
|
| 13 | 14 | ||
| - | 15 | Callback function that is called from pin-change driver on AVR IO |
|
| - | 16 | id gives which pin that changed, status is the new state of the changed pin |
|
| - | 17 | ||
| - | 18 | */ |
|
| 14 | void sns_input_pcint_callback(uint8_t id, uint8_t status) |
19 | void sns_input_pcint_callback(uint8_t id, uint8_t status) |
| 15 | { |
20 | { |
| 16 | #ifdef sns_input_CH0 |
21 | #ifdef sns_input_CH0 |
| 17 | #if sns_input_CH0PCA95xxIO==0 |
22 | #if sns_input_CH0PCA95xxIO==0 |
| 18 | if (id == sns_input_PCINT_CH0) { |
23 | if (id == sns_input_PCINT_CH0) { |
| 19 | if (IO_LOW != status) { |
24 | if (IO_LOW != status) { |
| 20 | pinStatus[0] = HIGH; |
25 | pinStatus[0] = HIGH; |
| 21 | } else { |
26 | } else { |
| 22 | pinStatus[0] = LOW; |
27 | pinStatus[0] = LOW; |
| - | 28 | } |
|
| - | 29 | } |
|
| - | 30 | #endif |
|
| - | 31 | #endif |
|
| - | 32 | #ifdef sns_input_CH1 |
|
| - | 33 | #if sns_input_CH1PCA95xxIO==0 |
|
| - | 34 | if (id == sns_input_PCINT_CH1) { |
|
| - | 35 | if (IO_LOW != status) { |
|
| - | 36 | pinStatus[1] = HIGH; |
|
| - | 37 | } else { |
|
| - | 38 | pinStatus[1] = LOW; |
|
| - | 39 | } |
|
| - | 40 | } |
|
| - | 41 | #endif |
|
| - | 42 | #endif |
|
| - | 43 | #ifdef sns_input_CH2 |
|
| - | 44 | #if sns_input_CH2PCA95xxIO==0 |
|
| - | 45 | if (id == sns_input_PCINT_CH2) { |
|
| - | 46 | if (IO_LOW != status) { |
|
| - | 47 | pinStatus[2] = HIGH; |
|
| - | 48 | } else { |
|
| - | 49 | pinStatus[2] = LOW; |
|
| - | 50 | } |
|
| - | 51 | } |
|
| - | 52 | #endif |
|
| - | 53 | #endif |
|
| - | 54 | #ifdef sns_input_CH3 |
|
| - | 55 | #if sns_input_CH3PCA95xxIO==0 |
|
| - | 56 | if (id == sns_input_PCINT_CH3) { |
|
| - | 57 | if (IO_LOW != status) { |
|
| - | 58 | pinStatus[3] = HIGH; |
|
| - | 59 | } else { |
|
| - | 60 | pinStatus[3] = LOW; |
|
| - | 61 | } |
|
| - | 62 | } |
|
| - | 63 | #endif |
|
| - | 64 | #endif |
|
| - | 65 | #ifdef sns_input_CH4 |
|
| - | 66 | #if sns_input_CH4PCA95xxIO==0 |
|
| - | 67 | if (id == sns_input_PCINT_CH4) { |
|
| - | 68 | if (IO_LOW != status) { |
|
| - | 69 | pinStatus[4] = HIGH; |
|
| - | 70 | } else { |
|
| - | 71 | pinStatus[4] = LOW; |
|
| - | 72 | } |
|
| - | 73 | } |
|
| - | 74 | #endif |
|
| - | 75 | #endif |
|
| - | 76 | #ifdef sns_input_CH5 |
|
| - | 77 | #if sns_input_CH5PCA95xxIO==0 |
|
| - | 78 | if (id == sns_input_PCINT_CH5) { |
|
| - | 79 | if (IO_LOW != status) { |
|
| - | 80 | pinStatus[5] = HIGH; |
|
| - | 81 | } else { |
|
| - | 82 | pinStatus[5] = LOW; |
|
| - | 83 | } |
|
| - | 84 | } |
|
| - | 85 | #endif |
|
| - | 86 | #endif |
|
| - | 87 | #ifdef sns_input_CH6 |
|
| - | 88 | #if sns_input_CH6PCA95xxIO==0 |
|
| - | 89 | if (id == sns_input_PCINT_CH6) { |
|
| - | 90 | if (IO_LOW != status) { |
|
| - | 91 | pinStatus[6] = HIGH; |
|
| - | 92 | } else { |
|
| - | 93 | pinStatus[6] = LOW; |
|
| - | 94 | } |
|
| - | 95 | } |
|
| - | 96 | #endif |
|
| - | 97 | #endif |
|
| - | 98 | #ifdef sns_input_CH7 |
|
| - | 99 | #if sns_input_CH7PCA95xxIO==0 |
|
| - | 100 | if (id == sns_input_PCINT_CH7) { |
|
| - | 101 | if (IO_LOW != status) { |
|
| - | 102 | pinStatus[7] = HIGH; |
|
| - | 103 | } else { |
|
| - | 104 | pinStatus[7] = LOW; |
|
| 23 | } |
105 | } |
| 24 | } |
106 | } |
| 25 | #endif |
107 | #endif |
| 26 | #endif |
108 | #endif |
| - | 109 | } |
|
| - | 110 | ||
| - | 111 | ||
| - | 112 | #if sns_input_ENABLE_PCA95xx==1 |
|
| - | 113 | /* |
|
| - | 114 | ||
| - | 115 | Callback function that is called from PCA95xx-driver when any pin has changed |
|
| - | 116 | status is the pin status of all pins on PCA95xx |
|
| - | 117 | ||
| - | 118 | */ |
|
| - | 119 | void sns_input_PCA95xx_callback(uint16_t status) |
|
| - | 120 | { |
|
| - | 121 | #ifdef sns_input_CH0 |
|
| - | 122 | #if sns_input_CH0PCA95xxIO==1 |
|
| - | 123 | if (pinStatus[0] == LOW_NOCH && ((status>>sns_input_CH0)&0x1) == IO_HIGH) { |
|
| - | 124 | pinStatus[0] = HIGH; |
|
| - | 125 | } else if (pinStatus[0] == HIGH_NOCH && ((status>>sns_input_CH0)&0x1) == IO_LOW) { |
|
| - | 126 | pinStatus[0] = LOW; |
|
| - | 127 | } |
|
| - | 128 | #endif |
|
| - | 129 | #endif |
|
| 27 | #ifdef sns_input_CH1 |
130 | #ifdef sns_input_CH1 |
| 28 | #if |
131 | #if sns_input_CH1PCA95xxIO==1 |
| 29 | if ( |
132 | if (pinStatus[1] == LOW_NOCH && ((status>>sns_input_CH1)&0x1) == IO_HIGH) { |
| 30 | if (IO_LOW != status) { |
- | |
| 31 | pinStatus[1] = HIGH; |
133 | pinStatus[1] = HIGH; |
| 32 |
|
134 | } else if (pinStatus[1] == HIGH_NOCH && ((status>>sns_input_CH1)&0x1) == IO_LOW) { |
| 33 | pinStatus[1] = LOW; |
135 | pinStatus[1] = LOW; |
| 34 | } |
- | |
| 35 | } |
136 | } |
| 36 | #endif |
137 | #endif |
| 37 | #endif |
138 | #endif |
| 38 | #ifdef sns_input_CH2 |
139 | #ifdef sns_input_CH2 |
| 39 | #if |
140 | #if sns_input_CH2PCA95xxIO==1 |
| 40 | if ( |
141 | if (pinStatus[2] == LOW_NOCH && ((status>>sns_input_CH2)&0x1) == IO_HIGH) { |
| 41 | if (IO_LOW != status) { |
- | |
| 42 | pinStatus[2] = HIGH; |
142 | pinStatus[2] = HIGH; |
| 43 |
|
143 | } else if (pinStatus[2] == HIGH_NOCH && ((status>>sns_input_CH2)&0x1) == IO_LOW) { |
| 44 | pinStatus[2] = LOW; |
144 | pinStatus[2] = LOW; |
| 45 | } |
- | |
| 46 | } |
145 | } |
| 47 | #endif |
146 | #endif |
| 48 | #endif |
147 | #endif |
| 49 | #ifdef sns_input_CH3 |
148 | #ifdef sns_input_CH3 |
| 50 | #if |
149 | #if sns_input_CH3PCA95xxIO==1 |
| 51 | if ( |
150 | if (pinStatus[3] == LOW_NOCH && ((status>>sns_input_CH3)&0x1) == IO_HIGH) { |
| 52 | if (IO_LOW != status) { |
- | |
| 53 | pinStatus[3] = HIGH; |
151 | pinStatus[3] = HIGH; |
| 54 |
|
152 | } else if (pinStatus[3] == HIGH_NOCH && ((status>>sns_input_CH3)&0x1) == IO_LOW) { |
| 55 | pinStatus[3] = LOW; |
153 | pinStatus[3] = LOW; |
| 56 | } |
- | |
| 57 | } |
154 | } |
| 58 | #endif |
155 | #endif |
| 59 | #endif |
156 | #endif |
| 60 | #ifdef sns_input_CH4 |
157 | #ifdef sns_input_CH4 |
| 61 | #if |
158 | #if sns_input_CH4PCA95xxIO==1 |
| 62 | if ( |
159 | if (pinStatus[4] == LOW_NOCH && ((status>>sns_input_CH4)&0x1) == IO_HIGH) { |
| 63 | if (IO_LOW != status) { |
- | |
| 64 | pinStatus[4] = HIGH; |
160 | pinStatus[4] = HIGH; |
| 65 |
|
161 | } else if (pinStatus[4] == HIGH_NOCH && ((status>>sns_input_CH4)&0x1) == IO_LOW) { |
| 66 | pinStatus[4] = LOW; |
162 | pinStatus[4] = LOW; |
| 67 | } |
- | |
| 68 | } |
163 | } |
| 69 | #endif |
164 | #endif |
| 70 | #endif |
165 | #endif |
| - | 166 | ||
| 71 | #ifdef sns_input_CH5 |
167 | #ifdef sns_input_CH5 |
| 72 | #if |
168 | #if sns_input_CH5PCA95xxIO==1 |
| 73 | if ( |
169 | if (pinStatus[5] == LOW_NOCH && ((status>>sns_input_CH5)&0x1) == IO_HIGH) { |
| 74 | if (IO_LOW != status) { |
- | |
| 75 | pinStatus[5] = HIGH; |
170 | pinStatus[5] = HIGH; |
| 76 |
|
171 | } else if (pinStatus[5] == HIGH_NOCH && ((status>>sns_input_CH5)&0x1) == IO_LOW) { |
| 77 | pinStatus[5] = LOW; |
172 | pinStatus[5] = LOW; |
| 78 | } |
- | |
| 79 | } |
173 | } |
| 80 | #endif |
174 | #endif |
| 81 | #endif |
175 | #endif |
| 82 | #ifdef sns_input_CH6 |
176 | #ifdef sns_input_CH6 |
| 83 | #if |
177 | #if sns_input_CH0PCA95xxIO==1 |
| 84 | if ( |
178 | if (pinStatus[6] == LOW_NOCH && ((status>>sns_input_CH6)&0x1) == IO_HIGH) { |
| 85 | if (IO_LOW != status) { |
- | |
| 86 | pinStatus[6] = HIGH; |
179 | pinStatus[6] = HIGH; |
| 87 |
|
180 | } else if (pinStatus[6] == HIGH_NOCH && ((status>>sns_input_CH6)&0x1) == IO_LOW) { |
| 88 | pinStatus[6] = LOW; |
181 | pinStatus[6] = LOW; |
| 89 | } |
- | |
| 90 | } |
182 | } |
| 91 | #endif |
183 | #endif |
| 92 | #endif |
184 | #endif |
| 93 | #ifdef sns_input_CH7 |
185 | #ifdef sns_input_CH7 |
| 94 | #if |
186 | #if sns_input_CH7PCA95xxIO==1 |
| 95 | if ( |
187 | if (pinStatus[7] == LOW_NOCH && ((status>>sns_input_CH7)&0x1) == IO_HIGH) { |
| 96 | if (IO_LOW != status) { |
- | |
| 97 | pinStatus[7] = HIGH; |
188 | pinStatus[7] = HIGH; |
| 98 |
|
189 | } else if (pinStatus[7] == HIGH_NOCH && ((status>>sns_input_CH7)&0x1) == IO_LOW) { |
| 99 | pinStatus[7] = LOW; |
190 | pinStatus[7] = LOW; |
| 100 | } |
191 | } |
| 101 | } |
- | |
| 102 | #endif |
- | |
| 103 | #endif |
192 | #endif |
| - | 193 | #endif |
|
| - | 194 | ||
| 104 | } |
195 | } |
| 105 | - | ||
| 106 | #if sns_input_CH0PCA95xxIO==1 | sns_input_CH1PCA95xxIO==1 | sns_input_CH2PCA95xxIO==1 | sns_input_CH3PCA95xxIO==1 | sns_input_CH4PCA95xxIO==1 | sns_input_CH5PCA95xxIO==1 | sns_input_CH6PCA95xxIO==1 | sns_input_CH7PCA95xxIO==1 |
- | |
| 107 | /*void sns_input_PCA95xx_callback(uint16_t status) |
- | |
| 108 | { |
- | |
| 109 | printf("0x%x\n",status); |
- | |
| 110 | }*/ |
- | |
| 111 | #endif |
196 | #endif |
| 112 | 197 | ||
| 113 | 198 | ||
| - | 199 | #if sns_input_ENABLE_PCA95xx==1 |
|
| - | 200 | /* |
|
| - | 201 | ||
| 114 |
|
202 | Function that initiates status variables for PCA95xx pins |
| - | 203 | called at statup |
|
| - | 204 | ||
| - | 205 | */ |
|
| 115 | void sns_input_setPCA95xxPinStatus(void) |
206 | void sns_input_setPCA95xxPinStatus(void) |
| 116 | { |
207 | { |
| 117 | uint16_t status = Pca95xx_GetInputs(); |
208 | uint16_t status = Pca95xx_GetInputs(); |
| 118 | #ifdef sns_input_CH0 |
209 | #ifdef sns_input_CH0 |
| 119 | #if sns_input_CH0PCA95xxIO==1 |
210 | #if sns_input_CH0PCA95xxIO==1 |
| Line 164... | Line 255... | ||
| 164 | #if sns_input_CH5PCA95xxIO==1 |
255 | #if sns_input_CH5PCA95xxIO==1 |
| 165 | if (((status>>sns_input_CH5)&0x1) != IO_LOW) { |
256 | if (((status>>sns_input_CH5)&0x1) != IO_LOW) { |
| 166 | pinStatus[5] = HIGH_NOCH; |
257 | pinStatus[5] = HIGH_NOCH; |
| 167 | } else { |
258 | } else { |
| 168 | pinStatus[5] = LOW_NOCH; |
259 | pinStatus[5] = LOW_NOCH; |
| 169 | } |
260 | } |
| 170 | #endif |
261 | #endif |
| 171 | #endif |
262 | #endif |
| 172 | #ifdef sns_input_CH6 |
263 | #ifdef sns_input_CH6 |
| 173 | #if sns_input_CH6PCA95xxIO==1 |
264 | #if sns_input_CH6PCA95xxIO==1 |
| 174 | if (((status>>sns_input_CH6)&0x1) != IO_LOW) { |
265 | if (((status>>sns_input_CH6)&0x1) != IO_LOW) { |
| 175 | pinStatus[6] = HIGH_NOCH; |
266 | pinStatus[6] = HIGH_NOCH; |
| 176 | } else { |
267 | } else { |
| Line 200... | Line 291... | ||
| 200 | pinStatus[5] = NOCHANGE; |
291 | pinStatus[5] = NOCHANGE; |
| 201 | pinStatus[6] = NOCHANGE; |
292 | pinStatus[6] = NOCHANGE; |
| 202 | pinStatus[7] = NOCHANGE; |
293 | pinStatus[7] = NOCHANGE; |
| 203 | uint8_t index = 0; |
294 | uint8_t index = 0; |
| 204 | 295 | ||
| - | 296 | #if sns_input_ENABLE_PCA95xx==1 |
|
| 205 |
|
297 | Pca95xx_SetCallback(sns_input_PCA95XX_CALLBACK_INDEX, &sns_input_PCA95xx_callback); |
| 206 | Pca95xx_Init(0); |
298 | Pca95xx_Init(0); |
| 207 | #endif |
299 | #endif |
| 208 | 300 | ||
| 209 | #ifdef sns_input_CH0 |
301 | #ifdef sns_input_CH0 |
| 210 | #if sns_input_CH0PCA95xxIO==0 |
302 | #if sns_input_CH0PCA95xxIO==0 |
| Line 269... | Line 361... | ||
| 269 | #else |
361 | #else |
| 270 | gpio_clr_pullup(sns_input_CH4); |
362 | gpio_clr_pullup(sns_input_CH4); |
| 271 | #endif |
363 | #endif |
| 272 | gpio_set_in(sns_input_CH4); |
364 | gpio_set_in(sns_input_CH4); |
| 273 | Pcint_SetCallbackPin(sns_input_PCINT_CH4, sns_input_CH4, &sns_input_pcint_callback); |
365 | Pcint_SetCallbackPin(sns_input_PCINT_CH4, sns_input_CH4, &sns_input_pcint_callback); |
| 274 | #else |
366 | #else |
| 275 | Pca95xx_set_in(sns_input_CH4); |
367 | Pca95xx_set_in(sns_input_CH4); |
| 276 | #endif |
368 | #endif |
| 277 | index++; |
369 | index++; |
| 278 | #endif |
370 | #endif |
| 279 | #ifdef sns_input_CH5 |
371 | #ifdef sns_input_CH5 |
| Line 285... | Line 377... | ||
| 285 | #endif |
377 | #endif |
| 286 | gpio_set_in(sns_input_CH5); |
378 | gpio_set_in(sns_input_CH5); |
| 287 | Pcint_SetCallbackPin(sns_input_PCINT_CH5, sns_input_CH5, &sns_input_pcint_callback); |
379 | Pcint_SetCallbackPin(sns_input_PCINT_CH5, sns_input_CH5, &sns_input_pcint_callback); |
| 288 | #else |
380 | #else |
| 289 | Pca95xx_set_in(sns_input_CH5); |
381 | Pca95xx_set_in(sns_input_CH5); |
| 290 | #endif |
382 | #endif |
| 291 | index++; |
383 | index++; |
| 292 | #endif |
384 | #endif |
| 293 | #ifdef sns_input_CH6 |
385 | #ifdef sns_input_CH6 |
| 294 | #if sns_input_CH6PCA95xxIO==0 |
386 | #if sns_input_CH6PCA95xxIO==0 |
| 295 | #if (sns_input_CH6_pullup == 1) |
387 | #if (sns_input_CH6_pullup == 1) |
| 296 | gpio_set_pullup(sns_input_CH6); |
388 | gpio_set_pullup(sns_input_CH6); |
| 297 | #else |
389 | #else |
| Line 299... | Line 391... | ||
| 299 | #endif |
391 | #endif |
| 300 | gpio_set_in(sns_input_CH6); |
392 | gpio_set_in(sns_input_CH6); |
| 301 | Pcint_SetCallbackPin(sns_input_PCINT_CH6, sns_input_CH6, &sns_input_pcint_callback); |
393 | Pcint_SetCallbackPin(sns_input_PCINT_CH6, sns_input_CH6, &sns_input_pcint_callback); |
| 302 | #else |
394 | #else |
| 303 | Pca95xx_set_in(sns_input_CH6); |
395 | Pca95xx_set_in(sns_input_CH6); |
| 304 | #endif |
396 | #endif |
| 305 | index++; |
397 | index++; |
| 306 | #endif |
398 | #endif |
| 307 | #ifdef sns_input_CH7 |
399 | #ifdef sns_input_CH7 |
| 308 | #if sns_input_CH7PCA95xxIO==0 |
400 | #if sns_input_CH7PCA95xxIO==0 |
| 309 | #if (sns_input_CH7_pullup == 1) |
401 | #if (sns_input_CH7_pullup == 1) |
| 310 | gpio_set_pullup(sns_input_CH7); |
402 | gpio_set_pullup(sns_input_CH7); |
| 311 | #else |
403 | #else |
| 312 | gpio_clr_pullup(sns_input_CH7); |
404 | gpio_clr_pullup(sns_input_CH7); |
| 313 | #endif |
405 | #endif |
| 314 | gpio_set_in(sns_input_CH7); |
406 | gpio_set_in(sns_input_CH7); |
| 315 | Pcint_SetCallbackPin(sns_input_PCINT_CH7, sns_input_CH7, &sns_input_pcint_callback); |
407 | Pcint_SetCallbackPin(sns_input_PCINT_CH7, sns_input_CH7, &sns_input_pcint_callback); |
| 316 | #else |
408 | #else |
| 317 | Pca95xx_set_in(sns_input_CH7); |
409 | Pca95xx_set_in(sns_input_CH7); |
| 318 | #endif |
410 | #endif |
| 319 | index++; |
411 | index++; |
| 320 | #endif |
412 | #endif |
| 321 | 413 | ||
| 322 | #if |
414 | #if sns_input_ENABLE_PCA95xx==1 |
| 323 | sns_input_setPCA95xxPinStatus(); |
415 | sns_input_setPCA95xxPinStatus(); |
| 324 | /* Currently only polling of ports is implemented */ |
- | |
| 325 | //Pca95xx_SetCallback(sns_input_PCA95XX_CALLBACK_INDEX, &sns_input_PCA95xx_callback); |
- | |
| 326 | Timer_SetTimeout(sns_input_PCA95XX_POLL_TIMER, sns_input_PCA95XX_POLL_TIME_MS, TimerTypeFreeRunning, 0); |
- | |
| 327 | #endif |
416 | #endif |
| 328 | 417 | ||
| - | 418 | Timer_SetTimeout(sns_input_DEBOUNCE_TIMER, sns_input_DEBOUNCE_TIME_MS, TimerTypeFreeRunning, 0); |
|
| 329 | } |
419 | } |
| 330 | 420 | ||
| 331 | void sns_input_Process(void) |
421 | void sns_input_Process(void) |
| 332 | { |
422 | { |
| 333 |
|
423 | if (Timer_Expired(sns_input_DEBOUNCE_TIMER)) |
| - | 424 | { |
|
| 334 | uint8_t index = 0; |
425 | uint8_t index = 0; |
| 335 | for (index = 0; index < 8; index++) { |
426 | for (index = 0; index < 8; index++) { |
| 336 | if (pinStatus[index] == LOW || pinStatus[index] == HIGH) { |
427 | if (pinStatus[index] == LOW || pinStatus[index] == HIGH) { |
| 337 | StdCan_Msg_t txMsg; |
428 | StdCan_Msg_t txMsg; |
| 338 | StdCan_Set_class(txMsg.Header, CAN_MODULE_CLASS_SNS); |
429 | StdCan_Set_class(txMsg.Header, CAN_MODULE_CLASS_SNS); |
| Line 350... | Line 441... | ||
| 350 | pinStatus[index] = LOW_NOCH; |
441 | pinStatus[index] = LOW_NOCH; |
| 351 | } |
442 | } |
| 352 | while (StdCan_Put(&txMsg) != StdCan_Ret_OK); |
443 | while (StdCan_Put(&txMsg) != StdCan_Ret_OK); |
| 353 | } |
444 | } |
| 354 | } |
445 | } |
| 355 | - | ||
| 356 | #if sns_input_CH0PCA95xxIO==1 | sns_input_CH1PCA95xxIO==1 | sns_input_CH2PCA95xxIO==1 | sns_input_CH3PCA95xxIO==1 | sns_input_CH4PCA95xxIO==1 | sns_input_CH5PCA95xxIO==1 | sns_input_CH6PCA95xxIO==1 | sns_input_CH7PCA95xxIO==1 |
- | |
| 357 | /* Currently only polling of PCAxx-inputs is implemented */ |
- | |
| 358 | if (Timer_Expired(sns_input_PCA95XX_POLL_TIMER)) |
- | |
| 359 | { |
- | |
| 360 | uint16_t status = Pca95xx_GetInputs(); |
- | |
| 361 | #ifdef sns_input_CH0 |
- | |
| 362 | #if sns_input_CH0PCA95xxIO==1 |
- | |
| 363 | if (pinStatus[0] == LOW_NOCH && ((status>>sns_input_CH0)&0x1) == IO_HIGH) { |
- | |
| 364 | pinStatus[0] = HIGH; |
- | |
| 365 | } else if (pinStatus[0] == HIGH_NOCH && ((status>>sns_input_CH0)&0x1) == IO_LOW) { |
- | |
| 366 | pinStatus[0] = LOW; |
- | |
| 367 | } |
- | |
| 368 | #endif |
- | |
| 369 | #endif |
- | |
| 370 | #ifdef sns_input_CH1 |
- | |
| 371 | #if sns_input_CH1PCA95xxIO==1 |
- | |
| 372 | if (pinStatus[1] == LOW_NOCH && ((status>>sns_input_CH1)&0x1) == IO_HIGH) { |
- | |
| 373 | pinStatus[1] = HIGH; |
- | |
| 374 | } else if (pinStatus[1] == HIGH_NOCH && ((status>>sns_input_CH1)&0x1) == IO_LOW) { |
- | |
| 375 | pinStatus[1] = LOW; |
- | |
| 376 | } |
- | |
| 377 | #endif |
- | |
| 378 | #endif |
- | |
| 379 | #ifdef sns_input_CH2 |
- | |
| 380 | #if sns_input_CH2PCA95xxIO==1 |
- | |
| 381 | if (pinStatus[2] == LOW_NOCH && ((status>>sns_input_CH2)&0x1) == IO_HIGH) { |
- | |
| 382 | pinStatus[2] = HIGH; |
- | |
| 383 | } else if (pinStatus[2] == HIGH_NOCH && ((status>>sns_input_CH2)&0x1) == IO_LOW) { |
- | |
| 384 | pinStatus[2] = LOW; |
- | |
| 385 | } |
- | |
| 386 | #endif |
- | |
| 387 | #endif |
- | |
| 388 | #ifdef sns_input_CH3 |
- | |
| 389 | #if sns_input_CH3PCA95xxIO==1 |
- | |
| 390 | if (pinStatus[3] == LOW_NOCH && ((status>>sns_input_CH3)&0x1) == IO_HIGH) { |
- | |
| 391 | pinStatus[3] = HIGH; |
- | |
| 392 | } else if (pinStatus[3] == HIGH_NOCH && ((status>>sns_input_CH3)&0x1) == IO_LOW) { |
- | |
| 393 | pinStatus[3] = LOW; |
- | |
| 394 | } |
- | |
| 395 | #endif |
- | |
| 396 | #endif |
- | |
| 397 | #ifdef sns_input_CH4 |
- | |
| 398 | #if sns_input_CH4PCA95xxIO==1 |
- | |
| 399 | if (pinStatus[4] == LOW_NOCH && ((status>>sns_input_CH4)&0x1) == IO_HIGH) { |
- | |
| 400 | pinStatus[4] = HIGH; |
- | |
| 401 | } else if (pinStatus[4] == HIGH_NOCH && ((status>>sns_input_CH4)&0x1) == IO_LOW) { |
- | |
| 402 | pinStatus[4] = LOW; |
- | |
| 403 | } |
- | |
| 404 | #endif |
- | |
| 405 | #endif |
- | |
| 406 | #ifdef sns_input_CH5 |
- | |
| 407 | #if sns_input_CH5PCA95xxIO==1 |
- | |
| 408 | if (pinStatus[5] == LOW_NOCH && ((status>>sns_input_CH5)&0x1) == IO_HIGH) { |
- | |
| 409 | pinStatus[5] = HIGH; |
- | |
| 410 | } else if (pinStatus[5] == HIGH_NOCH && ((status>>sns_input_CH5)&0x1) == IO_LOW) { |
- | |
| 411 | pinStatus[5] = LOW; |
- | |
| 412 | } |
- | |
| 413 | #endif |
- | |
| 414 | #endif |
- | |
| 415 | #ifdef sns_input_CH6 |
- | |
| 416 | #if sns_input_CH0PCA95xxIO==1 |
- | |
| 417 | if (pinStatus[6] == LOW_NOCH && ((status>>sns_input_CH6)&0x1) == IO_HIGH) { |
- | |
| 418 | pinStatus[6] = HIGH; |
- | |
| 419 | } else if (pinStatus[6] == HIGH_NOCH && ((status>>sns_input_CH6)&0x1) == IO_LOW) { |
- | |
| 420 | pinStatus[6] = LOW; |
- | |
| 421 | } |
- | |
| 422 | #endif |
- | |
| 423 | #endif |
- | |
| 424 | #ifdef sns_input_CH7 |
- | |
| 425 | #if sns_input_CH7PCA95xxIO==1 |
- | |
| 426 | if (pinStatus[7] == LOW_NOCH && ((status>>sns_input_CH7)&0x1) == IO_HIGH) { |
- | |
| 427 | pinStatus[7] = HIGH; |
- | |
| 428 | } else if (pinStatus[7] == HIGH_NOCH && ((status>>sns_input_CH7)&0x1) == IO_LOW) { |
- | |
| 429 | pinStatus[7] = LOW; |
- | |
| 430 | } |
- | |
| 431 | #endif |
- | |
| 432 | #endif |
- | |
| 433 | - | ||
| 434 | } |
446 | } |
| 435 | #endif |
- | |
| 436 | } |
447 | } |
| 437 | 448 | ||
| 438 | void sns_input_HandleMessage(StdCan_Msg_t *rxMsg) |
449 | void sns_input_HandleMessage(StdCan_Msg_t *rxMsg) |
| 439 | { |
450 | { |
| 440 | 451 | ||