From 929dab13061cfe82cce6125dfb4adb40c3ef6639 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Wed, 18 Apr 2012 01:58:17 +0200 Subject: digital/{ai,mimot}: add raw output set --- digital/ai/src/twi_master/mimot.c | 11 +++++++++++ digital/ai/src/twi_master/mimot.h | 4 ++++ 2 files changed, 15 insertions(+) (limited to 'digital/ai/src/twi_master') 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 */ -- cgit v1.2.3