justin solarski / Gyro
Revision:
0:c06aa9ff9c62
Child:
1:a3822b798d67
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gyro.h	Tue Dec 21 06:05:59 2010 +0000
@@ -0,0 +1,76 @@
+/* mbed analog gyro Library
+ * Copyright (c) 2010 Justin Solarski
+ * justinsolarski@gmail.com
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef GYRO_H
+#define GYRO_H
+
+#include "mbed.h"
+/** Class: Gyro
+ *
+ * Used for reading from an analog Gyro Tested with LISY300Al spark fun breakout board
+ * http://www.sparkfun.com/products/8955
+ * 300o/S
+ *
+ * Example:
+ *
+ * > #include "mbed.h"
+ * > #include "gyro.h"
+ * > Gyro mygyro(p20, p19, p18);
+ */
+class Gyro  {
+public:
+/** constructor Gyro - create Gyro object
+ * 
+ * @param g_pin = analog in pin
+ * @param st = self test pin
+ * @param pd = powerdown
+ */
+    Gyro (PinName g_pin, PinName st, PinName pd);
+/** read gyros analog pin 
+ *
+ * outputs 0.0-1.0 
+ *
+ */
+    float read();
+/** Use the self test mode to test if the gyro is working
+ *
+ * Returns 0 for test passed 1 for test failed 
+ */
+    int test();
+/** put gyro into sleep mode
+ * Incomplete
+ */
+    void sleep();
+/** wake gyro up from sleep mode (default)
+ *
+ */
+    void wakeup();
+
+private :
+    AnalogIn _g_pin;
+    DigitalInOut _st;
+    DigitalInOut _pd;
+
+}; //end of class sensor
+
+#endif
\ No newline at end of file