summaryrefslogtreecommitdiff
path: root/analog
diff options
context:
space:
mode:
authorGuillaume Chevillot2008-03-07 16:42:15 +0100
committerGuillaume Chevillot2008-03-07 16:42:15 +0100
commitf19d487349a9746fbb44c85d08e5550cb66d6190 (patch)
tree7ab81581ac6bce0c03bdbd6c2308a539e2114abd /analog
parent5d33a42c66c77fb2cee87269a0f6a4a451b7f4ac (diff)
- We can now send a command to have a PWM above 50%, let's go to the highway...
- Remove of a not needed cast
Diffstat (limited to 'analog')
-rw-r--r--analog/motor-power-avr/src/main.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/analog/motor-power-avr/src/main.c b/analog/motor-power-avr/src/main.c
index 38941011..ce76fe43 100644
--- a/analog/motor-power-avr/src/main.c
+++ b/analog/motor-power-avr/src/main.c
@@ -154,7 +154,7 @@ main_loop (void)
void
proto_callback (uint8_t cmd, uint8_t size, uint8_t *args)
{
-#define c(cmd, size) ((uint16_t)cmd << 8 | size)
+#define c(cmd, size) (cmd << 8 | size)
switch (c (cmd, size))
{
case c ('z', 0):
@@ -171,17 +171,17 @@ proto_callback (uint8_t cmd, uint8_t size, uint8_t *args)
case c ('l', 1):
/* Set pwm value for _L_ side.
- * - 0x80: -max on duty cycle (direction = 0)
+ * - 0x7F: -max on duty cycle (direction = 0)
* - 0x00: 0% on duty cycle (brake state)
* - 0xFF: max on duty cylcle (direction = 1) */
cmd_L_ = (int8_t) args[0];
if (cmd_L_ >= 0)
{
- start_motor_L_(cmd_L_ , 0);
+ start_motor_L_ ((cmd_L_ << 1) , 0);
}
else
{
- start_motor_L_ (-cmd_L_ , 1);
+ start_motor_L_ (((-cmd_L_) << 1), 1);
}
break;
@@ -192,17 +192,17 @@ proto_callback (uint8_t cmd, uint8_t size, uint8_t *args)
case c ('r', 1):
/* Set pwm value for _R_ side.
- * - 0x80: -max on duty cycle (direction = 0)
+ * - 0x7F: -max on duty cycle (direction = 0)
* - 0x00: 0% on duty cycle (brake state)
* - 0xFF: max on duty cylcle (direction = 1) */
cmd_R_ = (int8_t) args[0];
if (cmd_R_ >= 0)
{
- start_motor_R_(cmd_R_ , 0);
+ start_motor_L_ ((cmd_L_ << 1) , 0);
}
else
{
- start_motor_R_ (-cmd_R_ , 1);
+ start_motor_L_ (((-cmd_L_) << 1), 1);
}
break;