Library for ELEC2645 Gamepad PCB. University of Leeds Version 2 January 2020
Dependents: ELEC2645_Ticker_WAV ELEC2645_Project_username ELEC2645_Project_el18vgt ELEC2645_Project_el17oc11 ... more
Diff: Gamepad.cpp
- Revision:
- 7:019671f7bd83
- Parent:
- 4:bafb7f483e93
- Child:
- 8:7eaf26f4b5f2
diff -r b1c3dfe67f7d -r 019671f7bd83 Gamepad.cpp --- a/Gamepad.cpp Mon Feb 06 19:55:22 2017 +0000 +++ b/Gamepad.cpp Mon Feb 06 20:31:45 2017 +0000 @@ -43,13 +43,12 @@ void Gamepad::init() { leds_off(); + init_buttons(); // read centred values of joystick _x0 = horiz->read(); _y0 = vert->read(); - buzzer->period(1.0/1000.0); // 1 kHz - // clear all flags a_flag=0,b_flag=0,x_flag=0,y_flag=0,joy_flag=0; l_flag=0,r_flag=0,back_flag=0,start_flag=0; @@ -179,8 +178,8 @@ bool Gamepad::start_pressed() { // ISR must have been triggered - if (a_flag) { - a_flag = 0; // clear flag + if (start_flag) { + start_flag = 0; // clear flag return true; } else { return false;