Input library for the STMstation P.1. Facilitates button state checking and battery voltage checking.

Library to check button states and battery voltage for the STMstation P.1.

/media/uploads/kkado/imgp1229.jpg

See API documentation for detailed information.

Revision:
0:6951d1eef6ad
Child:
1:8c73c4795f92
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/STMstation_input.h	Thu Jun 22 09:06:57 2017 +0000
@@ -0,0 +1,38 @@
+/*
+User input library for STMstation P.1
+Kevin Kadooka, June 2017
+*/
+
+#ifndef STMstation_input_h
+#define STMstation_input_h
+
+#include "mbed.h"
+
+#define UP_PIN    PA_0
+#define DOWN_PIN  PC_3
+#define LEFT_PIN  PC_2
+#define RIGHT_PIN PA_1
+#define A_PIN   PB_10
+#define B_PIN   PB_12
+#define X_PIN   PB_1
+#define Y_PIN   PB_2
+#define START_PIN   PB_4
+#define SELECT_PIN  PB_5
+
+class STMstation_input{
+    public:
+        STMstation_input();
+        enum Button {UP, DOWN, LEFT, RIGHT, A, B, X, Y, START, SELECT};
+        void updateButtons();
+        bool keyDown(Button b);
+        bool keyUp(Button b);
+        bool keyPress(Button b);
+    private:
+        void init();
+        bool buttonPress[10];
+        bool buttonDown[10];
+        bool buttonUp[10];
+        DigitalIn D_UP, D_DOWN, D_LEFT, D_RIGHT, D_A, D_B, D_X, D_Y, D_START, D_SELECT;
+};
+
+#endif
\ No newline at end of file