Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: motordriver.h
- Revision:
- 2:2dc873322032
- Parent:
- 1:3da7302dc9ae
- Child:
- 4:5fb1296c0d60
--- a/motordriver.h Thu Nov 11 15:32:55 2010 +0000
+++ b/motordriver.h Fri Nov 19 12:32:06 2010 +0000
@@ -42,35 +42,38 @@
* @param pwm A PwmOut pin, driving the H-bridge enable line to control the speed
* @param fwd A DigitalOut, set high when the motor should go forward
* @param rev A DigitalOut, set high when the motor should go backwards
-* @param set if the motor driver is able to do braking 0 false 1 true. (addition)
+* @param set if the motor driver is able to do braking 0 false 1 true.
*/
Motor(PinName pwm, PinName fwd, PinName rev, int brakeable);
-/** Set the speed of the motor (addition)
+/** Set the speed of the motor
*
-* @param speed The speed of the motor as a normalised value between -1.0 and 1.0
+* @param speed The speed of the motor as a normalised value between -1.0 and 1.0.
+* @return the applied speed to the motor after checking to ensure motor doesn't switch from forward to reverse without stopping.
*/
- void speed(float speed);
+ float speed(float speed);
/** Set the the motor to coast
*
-* @param void motor coasts until another instruction is recived
+* @param void
+* @return motor coasts until another instruction is recived.
*/
void coast(void);
-/** Set the motor to dynamicaly brake (addition)
+/** Set the motor to dynamicaly brake
*
-* @param void motor dynamicaly brakes until another instruction is recived
+* @param float 0 - 1.0 provides some control over how hard the motor brakes.
+* @return duty applied to motor driver. -1 is error, motor driver can't brake.
*/
- void stop(void);
+ float stop(float duty);
protected:
PwmOut _pwm;
DigitalOut _fwd;
DigitalOut _rev;
- int Brakeable; // (addition)
+ int Brakeable; // cna the motor driver break
int sign; //prevents throwing the motor from full foward to full reverse and stuff melting.
};