A class to control a model R/C servo, using a PwmOut

Dependents:   mbedDemoDisplay mbedDemoDisplay Servo_HelloWorld Initialmbedrobotprogram ... more

Files at this revision

API Documentation at this revision

Comitter:
simon
Date:
Thu Sep 02 17:34:43 2010 +0000
Parent:
2:8995c167f399
Commit message:
Published as library, with new doxygen autodoc

Changed in this revision

Servo.h Show annotated file Show diff for this revision Revisions of this file
diff -r 8995c167f399 -r 36b69a7ced07 Servo.h
--- a/Servo.h	Tue May 18 19:06:10 2010 +0000
+++ b/Servo.h	Thu Sep 02 17:34:43 2010 +0000
@@ -1,5 +1,4 @@
 /* mbed R/C Servo Library
- *  
  * Copyright (c) 2007-2010 sford, cstyles
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -26,77 +25,65 @@
 
 #include "mbed.h"
 
-/* Class: Servo
- *  Servo control class, based on a PwmOut
+/** Servo control class, based on a PwmOut
  *
  * Example:
- * > // Continuously sweep the servo through it's full range
- * > #include "mbed.h"
- * > #include "Servo.h"
- * >
- * > Servo myservo(p21);
- * >
- * > int main() {
- * >     while(1) {
- * >         for(int i=0; i<100; i++) {
- * >             myservo = i/100.0;
- * >             wait(0.01);
- * >         }
- * >         for(int i=100; i>0; i--) {
- * >             myservo = i/100.0;
- * >             wait(0.01);
- * >         }
- * >     }
- * > }
+ * @code
+ * // Continuously sweep the servo through it's full range
+ * #include "mbed.h"
+ * #include "Servo.h"
+ * 
+ * Servo myservo(p21);
+ * 
+ * int main() {
+ *     while(1) {
+ *         for(int i=0; i<100; i++) {
+ *             myservo = i/100.0;
+ *             wait(0.01);
+ *         }
+ *         for(int i=100; i>0; i--) {
+ *             myservo = i/100.0;
+ *             wait(0.01);
+ *         }
+ *     }
+ * }
+ * @endcode
  */
 class Servo {
 
 public:
-    /* Constructor: Servo
-     *  Create a servo object connected to the specified PwmOut pin
+    /** Create a servo object connected to the specified PwmOut pin
      *
-     * Variables:
-     *  pin - PwmOut pin to connect to 
+     * @param pin PwmOut pin to connect to 
      */
     Servo(PinName pin);
     
-    /* Function: write
-     *  Set the servo position, normalised to it's full range
+    /** Set the servo position, normalised to it's full range
      *
-     * Variables:
-     *  percent - A normalised number 0.0-1.0 to represent the full range.
+     * @param percent A normalised number 0.0-1.0 to represent the full range.
      */
     void write(float percent);
     
-    /* Function: read
-     *  Read the servo motors current position
+    /**  Read the servo motors current position
      *
-     * Variables:
-     *  returns - A normalised number 0.0-1.0  representing the full range.
+     * @param returns A normalised number 0.0-1.0  representing the full range.
      */
     float read();
     
-    /* Function: position
-     *  Set the servo position
+    /** Set the servo position
      *
-     * Variables:
-     *  degrees - Servo position in degrees
+     * @param degrees Servo position in degrees
      */
     void position(float degrees);
     
-    /* Function: calibrate
-     *  Allows calibration of the range and angles for a particular servo
-     *
+    /**  Allows calibration of the range and angles for a particular servo
      *
-     * Variables:
-     *  range - Pulsewidth range from center (1.5ms) to maximum/minimum position in seconds
-     *  degrees - Angle from centre to maximum/minimum position in degrees
+     * @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); 
         
-    /* Function: operator=
-     *  Shorthand for the write and read functions
-     */
+    /**  Shorthand for the write and read functions */
     Servo& operator= (float percent);
     Servo& operator= (Servo& rhs);
     operator float();