summaryrefslogtreecommitdiff
path: root/digital/io-hub/src/robospierre/clamp.h
diff options
context:
space:
mode:
Diffstat (limited to 'digital/io-hub/src/robospierre/clamp.h')
-rw-r--r--digital/io-hub/src/robospierre/clamp.h50
1 files changed, 49 insertions, 1 deletions
diff --git a/digital/io-hub/src/robospierre/clamp.h b/digital/io-hub/src/robospierre/clamp.h
index 104e3cb8..76dcc34b 100644
--- a/digital/io-hub/src/robospierre/clamp.h
+++ b/digital/io-hub/src/robospierre/clamp.h
@@ -36,10 +36,20 @@ enum {
CLAMP_SLOT_SIDE,
/** Leave the front bay, ready to enter side tunnel. */
CLAMP_BAY_FRONT_LEAVE,
+ /** Leaving the front bay, entered the side tunnel. When at midway point,
+ * go directly to the next position. */
+ CLAMP_BAY_FRONT_LEAVING,
/** Leave the back bay, ready to enter side tunnel. */
CLAMP_BAY_BACK_LEAVE,
- /* Enter the side bay. Position on the side, above wheels. */
+ /** Leaving the back bay, entered the side tunnel. When at midway point,
+ * go directly to the next position. */
+ CLAMP_BAY_BACK_LEAVING,
+ /** Enter the side bay. Position on the side, above wheels. */
CLAMP_BAY_SIDE_ENTER_LEAVE,
+ /** Total number of position, including intermediary positions. */
+ CLAMP_POS_NB,
+ /** Number of slots. */
+ CLAMP_SLOT_NB = CLAMP_SLOT_SIDE + 1,
};
/** Is slot in front bay? */
@@ -50,8 +60,46 @@ enum {
#define CLAMP_IS_SLOT_IN_BACK_BAY(slot) \
((slot) >= CLAMP_SLOT_BACK_BOTTOM && (slot) <= CLAMP_SLOT_BACK_TOP)
+/** Initialise clamp module. */
+void
+clamp_init (void);
+
+/** Is clamp working? */
+uint8_t
+clamp_working (void);
+
/** Move clamp to given position. */
void
clamp_move (uint8_t pos);
+/** Move element using clamp. */
+void
+clamp_move_element (uint8_t from, uint8_t to);
+
+/** Simulate the presence of a new element. */
+void
+clamp_new_element (uint8_t pos, uint8_t element_type);
+
+/** Change logisitic preparation level and update clamp state. */
+void
+clamp_prepare (uint8_t prepare);
+
+/** Drop an element tower. Return 0 if not currently possible. If
+ * drop_direction is forward, drop at the back. */
+uint8_t
+clamp_drop (uint8_t drop_direction);
+
+/** Signal robot advanced, and drop is finished. */
+void
+clamp_drop_clear (void);
+
+/** Open/close door (pos = slot) or clamp (pos = 0xff). */
+void
+clamp_door (uint8_t pos, uint8_t open);
+
+/** Examine sensors to generate new events, return non zero if an event was
+ * generated. */
+uint8_t
+clamp_handle_event (void);
+
#endif /* clamp_h */