summaryrefslogtreecommitdiffhomepage
path: root/digital/io
diff options
context:
space:
mode:
authorJérémy Dufour2008-04-20 16:06:52 +0200
committerJérémy Dufour2008-04-20 16:06:52 +0200
commit9241eafeaa905331533f0e430b2df9f3af4ec379 (patch)
tree1bd7a1f71393d5fb439045417ea53a17223531af /digital/io
parentd83c54d010c066783ecaffbabc000a785915749d (diff)
* digital/io/src
- add asserv commands to the UART protocol.
Diffstat (limited to 'digital/io')
-rw-r--r--digital/io/src/main.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/digital/io/src/main.c b/digital/io/src/main.c
index 11986f7f..0ac2e9a2 100644
--- a/digital/io/src/main.c
+++ b/digital/io/src/main.c
@@ -216,6 +216,58 @@ proto_callback (uint8_t cmd, uint8_t size, uint8_t *args)
getsamples_start (args[0], args[1]);
break;
+ /* Asserv */
+ case c ('a', 1):
+ {
+ switch (args[0])
+ {
+ case 'f':
+ /* Free motor */
+ asserv_free_motor ();
+ break;
+ case 's':
+ /* Stop motor */
+ asserv_stop_motor ();
+ break;
+ case 'w':
+ /* Go to the wall */
+ asserv_go_to_the_wall ();
+ break;
+ case 'd':
+ /* Go to the distributor */
+ asserv_go_to_distributor ();
+ break;
+ }
+ }
+ break;
+ case c ('a', 3):
+ {
+ switch (args[0])
+ {
+ case 'r':
+ /* Angular move
+ * - 2b: angle of rotation
+ */
+ asserv_goto_angle (v8_to_v16 (args[1], args[2]));
+ break;
+ }
+ }
+ break;
+ case c ('a', 5):
+ {
+ switch (args[0])
+ {
+ case 'l':
+ /* Linear move
+ * - 4b: distance to move.
+ */
+ asserv_move_linearly (v8_to_v32 (args[1], args[2], args[3],
+ args[4]));
+ break;
+ }
+ }
+ break;
+
default:
/* Unknown commands */
proto_send0 ('?');