blackbox/lowlevel.c

changeset 41
9857c18c5e64
parent 37
136a79772098
child 42
018d4d63ad3b
--- a/blackbox/lowlevel.c	Tue Dec 06 16:45:52 2011 +0100
+++ b/blackbox/lowlevel.c	Wed Dec 07 15:56:05 2011 +0100
@@ -105,16 +105,19 @@
     // interrupt enable + tcnt0 set in timer2
 
 
-    // setup data bit timer
+    // setup data bit + carid timer
     TCCR2 = (1<<CS21) | (1<<WGM21); //divide by 8, set compare match
     OCR2 = TIMER2_50US;
     TIMSK |= 1<<OCIE2; //enable timer2 interrupt
 
+    // enable carid interrupts
+    MCUCR = _BV(ISC00) | _BV(ISC01) | _BV(ISC10) | _BV(ISC11); // INT0/1 rising edge
+    GICR = _BV(INT0) | _BV(INT1) ; // Enable INT0 + INT1
+
+
+
     // setup data packet timer
-    //TCCR1A = (1<<COM1A1);
-    TCCR1B = (1<<CS11) | (1<<WGM12); //divide by 8, set compare match
-    //TCCR1B = (1<<CS11) | (1<<CS10); //divide by 64
-    //TCNT1 = TIMER_7500NS;
+    TCCR1B = (1<<CS11) | (1<<WGM12); //divide by 8, set compare match (1mhz clock)
     OCR1A = TIMER1_7500NS;
     TIMSK |= 1<<OCIE1A; //enable timer1 interrupt
 

mercurial