30 |
30 |
31 volatile uint16_t data = 0; |
31 volatile uint16_t data = 0; |
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 |
35 volatile uint8_t car_speed[MAX_SLOTS]; |
36 volatile uint8_t car_speed[MAX_SLOTS]; |
36 volatile uint8_t car_switch[MAX_SLOTS]; |
37 volatile uint8_t car_switch[MAX_SLOTS]; |
37 volatile uint8_t car_act; |
38 volatile uint8_t car_act; |
38 |
39 |
39 volatile uint8_t car_timeout[MAX_SLOTS]; |
40 volatile uint8_t car_timeout[MAX_SLOTS]; |
80 // write data of controllers to array |
81 // write data of controllers to array |
81 if (data_len == 10) { // controller data packet |
82 if (data_len == 10) { // controller data packet |
82 clock = (bitbuf >> 6) & 0b00000111; |
83 clock = (bitbuf >> 6) & 0b00000111; |
83 car_speed[clock] = (bitbuf >> 1) & 0x0F; |
84 car_speed[clock] = (bitbuf >> 1) & 0x0F; |
84 car_switch[clock] = (bitbuf >> 5) & 1; |
85 car_switch[clock] = (bitbuf >> 5) & 1; |
85 // current response for this car? |
86 |
86 /* |
|
87 if (response != 0) { |
|
88 if ( ((response & 0b00001110) >> 1) == clock) { |
|
89 // add our ID to response: |
|
90 send_response(response | self_id << 6); |
|
91 response = 0; |
|
92 } |
|
93 } |
|
94 */ |
|
95 } |
87 } |
96 |
88 |
97 if (data_len == 8) { // activity data packet |
89 if (data_len == 8) { // activity data packet |
98 car_act = (bitbuf >> 1) & 0b00111111; |
90 car_act = (bitbuf >> 1) & 0b00111111; |
99 for (clock = 0; clock<MAX_SLOTS; clock++) { |
91 for (clock = 0; clock<MAX_SLOTS; clock++) { |