From 2e1bc9aa83b1ac8139a4cbd2d54e1e4a5002ecc9 Mon Sep 17 00:00:00 2001 From: burg Date: Mon, 2 Aug 2004 21:18:52 +0000 Subject: Perfectionnement du protocole : selection des données à renvoyer. --- n/accel/accel.c | 47 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) (limited to 'n/accel/accel.c') diff --git a/n/accel/accel.c b/n/accel/accel.c index 2051614..3598272 100644 --- a/n/accel/accel.c +++ b/n/accel/accel.c @@ -59,6 +59,7 @@ int16_t Gx,Gy; uint16_t Timer1; int16_t Vx,Vy; int16_t Dx,Dy; +uint8_t command; /* Variable Globale */ @@ -147,6 +148,12 @@ test_callback (uint8_t c, uint8_t argc, proto_arg_t argv[]) } else { + if (argc == 1) + { + if (c == 'i') command = argv[0]; + else proto_send1('E',4); //erreur 4 command non reconnu + } + else proto_send1('E',5); //Trop d'argument } } @@ -189,9 +196,45 @@ main (void) Timer1 = TCNT1; //remise dans l'état de capture //Todo : remettre dans cette état plutôt - etat = strt_at_Ta; - } + etat = strt_at_Ta; + + if (command !=0) + { + if (command & 0x01) + { + proto_send2('P',Tx >> 8,Tx); + } + if (command & 0x02) + { + proto_send2('Q', Ty >> 8, Ty); + } + if (command & 0x04) + { + proto_send2('R', Gx >> 8,Gx); + } + if (command & 0x08) + { + proto_send2('S',Gy >> 8,Gy); + } + if (command & 0x10) + { + proto_send2('T',Vx >> 8,Vx); + } + if (command & 0x20) + { + proto_send2('U',Vy >> 8,Vy); + } + if (command & 0x40) + { + proto_send2('V', Dx >> 8,Dx); + } + if (command & 0x80) + { + proto_send2('W',Dy >> 8, Dy); + } + } + } } return 0; } -- cgit v1.2.3