1
0
Fork 0

Add build option and Sun specific commands

This commit is contained in:
tmk 2014-08-01 13:26:42 +09:00
parent 79840c678e
commit 523cc6aa2e
4 changed files with 53 additions and 12 deletions

View file

@ -63,6 +63,7 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
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

View file

@ -77,3 +77,23 @@ Just use 'make'
$ 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
```

View file

@ -11,11 +11,19 @@ bool command_extra(uint8_t code)
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);
@ -32,7 +40,17 @@ bool command_extra(uint8_t code)
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;

View file

@ -65,7 +65,7 @@ void matrix_init(void)
{
DDRD |= (1<<6);
PORTD |= (1<<6);
debug_enable = true;
//debug_enable = true;
serial_init();
@ -86,14 +86,16 @@ uint8_t matrix_scan(void)
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