summaryrefslogtreecommitdiff
path: root/analog
diff options
context:
space:
mode:
authorGuillaume Chevillot2008-03-10 20:54:40 +0100
committerGuillaume Chevillot2008-03-10 20:54:40 +0100
commit8bd69b19eb8958e25d654cd17ce9e165012baa0a (patch)
tree633e77f190a0c03baeaab177939c7ac8e8d44550 /analog
parentf20cbaddb60aeda6e300ce4147eaee99fb8e2dfc (diff)
- Add support of 'w' command
- 'r' command works correctly now
Diffstat (limited to 'analog')
-rw-r--r--analog/motor-power-avr/src/main.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/analog/motor-power-avr/src/main.c b/analog/motor-power-avr/src/main.c
index ce76fe43..cccdd6a5 100644
--- a/analog/motor-power-avr/src/main.c
+++ b/analog/motor-power-avr/src/main.c
@@ -198,14 +198,28 @@ proto_callback (uint8_t cmd, uint8_t size, uint8_t *args)
cmd_R_ = (int8_t) args[0];
if (cmd_R_ >= 0)
{
- start_motor_L_ ((cmd_L_ << 1) , 0);
+ start_motor_R_ ((cmd_R_ << 1) , 0);
}
else
{
- start_motor_L_ (((-cmd_L_) << 1), 1);
+ start_motor_R_ (((-cmd_R_) << 1), 1);
}
break;
+ case c ('w', 0):
+ /* Set zero pwm. */
+ start_motor_L_ ( 0, 0);
+ start_motor_R_ ( 0, 0);
+ break;
+
+ case c ('w', 4):
+ /* Set pwm.
+ * - w: left pwm.
+ * - w: right pwm. */
+ start_motor_L_ ( v8_to_v16 (args[0], args[1]) >> 7, (int8_t)args[0] < 0);
+ start_motor_R_ ( v8_to_v16 (args[2], args[3]) >> 7, (int8_t)args[2] < 0);
+ break;
+
case c ('e', 0):
/* Get environnemental test results */
//TODO