summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJérémy Dufour2008-04-20 19:54:48 +0200
committerJérémy Dufour2008-04-20 19:54:48 +0200
commit895382110b97cde108df418a888a70fe3f40639a (patch)
tree72c37400da94c154f58621e18b43135b2913e642
parent7617115d5ec4e93276eb4f7b6a25accea74b636c (diff)
* digital/io/src
- keep structure removed from r384.
-rw-r--r--digital/io/src/getsamples.c13
-rw-r--r--digital/io/src/getsamples.h21
-rw-r--r--digital/io/src/getsamples_cb.c17
3 files changed, 31 insertions, 20 deletions
diff --git a/digital/io/src/getsamples.c b/digital/io/src/getsamples.c
index 17dee9e8..25c166e9 100644
--- a/digital/io/src/getsamples.c
+++ b/digital/io/src/getsamples.c
@@ -26,22 +26,17 @@
#include "fsm.h"
/**
- * The approach angle to face the distributor.
+ * 'Private' get samples data used internaly by the FSM.
*/
-int16_t approach_angle_;
-
-/**
- * The samples bit field to collect.
- */
-uint8_t sample_bitfield_;
+struct getsamples_data_t getsamples_data_;
/* Start the get samples FSM. */
void
getsamples_start (int16_t approach_angle, uint8_t sample_bitfield)
{
/* Set parameters */
- approach_angle_ = approach_angle;
- sample_bitfield_ = sample_bitfield;
+ getsamples_data_.approach_angle = approach_angle;
+ getsamples_data_.sample_bitfield = sample_bitfield;
/* Start the get samples FSM */
fsm_init (&getsamples_fsm);
diff --git a/digital/io/src/getsamples.h b/digital/io/src/getsamples.h
index e24056e2..70a76696 100644
--- a/digital/io/src/getsamples.h
+++ b/digital/io/src/getsamples.h
@@ -28,6 +28,27 @@
#include "common.h"
/**
+ * Get samples FSM associated data.
+ */
+struct getsamples_data_t
+{
+ /**
+ * The angle to approach to face the distributor.
+ */
+ int16_t approach_angle;
+ /**
+ * Bit-field to indicate where to put the collected samples.
+ * For example, if the bit 0 is set to 1, the sample took will be put into
+ * the box id 0 (out_right_box). Otherwise, if this bit is set to 0, the
+ * out_right box will not be use to store the sample. This parameter is
+ * also used to know the number of samples to collect from the
+ * distributor.
+ */
+ uint8_t sample_bitfield;
+};
+
+
+/**
* Start the get samples FSM.
* @param approach_angle the angle of approach to face the distributor
* @param sample_bitfield a bit-field to indicate where to put the collected
diff --git a/digital/io/src/getsamples_cb.c b/digital/io/src/getsamples_cb.c
index 22fdc959..3ade76a7 100644
--- a/digital/io/src/getsamples_cb.c
+++ b/digital/io/src/getsamples_cb.c
@@ -36,14 +36,9 @@
#include "io.h"
/**
- * The approach angle to face the distributor.
+ * 'Private' get samples data used internaly by the FSM.
*/
-extern int16_t approach_angle_;
-
-/**
- * The samples bit field to collect.
- */
-extern uint8_t sample_bitfield_;
+extern struct getsamples_data_t getsamples_data_;
/**
* Configure the classifier (using the trap and the internal bit field) for
@@ -63,12 +58,12 @@ getsamples_configure_classifier (void)
for (trap_num = 0; trap_num < trap_count; trap_num++)
{
/* Is the bit set? */
- if (bit_is_set (sample_bitfield_, trap_num))
+ if (bit_is_set (getsamples_data_.sample_bitfield, trap_num))
{
/* Configure the classifier */
trap_setup_path_to_box (trap_num);
/* Reset this bit */
- sample_bitfield_ &= ~_BV (trap_num);
+ getsamples_data_.sample_bitfield &= ~_BV (trap_num);
/* Stop here */
return;
}
@@ -126,7 +121,7 @@ fsm_branch_t
getsamples__TAKE_SAMPLES__arm_pass_noted_position (void)
{
/* More samples? */
- if (sample_bitfield_)
+ if (getsamples_data_.sample_bitfield)
{
/* Compute notifier */
uint16_t arm_current_position = asserv_get_arm_position ();
@@ -157,7 +152,7 @@ fsm_branch_t
getsamples__IDLE__start (void)
{
/* Face the distributor */
- asserv_goto_angle (approach_angle_);
+ asserv_goto_angle (getsamples_data_.approach_angle);
return getsamples_next (IDLE, start);
}