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

Fork of Gamepad by Craig Evans

Revision:
24:7b149f5d4bef
Parent:
23:34da21dfdfd6
Child:
25:edb07ff38749
--- a/Controller.h	Sat Apr 15 15:39:47 2017 +0000
+++ b/Controller.h	Sun Apr 16 13:45:22 2017 +0000
@@ -19,16 +19,16 @@
 
 
 /** Controller Class
-@brief Library for interfacing with ELEC2645 Controller PCB, University of Leeds
-@author Dr Craig A. Evans
-@author Dr Alex Valanvanis
-@date Febraury 2017
+@brief This Library allows interrupts and petiometers to be implimented easily and coherently in other classes
+@author Dominic KAy
+
+@date April 2017
 */
 class Controller
 {
     public:
     /** Controller events 
- * @brief List of events that can be registered on the Controller
+ * @brief List of all events which are triggered by an interrupt.
  */
 enum ControllerEvent {
     A_PRESSED,     ///< Button A has been pressed
@@ -70,10 +70,6 @@
 
     std::bitset<N_EVENTS> _event_state; ///< A binary list of buttons that has been pressed
 
-    // centred x,y values
-    float _x0;
-    float _y0;
-
 public:
 
     /** Constructor */
@@ -82,53 +78,55 @@
     /** Destructor */
     ~Controller();
 
-    /** Initialise all peripherals and configure interrupts */
+    /** Clear all the interrupt flags and turn off all LEDs */
     void init();
 
-    /** Turn all LEDs on */
-    void leds_on();
+    /** Turn on all the LEDs */
+    void ledsON();
 
-    /** Turn all LEDs off */
-    void leds_off();
+    /** Turn off all the LEDs */
+    void ledsOFF();
 
-    /** Set all LEDs to duty-cycle
-    *@param value in range 0.0 to 1.0
+    /** Set all LEDs to duty-cycle EDIT
+    *@param float value varing from 0.0 to 1.0
     */
     void leds(float val) const;
 
-    /** Set LED to duty-cycle
+    /** Set LED to duty-cycle EDIT
     *@param led number (0 to 5)
     *@param value in range 0.0 to 1.0
     */
     void led(int n,float val) const;
 
     /** Read potentiometer
-    *@returns potentiometer value in range 0.0 to 1.0
+    *@returns value from 0.0 to 1.0 to effect other classes
     */
-    float read_pot() const;
+    float pot_value() const;
 
     /** Play tone on piezo
-    * @param frequency in Hz
-    * @param duration of tone in seconds
+    * @param frequency of sound(Hz)
+    * @param duration of sound(s)
     */
-    void tone(float frequency, float duration);
+    void sound(float frequency, float duration);
 
     /**
-     * @brief Check whether an event flag has been set and clear it
-     * @param id[in] The ID of the event to test
-     * @return true if the event occurred
+     * @brief Checks if a specific flag has been set.
+     * @param id[in] The specific flag ID
+     * @return true if the flag occurred
      */
     bool check_event(ControllerEvent const id);
 
-    /** Get magnitude of joystick movement
-    * @returns value in range 0.0 to 1.0
-    */
+    /**
+     * @brief If a specific flag has 
+     * @param id[in] The specific flag ID
+     * @return true if the flag occurred
+     */
     int check_for_buttons();
 
 
 private:
     void init_buttons();
-    void tone_off();
+    void sound_off();
 
     void a_isr();
     void b_isr();