summaryrefslogtreecommitdiff
path: root/digital/ai/src/twi_master
diff options
context:
space:
mode:
Diffstat (limited to 'digital/ai/src/twi_master')
-rw-r--r--digital/ai/src/twi_master/asserv.c13
-rw-r--r--digital/ai/src/twi_master/asserv.h4
-rw-r--r--digital/ai/src/twi_master/mimot.c16
-rw-r--r--digital/ai/src/twi_master/mimot.h8
4 files changed, 23 insertions, 18 deletions
diff --git a/digital/ai/src/twi_master/asserv.c b/digital/ai/src/twi_master/asserv.c
index ad36e00b..cff3587b 100644
--- a/digital/ai/src/twi_master/asserv.c
+++ b/digital/ai/src/twi_master/asserv.c
@@ -420,6 +420,19 @@ asserv_set_speed (uint16_t linear_high, uint16_t angular_high,
}
void
+asserv_set_acc (uint16_t linear, uint16_t angular)
+{
+ uint8_t *buffer = twi_master_get_buffer (TWI_MASTER_ID_ASSERV);
+ buffer[0] = 'p';
+ buffer[1] = 'a';
+ buffer[2] = v16_to_v8 (linear, 1);
+ buffer[3] = v16_to_v8 (linear, 0);
+ buffer[4] = v16_to_v8 (angular, 1);
+ buffer[5] = v16_to_v8 (angular, 0);
+ twi_master_send_buffer (6);
+}
+
+void
asserv_set_position (int32_t x, int32_t y, int16_t angle)
{
x = fixed_mul_f824 (x, asserv_scale_inv);
diff --git a/digital/ai/src/twi_master/asserv.h b/digital/ai/src/twi_master/asserv.h
index 1cbcb187..ac2ba146 100644
--- a/digital/ai/src/twi_master/asserv.h
+++ b/digital/ai/src/twi_master/asserv.h
@@ -271,6 +271,10 @@ void
asserv_set_speed (uint16_t linear_high, uint16_t angular_high,
uint16_t linear_low, uint16_t angular_low);
+/** Set acceleration. */
+void
+asserv_set_acc (uint16_t linear, uint16_t angular);
+
/**
* Set the complete position of the bot.
* This is an helpful function preventing you from calling multiples other
diff --git a/digital/ai/src/twi_master/mimot.c b/digital/ai/src/twi_master/mimot.c
index 6663f81f..ff73fdb7 100644
--- a/digital/ai/src/twi_master/mimot.c
+++ b/digital/ai/src/twi_master/mimot.c
@@ -240,21 +240,13 @@ mimot_motor1_clamp (int16_t speed, int16_t pwm)
}
void
-mimot_motor0_free (void)
+mimot_motor_free (uint8_t motor, uint8_t brake)
{
uint8_t *buffer = twi_master_get_buffer (TWI_MASTER_ID_MIMOT);
buffer[0] = 'w';
- buffer[1] = 0;
- twi_master_send_buffer (2);
-}
-
-void
-mimot_motor1_free (void)
-{
- uint8_t *buffer = twi_master_get_buffer (TWI_MASTER_ID_MIMOT);
- buffer[0] = 'w';
- buffer[1] = 1;
- twi_master_send_buffer (2);
+ buffer[1] = motor;
+ buffer[2] = brake;
+ twi_master_send_buffer (3);
}
void
diff --git a/digital/ai/src/twi_master/mimot.h b/digital/ai/src/twi_master/mimot.h
index 78806154..78f0a8c9 100644
--- a/digital/ai/src/twi_master/mimot.h
+++ b/digital/ai/src/twi_master/mimot.h
@@ -111,13 +111,9 @@ mimot_motor0_clamp (int16_t speed, int16_t pwm);
void
mimot_motor1_clamp (int16_t speed, int16_t pwm);
-/** Free motor0. */
+/** Free motor. */
void
-mimot_motor0_free (void);
-
-/** Free motor1. */
-void
-mimot_motor1_free (void);
+mimot_motor_free (uint8_t motor, uint8_t brake);
/** Set raw output for motor. */
void