Library for using the TLC5940 as a servo controller.

Dependencies:   FastPWM

Dependents:   TLC5940ServoTest

Revision:
5:56daa8c0697d
Parent:
4:95305d4b0544
Child:
6:b001282e967b
--- a/TLC5940Servo.h	Tue Oct 21 06:14:58 2014 +0000
+++ b/TLC5940Servo.h	Tue Oct 21 06:26:25 2014 +0000
@@ -36,24 +36,56 @@
      */
     class Servo {
     public:
+        /**
+         * Creat a servo object NOT connected to a specific PwmOut pin
+         */
         Servo();
+
         /** 
          * Set the servo position, normalised to it's full range
          *
          * @param percent A normalised number 0.0-1.0 to represent the full range.
          */
         void write(float percent);
-        void calibrate(float range=0.0005, float degrees=45.0);
+
+        /**  
+         * Read the servo motors current position
+         *
+         * @param returns A normalised number 0.0-1.0  representing the full range.
+         */
         float read();
+        
+        /** 
+         * Set the servo position
+         *
+         * @param degrees Servo position in degrees
+         */
+        void position(float degrees);
+    
+        /**
+         * Allows calibration of the range and angles for a particular servo
+         *
+         * @param range Pulsewidth range from center (1.5ms) to maximum/minimum position in seconds
+         * @param degrees Angle from centre to maximum/minimum position in degrees
+         */
+        void calibrate(float range=0.0005, float degrees=45.0);
+        
+        /**
+         * Read the servo motors current TLC5940 pw value
+         */
         int pulsewidth();
+        
+        /**  Shorthand for the write and read functions */
         Servo& operator= (float percent);
+        Servo& operator= (Servo& rhs);
         operator float();
     private:
-        float _p;
         float _range;
         float _degrees;
+        float _p;
         int _pw;
     };
+
     /**
       * Set up the TLC5940
       *