]> git.friedersdorff.com Git - max/tmk_keyboard.git/commitdiff
Add build option and Sun specific commands
authortmk <nobody@nowhere>
Fri, 1 Aug 2014 04:26:42 +0000 (13:26 +0900)
committertmk <nobody@nowhere>
Fri, 1 Aug 2014 04:26:42 +0000 (13:26 +0900)
converter/sun_usb/Makefile
converter/sun_usb/README
converter/sun_usb/command_extra.c
converter/sun_usb/matrix.c

index 35c4bb123b232c5cf80466798e4f95efc471a181..b32497cd95db6f6829ef53a12dfe4291dacc8b6d 100644 (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
 
 
index ee59fc757c5982d7b592c04780de9e02384afe46..276f6bfff81387b2312784f0bafe2d74e1bfbf86 100644 (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
+```
index 50389467ea2c8a72722bee4e1eb2974af316d48f..aba3fe6da38fb6f7ca2fce0a4f0db825db585998 100644 (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;
index 988622bc393af358cbfd8e383ea5f36f737e4df8..f333f542bdf9d0e0841ea773d1f32d00895be72b 100644 (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