Class used to interface with the handheld gamepad.

Fork of Gamepad by Craig Evans

Revision:
0:a6288c29b936
Child:
1:6d25cd49059b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Gamepad.cpp	Sat Feb 04 15:31:44 2017 +0000
@@ -0,0 +1,53 @@
+#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);
+}