Simple Interface for Toshiba's TB6612FNG H-Bridge Motor Driver
Diff: TB6612FNG.h
- Revision:
- 2:73d5d7514e4c
- Parent:
- 1:3dd9137a5cec
- Child:
- 3:1ae4f0bb91c6
--- a/TB6612FNG.h Wed Mar 06 19:59:50 2013 +0000 +++ b/TB6612FNG.h Wed Mar 06 20:45:57 2013 +0000 @@ -1,12 +1,9 @@ -/** - * H-Bridge / Motor Driver TB6612FNG Control Library - */ - #ifndef TB6612FNG_H #define TB6612FNG_H #include "mbed.h" +/// Simple Interface for Toshiba's TB6612FNG H-Bridge Motor Driver class TB6612FNG { PwmOut m_pwm; @@ -19,14 +16,16 @@ public: /** Create TB6612FNG object connected to the specified mbed pins - * @param pwm PwmOut pin - * @param ctrl1/ctrl2 DigitalOut control pin - * @param pwmPeriod is the PWM period setting in µs - * @param brakeOnZeroDC if true the motor brakes on zero pulse width setting + * @param pwm PwmOut pin name + * @param ctrl1/ctrl2 DigitalOut control pin name + * @param pwmPeriod sets the PWM period (µs) + * @param brakeOnZeroDC true: The motor brakes on zero pulse width setting. + * false: The motor output is set to high impedance */ TB6612FNG(PinName pwm, PinName ctrl1, PinName ctrl2, int pwmPeriod=1000, bool brakeOnZeroDC=true); - /// Set the duty cycle - /// @param pw is the PWM pulse width setting in µs + /** Sets the PWM pulse width + * @param pw is the PWM pulse width setting in µs + */ void setPulseWidth(int pw); /// activates the motor at duty cycle adjusted with setPulseWidth void on(); @@ -34,8 +33,9 @@ void off(); /// brakes the motor by shorting it void brake(); - /// pulse width assignment - /// @param pw is the PWM pulse width setting in µs + /** pulse width assignment + * @param pw is the PWM pulse width setting in µs + */ void operator=(int pw) { setPulseWidth(pw); }