From 1197ceaf9f4a3730bf89542ad28ddd6aff634ade Mon Sep 17 00:00:00 2001 From: Jérémy Dufour Date: Tue, 1 Apr 2008 10:49:44 +0200 Subject: * digital/io/src - add support for the rear trap (to eject the balls); - update eeprom key as required. --- digital/io/src/eeprom.c | 2 +- digital/io/src/servo.h | 2 +- digital/io/src/trap.c | 14 ++++++++++++++ digital/io/src/trap.h | 6 ++++-- 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); -- cgit v1.2.3