summaryrefslogtreecommitdiff
path: root/digital
diff options
context:
space:
mode:
authorJérémy Dufour2008-03-22 16:18:54 +0100
committerJérémy Dufour2008-03-22 16:18:54 +0100
commit21b3846c5f1a0a6cfa8c75734eceb07e5bbbc1fd (patch)
tree9278ba31953ac530476404eb2b25cdb11b0b9b5c /digital
parent5f9741a97eb9eec7f8f38cf3c98a3ff01b20e58b (diff)
* digital/io/src
- add servo/trap commands over UART protocol to: - control the position of a servo motor (servo); - setup the configuration of vertical and horizontal position (trap); - open a path to a desired box (trap).
Diffstat (limited to 'digital')
-rw-r--r--digital/io/src/main.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/digital/io/src/main.c b/digital/io/src/main.c
index 76594bbd..9022c9ae 100644
--- a/digital/io/src/main.c
+++ b/digital/io/src/main.c
@@ -37,6 +37,7 @@
#include "asserv.h" /* Functions to control the asserv board */
#include "switch.h" /* Manage switches (jack, color selector) */
#include "eeprom.h" /* Parameters loaded/stored in the EEPROM */
+#include "trap.h" /* Trap module (trap_* functions) */
/**
* Initialize the main and all its subsystems.
@@ -62,6 +63,8 @@ main_init (void)
eeprom_load_param ();
/* Asserv communication */
asserv_init ();
+ /* Trap module */
+ trap_init ();
/* Enable interrupts */
sei ();
@@ -109,6 +112,32 @@ proto_callback (uint8_t cmd, uint8_t size, uint8_t *args)
utils_reset ();
break;
+ /* Servo/trap commands */
+ case c ('t', 3):
+ /* Set the high time values of a servo for the vertical and horizontal
+ * positions using trapdoor module.
+ * - 1b: servo id number;
+ * - 1b: high time value (horizontal);
+ * - 1b: high time value (vertical).
+ */
+ trap_set_high_time (args[0], args[1], args[2]);
+ break;
+
+ case c ('T', 1):
+ /* Setup traps to open a path to a destination box.
+ * - 1b: box identification
+ */
+ trap_setup_path_to_box (args[0]);
+ break;
+
+ case c ('s', 2):
+ /* Set servo motor to a desired position using the servo module.
+ * - 1b: servo id number;
+ * - 1b: pwm high time value (position).
+ */
+ servo_set_high_time (args[0], args[1]);
+ break;
+
default:
/* Unknown commands */
proto_send0 ('?');