summaryrefslogtreecommitdiff
path: root/n/accel
diff options
context:
space:
mode:
authorburg2004-08-02 21:18:52 +0000
committerburg2004-08-02 21:18:52 +0000
commit2e1bc9aa83b1ac8139a4cbd2d54e1e4a5002ecc9 (patch)
treeff73f11aa5762ca88202b8f1cadcc2b814679210 /n/accel
parentaf0f792e9f1be2ebe85582ddc72c90a335f21550 (diff)
Perfectionnement du protocole :
selection des données à renvoyer.
Diffstat (limited to 'n/accel')
-rw-r--r--n/accel/accel.c47
-rw-r--r--n/accel/erreur.txt6
2 files changed, 51 insertions, 2 deletions
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 plutt
- 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;
}
diff --git a/n/accel/erreur.txt b/n/accel/erreur.txt
index b9a4c91..d28eccd 100644
--- a/n/accel/erreur.txt
+++ b/n/accel/erreur.txt
@@ -8,3 +8,9 @@ Commande non reconnu
E3:
Erreur grave de la machine tat
+
+E4:
+commande non reconnu
+
+E5:
+Trop d'argument