summaryrefslogtreecommitdiff
path: root/digital/io/src/asserv.c
diff options
context:
space:
mode:
authorJérémy Dufour2008-04-14 12:04:45 +0200
committerJérémy Dufour2008-04-14 12:04:45 +0200
commit203525d84bafff3b1f9fcfff4b0f51bb45c7fa0e (patch)
tree15669fabc5ec8cd538a7f462769b8a616f4b9d0a /digital/io/src/asserv.c
parent011fd3e4e4d252d02df156a7679c6156cdc72c6a (diff)
* digital/io/src
- add notifier for the desired arm position ; - integrate it in the get samples FSM.
Diffstat (limited to 'digital/io/src/asserv.c')
-rw-r--r--digital/io/src/asserv.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/digital/io/src/asserv.c b/digital/io/src/asserv.c
index 0b801a13..60720f34 100644
--- a/digital/io/src/asserv.c
+++ b/digital/io/src/asserv.c
@@ -89,6 +89,11 @@ static uint8_t asserv_retransmit_counter;
static uint8_t asserv_retransmit_length;
/**
+ * The arm position of notification for the get sample FSM.
+ */
+static uint16_t asserv_arm_notify_position;
+
+/**
* Update TWI module until request (send or receive) is finished.
* This functions is blocking.
*/
@@ -475,3 +480,24 @@ asserv_goto (uint32_t x, uint32_t y)
{
}
+/* Notify get samples FSM when the arm reach desired position. */
+void
+asserv_arm_set_position_reached (uint16_t position)
+{
+ /* Store the position */
+ asserv_arm_notify_position = position;
+}
+
+/* Check if notification of the get sample FSM is required in term of position
+ * of the arm.
+ */
+uint8_t
+asserv_arm_position_reached (void)
+{
+ /* If the position has been reached */
+ /* TODO: manage overflow! */
+ if (asserv_arm_notify_position &&
+ (asserv_get_arm_position () >= asserv_arm_notify_position))
+ return 1;
+ return 0;
+}