car004f/main.c

changeset 154
46822de910ff
parent 153
80d869ac365b
child 155
9e27eb837d3f
equal deleted inserted replaced
153:80d869ac365b 154:46822de910ff
32 volatile uint8_t data_len = 0; 32 volatile uint8_t data_len = 0;
33 volatile uint8_t bitbuf_len = 0; 33 volatile uint8_t bitbuf_len = 0;
34 volatile uint16_t bitbuf = 0; 34 volatile uint16_t bitbuf = 0;
35 volatile uint8_t car_speed[MAX_SLOTS]; 35 volatile uint8_t car_speed[MAX_SLOTS];
36 volatile uint8_t car_switch[MAX_SLOTS]; 36 volatile uint8_t car_switch[MAX_SLOTS];
37 volatile uint8_t car_act[MAX_SLOTS]; 37 volatile uint8_t car_act;
38 38
39 volatile uint8_t car_timeout[MAX_SLOTS]; 39 volatile uint8_t car_timeout[MAX_SLOTS];
40 volatile uint8_t timeout = 0; 40 volatile uint8_t timeout = 0;
41 volatile uint8_t brake_timeout = 0; 41 volatile uint8_t brake_timeout = 0;
42 42
91 response = 0; 91 response = 0;
92 } 92 }
93 } 93 }
94 */ 94 */
95 } 95 }
96
97 if (data_len == 8) { // activity data packet
98 car_act = (bitbuf >> 1) & 0b00111111;
99 for (clock = 0; clock<MAX_SLOTS; clock++) {
100 if (((car_act >> clock) & 1) == 0) car_speed[MAX_SLOTS-1-clock] = 0;
101 }
102 }
103
96 104
97 GICR |= _BV(INT0) ; // Enable INT0 105 GICR |= _BV(INT0) ; // Enable INT0
98 106
99 } else { 107 } else {
100 bitbuf_len++; // increment bit counter 108 bitbuf_len++; // increment bit counter

mercurial