]> git.donarmstrong.com Git - tmk_firmware.git/commitdiff
Fix Locking CapsLock support in ADB converter
authortmk <nobody@nowhere>
Tue, 12 Mar 2013 03:10:12 +0000 (12:10 +0900)
committertmk <nobody@nowhere>
Tue, 12 Mar 2013 03:10:12 +0000 (12:10 +0900)
converter/adb_usb/README.md
converter/adb_usb/config.h
converter/adb_usb/keymap.c
converter/adb_usb/matrix.c
keyboard/gh60/config.h

index 33fd55040dec5794304d68ee29a4da5394167c1e..3033cfa6202db2388ae066c3057c7c064baf0702 100644 (file)
@@ -20,10 +20,7 @@ Build
 
 LOCKING CAPSLOCK
 ----------------
-Many old ADB keyboards have mechanical push-lock switch for Capslock key. This converter support the locking Capslock key by default.
-This feature will prevent you from remaping as normal key. You can disable the feature by *commenting out* a macro in config.h like this:
-
-    //#define MATRIX_HAS_LOCKING_CAPS
+Many of old ADB keyboards have mechanical push-lock switch for Capslock key and this converter supports the locking Capslock key by default. See README in top directory for more detail about this feature.
 
 Also you may want to remove locking pin from the push-lock switch to use capslock as a normal momentary switch.
 http://www.youtube.com/watch?v=9wqnt2mGJ2Y
@@ -58,7 +55,7 @@ effort at this time.
     ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,BRK,                    PWR,
     GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,     INS, HOME,PGUP,    NLCK,EQL, PSLS,PAST,
     TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS,     DEL, END, PGDN,    P7,  P8,  P9,  PMNS,
-    CAPS,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,                         P4,  P5,  P6,  PPLS,
+    LCAP,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,                         P4,  P5,  P6,  PPLS,
     LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,          RSFT,          UP,           P1,  P2,  P3,
     LCTL,LGUI,LALT,          SPC,                                              LEFT,DOWN,RGHT,    P0,       PDOT,PENT
     ),
index 094252f742bb75651c848de495d9838cfe82c028..da87eed6a7df8a021056293e228f53508c03a6ac 100644 (file)
@@ -32,13 +32,22 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #define MATRIX_ROWS 16  // keycode bit: 3-0
 #define MATRIX_COLS 8   // keycode bit: 6-4
 
-/* Locking Caps Lock support */
-#define MATRIX_HAS_LOCKING_CAPS
-
 #define MATRIX_ROW(code)    ((code)>>3&0x0F)
 #define MATRIX_COL(code)    ((code)&0x07)
 
 
+/* Locking Caps Lock support */
+//#define MATRIX_HAS_LOCKING_CAPS
+/* Mechanical locking CapsLock support. Use KC_LCAP instead of KC_CAPS in keymap */
+#define CAPSLOCK_LOCKING_ENABLE
+/* Locking CapsLock resynchronize hack */
+#define CAPSLOCK_LOCKING_RESYNC_ENABLE
+
+
+/* legacy keymap support */
+#define USE_LEGACY_KEYMAP
+
+
 /* mouse keys */
 #ifdef MOUSEKEY_ENABLE
 #   define MOUSEKEY_DELAY_TIME 192
index bde829de3e261b1d2aa82d88db9bc7a4f0ff9bf3..5d42980d5540dae261e8584b5cbb072f4bb20400 100644 (file)
@@ -155,7 +155,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
     ESC, F1,  F2,  F3,  F4,  F5,  F6,  F7,  F8,  F9,  F10, F11, F12,           PSCR,SLCK,PAUS,                   PWR,
     GRV, 1,   2,   3,   4,   5,   6,   7,   8,   9,   0,   MINS,EQL, BSPC,     INS, HOME,PGUP,    NLCK,PEQL,PSLS,PAST,
     TAB, Q,   W,   E,   R,   T,   Y,   U,   I,   O,   P,   LBRC,RBRC,BSLS,     DEL, END, PGDN,    P7,  P8,  P9,  PMNS,
