This Class allows the joystick, buttons and petiometers to be implemented easily and coherently in other classes

Fork of Gamepad by Craig Evans

Revision:
23:34da21dfdfd6
Parent:
21:99ec20695524
Child:
24:7b149f5d4bef
diff -r 2f5a009a82a6 -r 34da21dfdfd6 Controller.h
--- a/Controller.h	Wed Apr 12 23:47:06 2017 +0000
+++ b/Controller.h	Sat Apr 15 15:39:47 2017 +0000
@@ -3,9 +3,7 @@
 
 #include <bitset>
 #include "mbed.h"
-#include "N5110.h"
-#include "Display.h" 
-#include "Controller.h"  
+
 
 
 // Forward declaration of the classes that we use from the mbed library
@@ -19,33 +17,6 @@
 class Timeout;
 }
 
-#define TOL 0.1f
-#define RAD2DEG 57.2957795131f
-
-/** Enum for direction */
-enum Direction {
-    CENTRE,  /**< joystick centred */
-    N,       /**< pushed North (0)*/
-    NE,      /**< pushed North-East (45) */
-    E,       /**< pushed East (90) */
-    SE,      /**< pushed South-East (135) */
-    S,       /**< pushed South (180) */
-    SW,      /**< pushed South-West (225) */
-    W,       /**< pushed West (270) */
-    NW       /**< pushed North-West (315) */
-};
-
-/** Vector 2D struct */
-struct Vector2D {
-    float x; /**< float for x value */
-    float y; /**< float for y value */
-};
-
-/** Polar coordinate struct */
-struct Polar {
-    float mag;  /**< float for magnitude */
-    float angle; /**< float for angle (in degrees) */
-};
 
 /** Controller Class
 @brief Library for interfacing with ELEC2645 Controller PCB, University of Leeds
@@ -153,31 +124,7 @@
     * @returns value in range 0.0 to 1.0
     */
     int check_for_buttons();
-    float get_mag();
 
-    /** Get angle of joystick movement
-    * @returns value in range 0.0 to 359.9. 0.0 corresponds to N, 180.0 to S. -1.0 is central
-    */
-    float get_angle();
-    /** Gets joystick direction
-    * @returns an enum: CENTRE, N, NE, E, SE, S, SW, W, NW,
-    */
-    Direction get_direction();    // N,NE,E,SE etc.
-
-    /** Gets raw cartesian co-ordinates of joystick
-    * @returns a struct with x,y members, each in the range 0.0 to 1.0
-    */
-    Vector2D get_coord();         // cartesian co-ordinates x,y
-
-    /** Gets cartesian coordinates mapped to circular grid
-    * @returns a struct with x,y members, each in the range 0.0 to 1.0
-    */
-    Vector2D get_mapped_coord();  // x,y mapped to circle
-
-    /** Gets polar coordinates of the joystick
-    * @returns a struct contains mag and angle
-    */
-    Polar get_polar();            // mag and angle in struct form
 
 private:
     void init_buttons();