92 */ |
92 */ |
93 uint8_t index = 16; // bit count maximum |
93 uint8_t index = 16; // bit count maximum |
94 uint8_t enable = DDR(RESPONSE_PORT) | _BV(RESPONSE_PIN); |
94 uint8_t enable = DDR(RESPONSE_PORT) | _BV(RESPONSE_PIN); |
95 uint8_t disable = DDR(RESPONSE_PORT) & ~_BV(RESPONSE_PIN); |
95 uint8_t disable = DDR(RESPONSE_PORT) & ~_BV(RESPONSE_PIN); |
96 data |= 0b100000000000001; // make sure start/stop bits are set |
96 data |= 0b100000000000001; // make sure start/stop bits are set |
97 data = 0b1010101010101011; |
|
98 while (index != 0) { |
97 while (index != 0) { |
99 if ((data & 1) != 0) { |
98 if ((data & 1) != 0) { |
100 DDR(RESPONSE_PORT) = enable; // enable response output |
99 DDR(RESPONSE_PORT) = enable; // enable response output |
101 } else { |
100 } else { |
102 DDR(RESPONSE_PORT) = disable; // disable response output |
101 DDR(RESPONSE_PORT) = disable; // disable response output |
346 // we have to detect which car is passing sensor2 - but at the moment we are lack of external interrupt source |
345 // we have to detect which car is passing sensor2 - but at the moment we are lack of external interrupt source |
347 if ( (PIN(SENS2_PORT) & _BV(SENS2_PIN)) != 0 ) { |
346 if ( (PIN(SENS2_PORT) & _BV(SENS2_PIN)) != 0 ) { |
348 // set inside status |
347 // set inside status |
349 for (tmp=0; tmp<MAX_SLOTS; tmp++) |
348 for (tmp=0; tmp<MAX_SLOTS; tmp++) |
350 if (slot[tmp].inside) { |
349 if (slot[tmp].inside) { |
351 response = (1 | ((tmp)<<1) | (4 << 4)); |
|
352 slot[tmp].inside = 0; |
350 slot[tmp].inside = 0; |
353 } |
351 } |
|
352 response = (1 | (0b111 <<1) | (4 << 4)); |
354 RS232_puts_p(PSTR("PIT:EXIT\n")); |
353 RS232_puts_p(PSTR("PIT:EXIT\n")); |
355 } |
354 } |
356 |
355 |
357 if (sens[2].car != sens[2].state) { |
356 if (sens[2].car != sens[2].state) { |
358 sens[2].state = sens[2].car; |
357 sens[2].state = sens[2].car; |