summaryrefslogtreecommitdiff
path: root/keyboard/infinity/main.cpp
diff options
context:
space:
mode:
authorNathan Ross Powell <nathanrosspowell@gmail.com>2015-03-18 23:33:42 -0400
committerNathan Ross Powell <nathanrosspowell@gmail.com>2015-03-18 23:33:42 -0400
commit80c4cdb245a3ff55627d40a3a164073b30382def (patch)
treee134969a2fc20979101a7e9e7aa06c1877bf82eb /keyboard/infinity/main.cpp
parente7289bb029b28b824eb0ef7be23dba279057d7ac (diff)
parent9c3a95663410a294f2c85ad2d1c016f328730e0b (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'keyboard/infinity/main.cpp')
-rw-r--r--keyboard/infinity/main.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/keyboard/infinity/main.cpp b/keyboard/infinity/main.cpp
new file mode 100644
index 0000000000..847668a1de
--- /dev/null
+++ b/keyboard/infinity/main.cpp
@@ -0,0 +1,44 @@
+#include "MK20D5.h"
+#include "wait.h"
+#include "gpio_api.h"
+#include "PinNames.h"
+#include "matrix.h"
+#include "timer.h"
+
+#include "action.h"
+#include "keycode.h"
+#include "host.h"
+#include "host_driver.h"
+#include "mbed_driver.h"
+
+
+int main() {
+ gpio_t led;
+ gpio_init_out(&led, PTA19);
+
+ uint16_t t = 0;
+
+ host_set_driver(&mbed_driver);
+ keyboard_init();
+
+ while(1) {
+ keyboard_task();
+
+ bool matrix_on = false;
+ matrix_scan();
+ for (int i = 0; i < MATRIX_ROWS; i++) {
+ if (matrix_get_row(i)) {
+ matrix_on = true;
+ break;
+ }
+ }
+ if (matrix_on)
+ gpio_write(&led, 1);
+ else {
+ if (timer_elapsed(t) > 500) {
+ gpio_write(&led, !gpio_read(&led));
+ t = timer_read();
+ }
+ }
+ }
+}