summaryrefslogtreecommitdiffhomepage
path: root/digital/io/src
diff options
context:
space:
mode:
authorJérémy Dufour2008-04-01 10:49:44 +0200
committerJérémy Dufour2008-04-01 10:49:44 +0200
commit1197ceaf9f4a3730bf89542ad28ddd6aff634ade (patch)
treeb0e36db7ea234811554a288fa20b544bc738db2f /digital/io/src
parent0d008cc2720a8c4bb3b76c6dec5040464d048adf (diff)
* digital/io/src
- add support for the rear trap (to eject the balls); - update eeprom key as required.
Diffstat (limited to 'digital/io/src')
-rw-r--r--digital/io/src/eeprom.c2
-rw-r--r--digital/io/src/servo.h2
-rw-r--r--digital/io/src/trap.c14
-rw-r--r--digital/io/src/trap.h6
4 files changed, 20 insertions, 4 deletions
diff --git a/digital/io/src/eeprom.c b/digital/io/src/eeprom.c
index 31f03641..c1685a09 100644
--- a/digital/io/src/eeprom.c
+++ b/digital/io/src/eeprom.c
@@ -46,7 +46,7 @@
/**
* Current version of the parameters organization.
*/
-#define EEPROM_PARAM_KEY 0x02
+#define EEPROM_PARAM_KEY 0x03
/** @} */
diff --git a/digital/io/src/servo.h b/digital/io/src/servo.h
index ee627a65..c6c08ce3 100644
--- a/digital/io/src/servo.h
+++ b/digital/io/src/servo.h
@@ -53,7 +53,7 @@
* Number of servos motor managed by this module.
* If you change it, you _must_ update the key of the eeprom module!
*/
-#define SERVO_NUMBER 5
+#define SERVO_NUMBER 6
/**
* Initialize servo module.
diff --git a/digital/io/src/trap.c b/digital/io/src/trap.c
index a57147bc..61a667fc 100644
--- a/digital/io/src/trap.c
+++ b/digital/io/src/trap.c
@@ -126,3 +126,17 @@ trap_set_high_time (uint8_t servo_id, uint8_t horizontal, uint8_t vertical)
trap_high_time_pos[vertical][servo_id] = vertical;
}
}
+
+/* Open the rear pannel to eject the balls. */
+void
+trap_open_rear_panel (void)
+{
+ servo_set_high_time (5, trap_high_time_pos[horizontal][5]);
+}
+
+/* Close the rear pannel to eject the balls. */
+void
+trap_close_rear_panel (void)
+{
+ servo_set_high_time (5, trap_high_time_pos[vertical][5]);
+}
diff --git a/digital/io/src/trap.h b/digital/io/src/trap.h
index 205697bd..bba780d8 100644
--- a/digital/io/src/trap.h
+++ b/digital/io/src/trap.h
@@ -49,6 +49,8 @@
* vertical.
* To go to the garbage, trap 3 must be vertical and traps 0, 1 and 2 must be
* horizontal.
+ * There is also a sixth trap to eject all the balls. It is used to put the
+ * balls contained in the boxes into the gutter (unlike the garbage).
*/
#include "servo.h" /* SERVO_NUMBER */
@@ -105,13 +107,13 @@ void
trap_set_high_time (uint8_t servo_id, uint8_t horizontal, uint8_t vertical);
/**
- * Open the rear pannel to eject the balls.
+ * Open the rear panel to eject the balls.
*/
void
trap_open_rear_panel (void);
/**
- * Close the rear pannel to eject the balls.
+ * Close the rear panel to eject the balls.
*/
void
trap_close_rear_panel (void);