summaryrefslogtreecommitdiffhomepage
path: root/digital/io/src
diff options
context:
space:
mode:
Diffstat (limited to 'digital/io/src')
-rw-r--r--digital/io/src/simu.host.c12
-rw-r--r--digital/io/src/simu.host.h14
2 files changed, 25 insertions, 1 deletions
diff --git a/digital/io/src/simu.host.c b/digital/io/src/simu.host.c
index 5b1da61f..134d0ba4 100644
--- a/digital/io/src/simu.host.c
+++ b/digital/io/src/simu.host.c
@@ -44,6 +44,7 @@ enum
MSG_SIMU_IO_PATH = 0xb4,
MSG_SIMU_IO_PWM = 0xb5,
MSG_SIMU_IO_CONTACT = 0xb6,
+ MSG_SIMU_IO_POS_REPORT = 0xb7,
};
/** Requested servo position. */
@@ -243,3 +244,14 @@ simu_send_path (uint16_t *points, uint8_t len,
mex_node_send (m);
}
+void
+simu_send_pos_report (vect_t *pos, uint8_t pos_nb, uint8_t id)
+{
+ mex_msg_t *m;
+ m = mex_msg_new (MSG_SIMU_IO_POS_REPORT);
+ mex_msg_push (m, "b", id);
+ for (; pos_nb; pos++, pos_nb--)
+ mex_msg_push (m, "hh", pos->x, pos->y);
+ mex_node_send (m);
+}
+
diff --git a/digital/io/src/simu.host.h b/digital/io/src/simu.host.h
index f314db87..f885a1c5 100644
--- a/digital/io/src/simu.host.h
+++ b/digital/io/src/simu.host.h
@@ -26,6 +26,7 @@
* }}} */
#include "common.h"
+#include "modules/math/geometry/vect.h"
#ifdef HOST
@@ -47,6 +48,17 @@ switch_get_color (void);
uint8_t
switch_get_jack (void);
-#endif /* defined (HOST) */
+/** Send general purpose positions to indicate computation results.
+ * - pos: array of positions to report.
+ * - pos_nb: number of elements in the array.
+ * - id: identifier so that several unrelated positions could be reported. */
+void
+simu_send_pos_report (vect_t *pos, uint8_t pos_nb, uint8_t id);
+
+#else /* !defined (HOST) */
+
+#define simu_send_pos_report(pos, pos_nb, id) ((void) 0)
+
+#endif /* !defined (HOST) */
#endif /* simu_host_h */