-    CAPS,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,                         P4,  P5,  P6,  PPLS,
+    LCAP,A,   S,   D,   F,   G,   H,   J,   K,   L,   SCLN,QUOT,     ENT,                         P4,  P5,  P6,  PPLS,
     LSFT,Z,   X,   C,   V,   B,   N,   M,   COMM,DOT, SLSH,          RSFT,          UP,           P1,  P2,  P3,
     LCTL,LGUI,LALT,          SPC,                               RGUI,RCTL,     LEFT,DOWN,RGHT,    P0,       PDOT,PENT
     ),
index 18e71aa49786aca2c06ce4d848995b87675d867f..9b26a2a18762955762017d4fb60dcbdddbbf41df 100644 (file)
@@ -25,8 +25,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #include "print.h"
 #include "util.h"
 #include "debug.h"
-#include "host.h"
-#include "led.h"
 #include "adb.h"
 #include "matrix.h"
 
@@ -38,8 +36,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #   error "MATRIX_ROWS must not exceed 255"
 #endif
 
-#define ADB_CAPS_UP     (ADB_CAPS | 0x80)
-
 
 static bool is_modified = false;
 
@@ -98,12 +94,6 @@ uint8_t matrix_scan(void)
         print("adb_host_kbd_recv: "); phex16(codes); print("\n");
     }
 
-#ifdef MATRIX_HAS_LOCKING_CAPS
-    // Send Caps key up event
-    if (matrix_is_on(MATRIX_ROW(ADB_CAPS), MATRIX_COL(ADB_CAPS))) {
-        register_key(ADB_CAPS_UP);
-    }
-#endif
     if (codes == 0) {                           // no keys
         return 0;
     } else if (codes == 0x7F7F) {   // power key press
@@ -116,23 +106,6 @@ uint8_t matrix_scan(void)
         for (uint8_t i=0; i < MATRIX_ROWS; i++) matrix[i] = 0x00;
         return key1;
     } else {
-#ifdef MATRIX_HAS_LOCKING_CAPS    
-        if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) {
-            // Ignore LockingCaps key down event when CAPS LOCK is on
-            if (key0 == ADB_CAPS && (key1 == ADB_CAPS || key1 == 0xFF)) return 0;
-            if (key0 == ADB_CAPS) key0 = key1;
-            if (key1 == ADB_CAPS) key1 = 0xFF;
-            // Convert LockingCaps key up event into down event
-            if (key0 == ADB_CAPS_UP) key0 = ADB_CAPS;
-            if (key1 == ADB_CAPS_UP) key1 = ADB_CAPS;
-        } else {
-            // ADB_CAPS LOCK off:
-            // Ignore LockingCaps key up event when ADB_CAPS LOCK is off
-            if (key0 == ADB_CAPS_UP && (key1 == ADB_CAPS_UP || key1 == 0xFF)) return 0;
-            if (key0 == ADB_CAPS_UP) key0 = key1;
-            if (key1 == ADB_CAPS_UP) key1 = 0xFF;
-        }
-#endif        
         register_key(key0);
         if (key1 != 0xFF)       // key1 is 0xFF when no second key.
             register_key(key1);
index bd0a19c33c85a1405755547a5601f2ed61edb067..38d88eecc4b569e5ab1618982837592e0fefd81a 100644 (file)
@@ -39,7 +39,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 /* Mechanical locking CapsLock support. Use KC_LCAP instead of KC_CAPS in keymap */
 #define CAPSLOCK_LOCKING_ENABLE
-/* Locking CapsLock resynchronize hack, which won't work on Linux */
+/* Locking CapsLock resynchronize hack */
 #define CAPSLOCK_LOCKING_RESYNC_ENABLE
 
 /* key combination for command */