summaryrefslogtreecommitdiff
path: root/n/accel/accel.c
diff options
context:
space:
mode:
Diffstat (limited to 'n/accel/accel.c')
-rw-r--r--n/accel/accel.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/n/accel/accel.c b/n/accel/accel.c
index eaa848a..fb63fc9 100644
--- a/n/accel/accel.c
+++ b/n/accel/accel.c
@@ -130,6 +130,8 @@ test_callback (uint8_t c, uint8_t argc, proto_arg_t argv[])
break;
case 'y' : proto_send2('Y',Ty >> 8, Tx);
break;
+ case 'r' : proto_send2('R',T2 >> 8, T2);
+ break;
case 't' : proto_send2('T',Timer1 >> 8, Timer1);
break;
case 'g' : proto_send2('x',Gx >> 8, Gx);
@@ -142,7 +144,7 @@ test_callback (uint8_t c, uint8_t argc, proto_arg_t argv[])
rs232_putc('V');
proto_send2('y',Vy >> 8,Vy);
break;
- case 'z' : reset;
+ case 'z' : reset();
default : proto_send1('E',2); //erreur 2 Command incorrect
}
}
@@ -161,12 +163,12 @@ int
main (void)
{
//initialisation
- rs232_init();
+ rs232_init();
proto_init(test_callback,rs232_putc);
proto_send0('Z');
- //initialisation du timer prescaler 254
+ //initialisation du timer prescaler 256
TCCR1B = _BV(ICES1) | _BV(CS12);
// Input Capture Interrupt enable & Timer 1 overflow
TIMSK = _BV(TICIE1) | _BV(TOIE1);
@@ -189,10 +191,10 @@ main (void)
T2 = (Td + Tc - Tb) /2;
// remise de TCNT1 pour mesurer le temps
TCNT1 = 0;
- Gx = calculG(Tx,T2_cal,G0x);
- Gy = calculG(Ty,T2_cal,G0y);
- Vx += (Gx) >> 8;
- Vy += (Gy) >> 8;
+ Gx = calculGb(Tx,T2,T1x_cal);
+ Gy = calculGb(Ty,T2,T1y_cal);
+ Vx +=Gx;
+ Vy +=Gy;
Timer1 = TCNT1;
//remise dans l'état de capture
//Todo : remettre dans cet état plutôt