A rouge-like rpg, heavily inspired on the binding of isaac. Running on a FRDM-K64F Mbed board. C++.

Dependencies:   mbed MotionSensor

Revision:
9:304079450898
Parent:
0:8e92b66a0755
Child:
21:be18f33da757
--- a/Gamepad/Gamepad.cpp	Sat Apr 20 22:51:55 2019 +0000
+++ b/Gamepad/Gamepad.cpp	Sat Apr 20 22:58:15 2019 +0000
@@ -142,7 +142,7 @@
 {
     // Check whether event flag is set
     if (_event_state[id]) {
-        _event_state.reset(id);  // clear flag
+//        _event_state.reset(id);  // clear flag
         return true;
     } else {
         return false;
@@ -225,6 +225,16 @@
     _button_start->rise(callback(this,&Gamepad::start_isr));
     _button_back->rise(callback(this,&Gamepad::back_isr));
     _button_joystick->rise(callback(this,&Gamepad::joy_isr));
+    // therefore setup falling edge interrupts
+    _button_A->fall(callback(this,&Gamepad::a_reset_isr));
+    _button_B->fall(callback(this,&Gamepad::b_reset_isr));
+    _button_X->fall(callback(this,&Gamepad::x_reset_isr));
+    _button_Y->fall(callback(this,&Gamepad::y_reset_isr));
+    _button_L->fall(callback(this,&Gamepad::l_reset_isr));
+    _button_R->fall(callback(this,&Gamepad::r_reset_isr));
+    _button_start->fall(callback(this,&Gamepad::start_reset_isr));
+    _button_back->fall(callback(this,&Gamepad::back_reset_isr));
+    _button_joystick->fall(callback(this,&Gamepad::joy_reset_isr));
 }
 
 // button interrupts ISRs
@@ -267,6 +277,46 @@
     _event_state.set(JOY_PRESSED);
 }
 
+// button interrupts ISRs
+// Each of these simply resets the appropriate event bit in the _event_state
+// variable
+void Gamepad::a_reset_isr()
+{
+    _event_state.reset(A_PRESSED);
+}
+void Gamepad::b_reset_isr()
+{
+    _event_state.reset(B_PRESSED);
+}
+void Gamepad::x_reset_isr()
+{
+    _event_state.reset(X_PRESSED);
+}
+void Gamepad::y_reset_isr()
+{
+    _event_state.reset(Y_PRESSED);
+}
+void Gamepad::l_reset_isr()
+{
+    _event_state.reset(L_PRESSED);
+}
+void Gamepad::r_reset_isr()
+{
+    _event_state.reset(R_PRESSED);
+}
+void Gamepad::back_reset_isr()
+{
+    _event_state.reset(BACK_PRESSED);
+}
+void Gamepad::start_reset_isr()
+{
+    _event_state.reset(START_PRESSED);
+}
+void Gamepad::joy_reset_isr()
+{
+    _event_state.reset(JOY_PRESSED);
+}
+
 // get raw joystick coordinate in range -1 to 1
 // Direction (x,y)
 // North     (0,1)