MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = yes # Console for debug
+COMMAND_ENABLE = yes # Commands for debug and configuration
#NKRO_ENABLE = yes # USB Nkey Rollover
$ cd sun_usb
$ make
Then, load the binary to MCU with your favorite programmer.
+
+
+Sun commands
+------------
+You can send Sun protocol commands with TMK `Magic` key combo. By default `Magic` key is `LShift` + `RShift`, `LAlt` + `RAlt' or `LMeta` + `RMeta`.
+https://github.com/tmk/tmk_keyboard#magic-commands
+
+Following Sun specific commands are available. For example, to send 'Bell On' you can press `LShift` + `RShift` + `Up` keys simultaneously.
+
+```
+----- Sun converter Help -----
+Up: Bell On
+Down: Bell Off
+Left: Click On
+Right: Click Off
+PgUp: LED all On
+PgDown: LED all On
+Insert: Layout
+Delete: Reset
+```
case KC_H:
case KC_SLASH: /* ? */
print("\n\n----- Sun converter Help -----\n");
- print("UP: Bell On\n");
- print("DOWN: Bell Off\n");
- print("LEFT: Click On\n");
- print("RIGHT: Click Off\n");
+ print("Up: Bell On\n");
+ print("Down: Bell Off\n");
+ print("Left: Click On\n");
+ print("Right: Click Off\n");
+ print("PgUp: LED all On\n");
+ print("PgDown: LED all On\n");
+ print("Insert: Layout\n");
+ print("Delete: Reset\n");
return false;
+ case KC_DEL:
+ print("Reset\n");
+ serial_send(0x01);
+ break;
case KC_UP:
print("Bell On\n");
serial_send(0x02);
print("Click Off\n");
serial_send(0x0B);
break;
- case KC_NUMLOCK:
+ case KC_PGUP:
+ print("LED all on\n");
+ serial_send(0x0E);
+ serial_send(0xFF);
+ break;
+ case KC_PGDOWN:
+ print("LED all off\n");
+ serial_send(0x0E);
+ serial_send(0x00);
+ break;
+ case KC_INSERT:
print("layout\n");
serial_send(0x0F);
break;
{
DDRD |= (1<<6);
PORTD |= (1<<6);
- debug_enable = true;
+ //debug_enable = true;
serial_init();
debug_hex(code); debug(" ");
switch (code) {
- case 0x7E: // reset fail
- case 0xFE: // layout
case 0xFF: // reset success
+ case 0xFE: // layout
+ case 0x7E: // reset fail
+ if (code == 0xFF) print("reset: 0xFF ");
+ if (code == 0x7E) print("reset fail: 0x7E ");
+ if (code == 0xFE) print("layout: 0xFE ");
+ // response byte
_delay_ms(500);
- // ignore response byte
- debug("(response ignored:");
- while ((code = serial_recv())) { debug(" "); debug_hex(code); }
- debug(") ");
+ if (code = serial_recv()) print_hex8(code);
+ print("\n");
// FALL THROUGH
case 0x7F:
// all keys up