summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2014-08-01 06:26:42 +0200
committertmk <nobody@nowhere>2014-08-01 06:26:42 +0200
commit523cc6aa2ed0879c2d297e7060de2962987c8c7a (patch)
tree04deb0e84390623311d572bb131eeceafc509d1b
parent79840c678e13f9a737f80048bc3b9c9c55e3fc77 (diff)
downloadqmk_firmware-523cc6aa2ed0879c2d297e7060de2962987c8c7a.tar.gz
qmk_firmware-523cc6aa2ed0879c2d297e7060de2962987c8c7a.tar.xz
Add build option and Sun specific commands
-rw-r--r--converter/sun_usb/Makefile1
-rw-r--r--converter/sun_usb/README20
-rw-r--r--converter/sun_usb/command_extra.c28
-rw-r--r--converter/sun_usb/matrix.c16
4 files changed, 53 insertions, 12 deletions
diff --git a/converter/sun_usb/Makefile b/converter/sun_usb/Makefile
index 35c4bb123..b32497cd9 100644
--- a/converter/sun_usb/Makefile
+++ b/converter/sun_usb/Makefile
@@ -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
diff --git a/converter/sun_usb/README b/converter/sun_usb/README
index ee59fc757..276f6bfff 100644
--- a/converter/sun_usb/README
+++ b/converter/sun_usb/README
@@ -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
+```
diff --git a/converter/sun_usb/command_extra.c b/converter/sun_usb/command_extra.c
index 50389467e..aba3fe6da 100644
--- a/converter/sun_usb/command_extra.c
+++ b/converter/sun_usb/command_extra.c
@@ -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;
diff --git a/converter/sun_usb/matrix.c b/converter/sun_usb/matrix.c
index 988622bc3..f333f542b 100644
--- a/converter/sun_usb/matrix.c
+++ b/converter/sun_usb/matrix.c
@@ -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