summaryrefslogtreecommitdiff
path: root/digital/asserv/src/asserv/state.h
diff options
context:
space:
mode:
authorNicolas Schodet2008-03-25 23:04:07 +0100
committerNicolas Schodet2008-03-25 23:04:07 +0100
commit1ea652e0d5185aee5ca60182302d7bb2d4056b46 (patch)
treea7a7b538b534a55c8f796448ffa72512d659e297 /digital/asserv/src/asserv/state.h
parent5b4cd3acddcf2ef7ad5c383fb93a0c27718f4da3 (diff)
* digital/asserv/src/asserv:
- better blocked state handling, now deactivate all motor control on blocking.
Diffstat (limited to 'digital/asserv/src/asserv/state.h')
-rw-r--r--digital/asserv/src/asserv/state.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/digital/asserv/src/asserv/state.h b/digital/asserv/src/asserv/state.h
index 49ae1e60..2a5e642c 100644
--- a/digital/asserv/src/asserv/state.h
+++ b/digital/asserv/src/asserv/state.h
@@ -83,6 +83,7 @@ state_start (struct state_t *motor, uint8_t sequence)
{
motor->sequence = sequence;
motor->finished = 0;
+ motor->blocked = 0;
}
/** Signal the current command completion. */
@@ -93,21 +94,26 @@ state_finish (struct state_t *motor)
motor->finished = 1;
}
-/** Signal the current command completion. */
+/** Signal the current command is blocked, disable motor control until a new
+ * command is given. */
static inline void
state_blocked (struct state_t *motor)
{
motor->sequence_finish = motor->sequence | 0x80;
motor->blocked = 1;
+ motor->mode = MODE_PWM;
}
-/** Acknowledge a command completion. */
+/** Acknowledge a command completion and blocked state. */
static inline void
state_acknowledge (struct state_t *motor, uint8_t sequence)
{
motor->sequence_ack = sequence;
if (sequence == motor->sequence_finish)
+ {
+ motor->finished = 0;
motor->blocked = 0;
+ }
}
#endif /* state_h */