Add keyboard/mbed_onekey
[tmk_keyboard.git] / keyboard / mbed_onekey / main.cpp
1 #include "mbed.h"
2 #include "HIDKeyboard.h"
3 #include "debug.h"
4
5 /*
6 //#define DEBUG
7 #ifdef DEBUG
8 Serial ser(UART_TX, UART_RX);
9 #define dprintf(fmt, ...) ser.printf(fmt, ## __VA_ARGS__)
10 #else
11 #define dprintf(fmt, ...)
12 #endif
13 */
14
15
16 // button and LEDs
17 DigitalIn isp(P0_1);
18 DigitalOut led_red(P0_20);
19 DigitalOut led_green(P0_21);
20
21 //USBKeyboard
22 HIDKeyboard keyboard;
23
24
25 int main(void) {
26 //isp.mode(PullUp);
27 //led_red = 0;
28 //led_green = 0;
29 debug_enable = true;
30 dprintf("HIDKeyboard:\n");
31 print("aaa");
32
33 report_keyboard_t report = { 2, 0, 4, }; //a
34 report_keyboard_t report_off = { 0 };
35 while (1) {
36 //keyboard.mediaControl(KEY_VOLUME_DOWN);
37 //keyboard.printf("Hello World from Mbed\r\n");
38 //keyboard.keyCode('s', KEY_CTRL);
39 //keyboard.keyCode(KEY_CAPS_LOCK);
40
41 //led_green = !led_green;
42 //leds = keyboard.lockStatus();
43 //ser.putc(ser.getc());
44
45 if (isp == 0) {
46 led_red = 0; // on
47 keyboard.sendReport(report);
48 } else {
49 led_red = 1; // off
50 keyboard.sendReport(report_off);
51 }
52 led_green = !led_green;
53 //wait(0.5);
54 }
55 }
Imprint / Impressum