ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_el18jgb

Dependencies:   mbed

Revision:
4:6f898b000797
Child:
5:c37f4ed2cad3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Eng.cpp	Thu May 14 16:16:49 2020 +0000
@@ -0,0 +1,47 @@
+#include "Aim.h"
+#include "mbed.h"
+#include "N5110.h"
+#include "Gamepad.h"
+#include "Heston.h"
+Eng::Eng()
+{
+
+}
+
+Eng::~Eng()
+{
+
+}
+// objects
+Gamepad pad;
+N5110 lcd;
+Aim Aim;
+Heston heston;
+
+InterruptIn buttonA(PTC7);
+InterruptIn buttonB(PTC9);
+InterruptIn buttonX(PTC5);
+InterruptIn buttonY(PTC0);
+
+DigitalOut led1(PTA2);
+DigitalOut led2(PTC2);
+DigitalOut led3(PTC3);
+DigitalOut led4(PTA1);
+
+void init()
+{
+    buttonA.mode(PullUp); // turn on internal pull-up resistor
+    // pin will be 1 (3.3 V) when not pressed and 0 (0 V) when pressed
+    buttonB.mode(PullUp);
+    buttonY.mode(PullUp);
+    buttonX.mode(PullUp);
+    // We therefore need to look for a falling edge on the pin to fire the interrupt
+    // when the button is pressed
+    buttonA.fall(&buttonA_isr);
+    buttonB.fall(&buttonB_isr);
+    buttonX.fall(&buttonX_isr);
+    buttonY.fall(&buttonY_isr);
+}
+void read_input(Gamepad &pad);
+void update(Gamepad &pad);
+void draw(N5110 &lcd);