Mark Peter Vargha / Joystick
Revision:
1:a768d268191b
Parent:
0:f76f52dc57f7
Child:
2:3fdaae41db20
--- a/Joystick.h	Thu Feb 09 19:13:02 2017 +0000
+++ b/Joystick.h	Thu Feb 09 19:32:17 2017 +0000
@@ -1,3 +1,40 @@
+/** Two axis analog joystick driver
+ *
+ * Example:
+ * @code
+ * // Print joystick values
+ *
+ * #include "mbed.h"
+ * #include "Joystick.h"
+ * 
+ * Ticker joysticTicker;
+ * Joystick joystick(PA_1, PA_0); //Two analog in pins
+ * volatile bool processJoystick = false;
+ * 
+ * void isrJoystick()
+ * {
+ *     processJoystick = true;
+ * }
+ * 
+ * int main()
+ * {
+ *     joystick.setFlipX(true);
+ *     joystick.setRange(100);
+ *     while (!joystick.isCalibrated()) joystick.process();
+ *     joysticTicker.attach(&isrJoystick, 0.1);
+ *     while (true)
+ *     {
+ *         if (processJoystick)
+ *         {
+ *             processJoystick = false;
+ *             joystick.process();
+ *             printf("X=%d Y=%d\r\n", joystick.getX(), joystick.getY());
+ *         }
+ *     }
+ * }
+ *
+ */
+
 #ifndef Joystick_h
 #define Joystick_h