car004f/main.c

changeset 154
46822de910ff
parent 153
80d869ac365b
child 155
9e27eb837d3f
--- a/car004f/main.c	Fri Dec 27 11:43:40 2013 +0100
+++ b/car004f/main.c	Fri Dec 27 11:56:22 2013 +0100
@@ -34,7 +34,7 @@
 volatile uint16_t bitbuf = 0;
 volatile uint8_t car_speed[MAX_SLOTS];
 volatile uint8_t car_switch[MAX_SLOTS];
-volatile uint8_t car_act[MAX_SLOTS];
+volatile uint8_t car_act;
 
 volatile uint8_t car_timeout[MAX_SLOTS];
 volatile uint8_t timeout = 0;
@@ -94,6 +94,14 @@
                 */
             }
 
+            if (data_len == 8) { // activity data packet
+                car_act = (bitbuf >> 1) & 0b00111111;
+                for (clock = 0; clock<MAX_SLOTS; clock++) {
+                    if (((car_act >> clock) & 1) == 0) car_speed[MAX_SLOTS-1-clock] = 0;
+                }
+            }
+
+
             GICR |= _BV(INT0) ; // Enable INT0
 
         } else {

mercurial