summaryrefslogtreecommitdiff
path: root/digital/io/src/asserv.c
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/io/src/asserv.c
parentd452d1a32c0e6839118102c820e76d66f619c5ad (diff)
* digital/io/src
- add function into the asserv module to support the goto backward.
Diffstat (limited to 'digital/io/src/asserv.c')
-rw-r--r--digital/io/src/asserv.c19
1 files changed, 19 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)