added gy80 dcm

Dependencies:   mbed DCM_AHRS_GY80 PID MMA8451Q

Fork of quadCommand by Greg Abdo

Revision:
56:a550127695b2
Parent:
55:bca9c9e92da6
Child:
57:c29f2dac3903
--- a/quadCommand/motor/motor.cpp	Thu Jun 13 01:11:03 2013 +0000
+++ b/quadCommand/motor/motor.cpp	Tue Jul 02 21:03:46 2013 +0000
@@ -14,9 +14,10 @@
 /*to default safe valuse.                                                */
 /*************************************************************************/
 
-motor::motor( PinName pin ) : _pwm(pin)
+motor::motor( PinName pin ) 
 {
-    _pwm.period( 0.020 );       // Set the period to 20ms.
+    pwmPin = new PwmOut( pin );
+    pwmPin->period( 0.020 );       // Set the period to 20ms.
     setPulseMin( 0.001150 );    // Set default min pulse.
     setPulseMax( 0.002 );       // Set default max pulse.
     setSpeed( 0 );              // Set motor to stopped.
@@ -27,7 +28,7 @@
 /*the motor based on passed in percent value of speed.                   */
 /*************************************************************************/
 
-void motor::setSpeed( float value )
+void motor::setSpeed( int value )
 {
     // Is the value to small?
     if( value - trim  < 0 )             // Yup, just set to 0.
@@ -42,8 +43,8 @@
         currentSpeed = value + trim;   // Set the new value.
 
     // Calculate the value based on pulseMin, pulseMax and currentSpeed.
-    pulse = ((pulseMax - pulseMin ) / 100 * currentSpeed ) + pulseMin;
-    _pwm.pulsewidth( pulse );   // Write the pulse to the pin.
+    pulse = ((pulseMax - pulseMin) / 100 * currentSpeed) + pulseMin;
+    pwmPin->pulsewidth( pulse );   // Write the pulse to the pin.
 }
 
 /************************** setPulseMin( float ) *************************/
@@ -77,7 +78,7 @@
 /*                                                                       */
 /*************************************************************************/
 
-float motor::getSpeed()
+int motor::getSpeed()
 {
     return currentSpeed;
 }
\ No newline at end of file