Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 19:c2bb79a10b3c, committed 2017-04-25
- Comitter:
- valavanisalex
- Date:
- Tue Apr 25 10:19:47 2017 +0000
- Parent:
- 18:e0a4f15a7750
- Child:
- 20:c0959710291b
- Commit message:
- Add get_raw_event_state() method for debugging
Changed in this revision
| Gamepad.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/Gamepad.h Sun Mar 05 19:28:14 2017 +0000
+++ b/Gamepad.h Tue Apr 25 10:19:47 2017 +0000
@@ -50,8 +50,8 @@
*/
class Gamepad
{
- public:
- /** Gamepad events
+public:
+/** Gamepad events
* @brief List of events that can be registered on the gamepad
*/
enum GamepadEvent {
@@ -66,6 +66,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 +100,6 @@
float _y0;
public:
-
/** Constructor */
Gamepad();
@@ -144,10 +144,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