]> git.friedersdorff.com Git - max/tmk_keyboard.git/blob - converter/sun_usb/command_extra.c
ibmpc: Fix how to initialize keyboard
[max/tmk_keyboard.git] / converter / sun_usb / command_extra.c
1 #include "stdbool.h"
2 #include "stdint.h"
3 #include "keycode.h"
4 #include "serial.h"
5 #include "print.h"
6 #include "command.h"
7
8 bool sun_bell = false;
9 bool sun_click = false;
10
11
12 bool command_extra(uint8_t code)
13 {
14     switch (code) {
15         case KC_H:
16         case KC_SLASH: /* ? */
17             print("\n\n----- Sun converter Help -----\n");
18             print("Home:        Toggle Bell\n");
19             print("End:         Toggle Click\n");
20             print("PgUp:        LED all On\n");
21             print("PgDown:      LED all Off\n");
22             print("Insert:      Layout\n");
23             print("Delete:      Reset\n");
24             return false;
25         case KC_DEL:
26             print("Reset\n");
27             serial_send(0x01);
28             break;
29         case KC_HOME:
30             sun_bell = !sun_bell;
31             if (sun_bell) {
32                 print("Bell On\n");
33                 serial_send(0x02);
34             } else {
35                 print("Bell Off\n");
36                 serial_send(0x03);
37             }
38             break;
39         case KC_END:
40             sun_click = !sun_click;
41             if (sun_click) {
42                 print("Click On\n");
43                 serial_send(0x0A);
44             } else {
45                 print("Click Off\n");
46                 serial_send(0x0B);
47             }
48             break;
49         case KC_PGUP:
50             print("LED all on\n");
51             serial_send(0x0E);
52             serial_send(0xFF);
53             break;
54         case KC_PGDOWN:
55             print("LED all off\n");
56             serial_send(0x0E);
57             serial_send(0x00);
58             break;
59         case KC_INSERT:
60             print("layout\n");
61             serial_send(0x0F);
62             break;
63         default:
64             xprintf("Unknown extra command: %02X\n", code);
65             return false;
66     }
67     return true;
68 }