Motor

Files at this revision

API Documentation at this revision

Comitter:
Reiko
Date:
Mon Sep 16 17:54:14 2013 +0000
Parent:
5:99fa6dffea40
Parent:
4:2b77f4656e92
Commit message:
Merge

Changed in this revision

motor.h Show annotated file Show diff for this revision Revisions of this file
diff -r 99fa6dffea40 -r 37199f371bf8 motor.h
--- a/motor.h	Mon Sep 16 17:53:13 2013 +0000
+++ b/motor.h	Mon Sep 16 17:54:14 2013 +0000
@@ -4,17 +4,35 @@
 #include "mbed.h"
 #include "PCA9555.h"
 #include "qed.h"
- 
+ /** Class for controlling motors trough PCA9555 */
 class Motor {
 protected:
     FunctionPointer stallWarningCallback;
     FunctionPointer stallErrorCallback;
 public:
+    /** Create an instance of the motor connected to specfied pins, and IO-expander.
+     *
+     * @param PWMpin Pin for PWM output
+     * @param *ioExt Pointer to IO-expander object
+     * @param dir1Pin Direction pin 1 number (on IO-expander)
+     * @param dir2Pin Direction pin 2 number (on IO-expander)
+     * @param encA Encoder pin
+     * @param encB Encoder pin
+     */
     Motor(PinName PWMpin, PCA9555 *ioExt, unsigned int dir1Pin, unsigned int dir2Pin, PinName encA, PinName encB);
- 
-    void setPWM(int newPWM);
+    
+    /** Set speed setpoint
+     *
+     * @param newSpeed New setpoint
+     */
     void setSpeed(int newSpeed);
+    
+    /** Get current speed setpoint value */
     int getSpeed();
+    
+    /**Method that calculates appropriate PWM values for keeping motor speed close to setpoint
+    *     This method shoud be called periodically (60Hz)
+    */
     void pid();
     
     void stallWarning(void (*function)(void));
@@ -43,6 +61,17 @@
     
     void resetPID();
     
+<<<<<<< local
+=======
+    /** Set pwm duty cycle
+     *
+     * @param newPWM Duty cycle
+     */
+    void setPWM(int newPWM);
+    
+    //void pid();
+    
+>>>>>>> other
     int setPoint;
     int pMulti;
     int iDiv;