From 9c07aa3d09e486f2958c47c1be452e42e2873744 Mon Sep 17 00:00:00 2001 From: Jérémy Dufour Date: Wed, 30 Apr 2008 21:01:53 +0200 Subject: * digital/io/src - add function into the asserv module to support the goto backward. --- digital/io/src/asserv.c | 19 +++++++++++++++++++ digital/io/src/asserv.h | 8 ++++++++ 2 files changed, 27 insertions(+) (limited to 'digital/io/src') 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 @@ -285,6 +285,14 @@ asserv_set_position (int32_t x, int32_t y, int16_t angle); 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 -- cgit v1.2.3