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.
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;