ELEC2645 (2018/19) / Mbed 2 deprecated el17szs

Dependencies:   mbed

Revision:
20:9d21599fe350
Parent:
6:3e50f2cf4366
--- a/Gamepad/Gamepad.h	Sat Apr 27 18:16:59 2019 +0000
+++ b/Gamepad/Gamepad.h	Tue Apr 30 10:27:23 2019 +0000
@@ -43,15 +43,14 @@
 };
 
 /** Gamepad Class
-@brief Library for interfacing with ELEC2645 Gamepad PCB, University of Leeds
-@author Dr Craig A. Evans
-@author Dr Alex Valanvanis
-@date Febraury 2017
-*/
+ * @brief Library for interfacing with ELEC2645 Gamepad PCB, University of Leeds
+ * @author Dr Craig A. Evans
+ * @author Dr Alex Valavanis
+ */
 class Gamepad
 {
-    public:
-    /** Gamepad events 
+public:
+/** Gamepad events 
  * @brief List of events that can be registered on the gamepad
  */
 enum GamepadEvent {
@@ -66,6 +65,7 @@
     JOY_PRESSED,   ///< Joystick button has been pressed
     N_EVENTS       ///< A dummy flag that marks the end of the list
 };
+
 private:
     mbed::PwmOut *_led1;
     mbed::PwmOut *_led2;
@@ -99,7 +99,6 @@
     float _y0;
 
 public:
-
     /** Constructor */
     Gamepad();
 
@@ -144,10 +143,23 @@
      */
     bool check_event(GamepadEvent const id);
 
+    /**
+     * @brief   Get the raw binary event state
+     * @return  The event state as a binary code
+     * @details The check_event() function is likely to be more useful than
+     *          this, for testing whether a given event has occurred. It can be
+     *          useful for debugging via the terminal, however, for example:
+     *          @code
+     *          std::cout << gamepad.get_raw_event_state() << std::endl;
+     *          @endcode
+     */
+    inline std::bitset<N_EVENTS> get_raw_event_state() const {
+        return _event_state;
+    }
+
     /** Get magnitude of joystick movement
     * @returns value in range 0.0 to 1.0
     */
-
     float get_mag();
 
     /** Get angle of joystick movement