]> git.gir.st - tmk_keyboard.git/blob - keyboard/infinity/main.cpp
build with ./make and flash with ./make flash
[tmk_keyboard.git] / keyboard / infinity / main.cpp
1 #include "MK20D5.h"
2 #include "wait.h"
3 #include "gpio_api.h"
4 #include "PinNames.h"
5 #include "matrix.h"
6 #include "timer.h"
7
8 #include "action.h"
9 #include "keycode.h"
10 #include "host.h"
11 #include "host_driver.h"
12 #include "mbed_driver.h"
13
14
15 int main() {
16 gpio_t led;
17 gpio_init_out(&led, PTA19);
18
19 uint16_t t = 0;
20
21 host_set_driver(&mbed_driver);
22 keyboard_init();
23
24 while(1) {
25 keyboard_task();
26
27 bool matrix_on = false;
28 matrix_scan();
29 for (int i = 0; i < MATRIX_ROWS; i++) {
30 if (matrix_get_row(i)) {
31 matrix_on = true;
32 break;
33 }
34 }
35 if (matrix_on)
36 gpio_write(&led, 1);
37 else {
38 if (timer_elapsed(t) > 500) {
39 gpio_write(&led, !gpio_read(&led));
40 t = timer_read();
41 }
42 }
43 }
44 }
Imprint / Impressum