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.
Gamepad.h
- Committer:
- eencae
- Date:
- 2017-02-04
- Revision:
- 1:6d25cd49059b
- Parent:
- 0:a6288c29b936
- Child:
- 3:964a6d95acdd
File content as of revision 1:6d25cd49059b:
#ifndef GAMEPAD_H
#define GAMEPAD_H
#include "mbed.h"
#include "N5110.h"
#include "Joystick.h"
class Gamepad
{
public:
Gamepad();
~Gamepad();
N5110 *lcd;
Joystick *joystick;
void init();
void leds_on();
void leds_off();
void fade_leds(float val);
float read_pot();
void tone(float frequency, float duration);
bool a_pressed();
bool b_pressed();
bool x_pressed();
bool y_pressed();
bool l_pressed();
bool r_pressed();
bool back_pressed();
bool start_pressed();
private:
PwmOut *led_1;
PwmOut *led_2;
PwmOut *led_3;
PwmOut *led_4;
PwmOut *led_5;
PwmOut *led_6;
InterruptIn *button_A;
InterruptIn *button_B;
InterruptIn *button_X;
InterruptIn *button_Y; // changed pin
InterruptIn *button_back;
InterruptIn *button_start;
InterruptIn *button_L;
InterruptIn *button_R;
PwmOut *buzzer;
AnalogIn *pot;
Timeout *timeout;
void init_buttons();
void tone_off();
void a_isr();
void b_isr();
void x_isr();
void y_isr();
void l_isr();
void r_isr();
void back_isr();
void start_isr();
bool a_flag,b_flag,x_flag,y_flag,l_flag,r_flag,back_flag,start_flag;
};
#endif