diff options
Diffstat (limited to 'converter/ps2_usb/main.cpp')
| -rw-r--r-- | converter/ps2_usb/main.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/converter/ps2_usb/main.cpp b/converter/ps2_usb/main.cpp new file mode 100644 index 000000000..860af149a --- /dev/null +++ b/converter/ps2_usb/main.cpp | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | #include "mbed.h" | ||
| 2 | #include "debug.h" | ||
| 3 | #include "timer.h" | ||
| 4 | #include "action.h" | ||
| 5 | #include "keycode.h" | ||
| 6 | #include "host.h" | ||
| 7 | #include "host_driver.h" | ||
| 8 | #include "mbed_driver.h" | ||
| 9 | |||
| 10 | |||
| 11 | // Button and LEDs of LPC11U35 board | ||
| 12 | DigitalIn isp(P0_1); // ISP button | ||
| 13 | DigitalOut led_red(P0_20); | ||
| 14 | DigitalOut led_green(P0_21); | ||
| 15 | |||
| 16 | |||
| 17 | int main(void) { | ||
| 18 | isp.mode(PullUp); | ||
| 19 | led_red = 1; | ||
| 20 | led_green = 0; | ||
| 21 | |||
| 22 | timer_init(); | ||
| 23 | host_set_driver(&mbed_driver); | ||
| 24 | keyboard_init(); | ||
| 25 | |||
| 26 | //debug_enable = true; | ||
| 27 | xprintf("mbed_onekey ver.eee:\r\n"); | ||
| 28 | |||
| 29 | |||
| 30 | bool last_isp = isp; | ||
| 31 | while (1) { | ||
| 32 | keyboard_task(); | ||
| 33 | |||
| 34 | //led_green = !led_green; | ||
| 35 | if (last_isp == isp) continue; | ||
| 36 | last_isp = isp; | ||
| 37 | if (last_isp == 0) { | ||
| 38 | led_red = 0; // on | ||
| 39 | dprintf("timer: %i\r\n", timer_read()); | ||
| 40 | //register_code(KC_A); | ||
| 41 | } else { | ||
| 42 | led_red = 1; // off | ||
| 43 | //unregister_code(KC_A); | ||
| 44 | } | ||
| 45 | } | ||
| 46 | } | ||
