summaryrefslogtreecommitdiff
path: root/digital
diff options
context:
space:
mode:
Diffstat (limited to 'digital')
-rw-r--r--digital/ai/src/twi_master/mimot.c11
-rw-r--r--digital/ai/src/twi_master/mimot.h4
-rw-r--r--digital/mimot/src/dirty/twi_proto.c12
3 files changed, 27 insertions, 0 deletions
diff --git a/digital/ai/src/twi_master/mimot.c b/digital/ai/src/twi_master/mimot.c
index cc66a280..6346f7b9 100644
--- a/digital/ai/src/twi_master/mimot.c
+++ b/digital/ai/src/twi_master/mimot.c
@@ -257,3 +257,14 @@ mimot_motor1_free (void)
twi_master_send_buffer (2);
}
+void
+mimot_motor_output_set (uint8_t motor, int16_t pwm)
+{
+ uint8_t *buffer = twi_master_get_buffer (MIMOT_SLAVE);
+ buffer[0] = 'W';
+ buffer[1] = motor;
+ buffer[2] = v16_to_v8 (pwm, 1);
+ buffer[3] = v16_to_v8 (pwm, 0);
+ twi_master_send_buffer (4);
+}
+
diff --git a/digital/ai/src/twi_master/mimot.h b/digital/ai/src/twi_master/mimot.h
index 35b2dfbe..157ab4e1 100644
--- a/digital/ai/src/twi_master/mimot.h
+++ b/digital/ai/src/twi_master/mimot.h
@@ -122,4 +122,8 @@ mimot_motor0_free (void);
void
mimot_motor1_free (void);
+/** Set raw output for motor. */
+void
+mimot_motor_output_set (uint8_t motor, int16_t pwm);
+
#endif /* mimot_h */
diff --git a/digital/mimot/src/dirty/twi_proto.c b/digital/mimot/src/dirty/twi_proto.c
index a61d3d6c..3ac4b8a4 100644
--- a/digital/mimot/src/dirty/twi_proto.c
+++ b/digital/mimot/src/dirty/twi_proto.c
@@ -167,6 +167,18 @@ twi_proto_callback (u8 *buf, u8 size)
else
buf[0] = 0;
break;
+ case c ('W', 3):
+ /* Set motor output.
+ * - b: aux index.
+ * - w: value. */
+ if (buf[2] < AC_ASSERV_AUX_NB)
+ {
+ output_set (&output_aux[buf[2]], v8_to_v16 (buf[3], buf[4]));
+ control_state_set_mode (&cs_aux[buf[2]].state, CS_MODE_NONE, 0);
+ }
+ else
+ buf[0] = 0;
+ break;
case c ('p', x):
/* Set parameters. */
if (twi_proto_params (&buf[2], size - 2) != 0)