Add build option and Sun specific commands
This commit is contained in:
parent
79840c678e
commit
523cc6aa2e
@ -63,6 +63,7 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
|||||||
MOUSEKEY_ENABLE = yes # Mouse keys
|
MOUSEKEY_ENABLE = yes # Mouse keys
|
||||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||||
CONSOLE_ENABLE = yes # Console for debug
|
CONSOLE_ENABLE = yes # Console for debug
|
||||||
|
COMMAND_ENABLE = yes # Commands for debug and configuration
|
||||||
#NKRO_ENABLE = yes # USB Nkey Rollover
|
#NKRO_ENABLE = yes # USB Nkey Rollover
|
||||||
|
|
||||||
|
|
||||||
|
@ -77,3 +77,23 @@ Just use 'make'
|
|||||||
$ cd sun_usb
|
$ cd sun_usb
|
||||||
$ make
|
$ make
|
||||||
Then, load the binary to MCU with your favorite programmer.
|
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
|
||||||
|
```
|
||||||
|
@ -11,11 +11,19 @@ bool command_extra(uint8_t code)
|
|||||||
case KC_H:
|
case KC_H:
|
||||||
case KC_SLASH: /* ? */
|
case KC_SLASH: /* ? */
|
||||||
print("\n\n----- Sun converter Help -----\n");
|
print("\n\n----- Sun converter Help -----\n");
|
||||||
print("UP: Bell On\n");
|
print("Up: Bell On\n");
|
||||||
print("DOWN: Bell Off\n");
|
print("Down: Bell Off\n");
|
||||||
print("LEFT: Click On\n");
|
print("Left: Click On\n");
|
||||||
print("RIGHT: Click Off\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;
|
return false;
|
||||||
|
case KC_DEL:
|
||||||
|
print("Reset\n");
|
||||||
|
serial_send(0x01);
|
||||||
|
break;
|
||||||
case KC_UP:
|
case KC_UP:
|
||||||
print("Bell On\n");
|
print("Bell On\n");
|
||||||
serial_send(0x02);
|
serial_send(0x02);
|
||||||
@ -32,7 +40,17 @@ bool command_extra(uint8_t code)
|
|||||||
print("Click Off\n");
|
print("Click Off\n");
|
||||||
serial_send(0x0B);
|
serial_send(0x0B);
|
||||||
break;
|
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");
|
print("layout\n");
|
||||||
serial_send(0x0F);
|
serial_send(0x0F);
|
||||||
break;
|
break;
|
||||||
|
@ -65,7 +65,7 @@ void matrix_init(void)
|
|||||||
{
|
{
|
||||||
DDRD |= (1<<6);
|
DDRD |= (1<<6);
|
||||||
PORTD |= (1<<6);
|
PORTD |= (1<<6);
|
||||||
debug_enable = true;
|
//debug_enable = true;
|
||||||
|
|
||||||
serial_init();
|
serial_init();
|
||||||
|
|
||||||
@ -86,14 +86,16 @@ uint8_t matrix_scan(void)
|
|||||||
debug_hex(code); debug(" ");
|
debug_hex(code); debug(" ");
|
||||||
|
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 0x7E: // reset fail
|
|
||||||
case 0xFE: // layout
|
|
||||||
case 0xFF: // reset success
|
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);
|
_delay_ms(500);
|
||||||
// ignore response byte
|
if (code = serial_recv()) print_hex8(code);
|
||||||
debug("(response ignored:");
|
print("\n");
|
||||||
while ((code = serial_recv())) { debug(" "); debug_hex(code); }
|
|
||||||
debug(") ");
|
|
||||||
// FALL THROUGH
|
// FALL THROUGH
|
||||||
case 0x7F:
|
case 0x7F:
|
||||||
// all keys up
|
// all keys up
|
||||||
|
Loading…
Reference in New Issue
Block a user