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.cpp
- Committer:
- eencae
- Date:
- 2017-02-04
- Revision:
- 0:a6288c29b936
- Child:
- 1:6d25cd49059b
File content as of revision 0:a6288c29b936:
#include "Gamepad.h"
Gamepad::Gamepad()
{
led_1 = new PwmOut(PTA1);
led_2 = new PwmOut(PTA2);
led_3 = new PwmOut(PTC2);
led_4 = new PwmOut(PTC3);
led_5 = new PwmOut(PTC4);
led_6 = new PwmOut(PTD3);
lcd = new N5110(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
joystick = new Joystick(PTB10,PTB11,PTC16);
button_A = new InterruptIn(PTB9);
button_B = new InterruptIn(D10);
button_X = new InterruptIn(PTC17);
button_Y = new InterruptIn(PTC12); // changed pin
button_back = new InterruptIn(PTB19);
button_start = new InterruptIn(PTC5);
button_L = new InterruptIn(PTB18);
button_R = new InterruptIn(PTB3);
buzzer = new PwmOut(PTC10);
pot = new AnalogIn(PTB2);
}
void Gamepad::init()
{
lcd->init();
joystick->init();
}
void Gamepad::leds_off()
{
led_1->write(1.0);
led_2->write(1.0);
led_3->write(1.0);
led_4->write(1.0);
led_5->write(1.0);
led_6->write(1.0);
}
void Gamepad::leds_on()
{
led_1->write(0.0);
led_2->write(0.0);
led_3->write(0.0);
led_4->write(0.0);
led_5->write(0.0);
led_6->write(0.0);
}