summaryrefslogtreecommitdiff
path: root/digital
diff options
context:
space:
mode:
authorJérémy Dufour2008-04-30 21:01:53 +0200
committerJérémy Dufour2008-04-30 21:01:53 +0200
commit9c07aa3d09e486f2958c47c1be452e42e2873744 (patch)
tree6720d70e29a2b26e5b772dba18c1f2e39b731c0e /digital
parentd452d1a32c0e6839118102c820e76d66f619c5ad (diff)
* digital/io/src
- add function into the asserv module to support the goto backward.
Diffstat (limited to 'digital')
-rw-r--r--digital/io/src/asserv.c19
-rw-r--r--digital/io/src/asserv.h8
2 files changed, 27 insertions, 0 deletions
diff --git a/digital/io/src/asserv.c b/digital/io/src/asserv.c
index 2505da88..a38245b4 100644
--- a/digital/io/src/asserv.c
+++ b/digital/io/src/asserv.c
@@ -549,6 +549,25 @@ asserv_goto (uint32_t x, uint32_t y)
asserv_twi_send_command ('x', 6);
}
+/* Go to an absolute position at (X, Y) with backward enabled. */
+void
+asserv_goto_back (uint32_t x, uint32_t y)
+{
+ x = fixed_mul_f824 (x, asserv_scale_inv);
+ y = fixed_mul_f824 (y, asserv_scale_inv);
+ /* Put X as parameter */
+ asserv_twi_buffer_param[0] = v32_to_v8 (x, 2);
+ asserv_twi_buffer_param[1] = v32_to_v8 (x, 1);
+ asserv_twi_buffer_param[2] = v32_to_v8 (x, 0);
+ /* Put Y as parameter */
+ asserv_twi_buffer_param[3] = v32_to_v8 (y, 2);
+ asserv_twi_buffer_param[4] = v32_to_v8 (y, 1);
+ asserv_twi_buffer_param[5] = v32_to_v8 (y, 0);
+ /* Send the goto to an absolute position with backward enabled command to
+ * the asserv board */
+ asserv_twi_send_command ('r', 6);
+}
+
/* Notify get samples FSM when the arm reach desired position. */
void
asserv_arm_set_position_reached (uint16_t position)
diff --git a/digital/io/src/asserv.h b/digital/io/src/asserv.h
index ebadf188..767ebf15 100644
--- a/digital/io/src/asserv.h
+++ b/digital/io/src/asserv.h
@@ -286,6 +286,14 @@ void
asserv_goto (uint32_t x, uint32_t y);
/**
+ * Go to an absolute position at (X, Y) with backward enabled.
+ * @param x the x position on the table.
+ * @param y the y position on the table.
+ */
+void
+asserv_goto_back (uint32_t x, uint32_t y);
+
+/**
* Set the notifier of get samples FSM when the arm reach desired position.
* You should called this function from the get sample FSM to tell the asserv
* module you want to be notified when the arm reached the desired position.