aboutsummaryrefslogtreecommitdiffstats
path: root/converter
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2013-03-12 12:10:12 +0900
committertmk <nobody@nowhere>2013-03-12 12:10:12 +0900
commitc4ab832be0f110a127b20e8df2b5223bceb8dcd1 (patch)
tree62c7f90ab55af319f7ce62c3cc7fd5cdab463280 /converter
parentc0137b4b32f10d6a5b5a405ccd284b4194fe2497 (diff)
downloadfirmware-c4ab832be0f110a127b20e8df2b5223bceb8dcd1.tar.gz
firmware-c4ab832be0f110a127b20e8df2b5223bceb8dcd1.tar.bz2
firmware-c4ab832be0f110a127b20e8df2b5223bceb8dcd1.zip
Fix Locking CapsLock support in ADB converter
Diffstat (limited to 'converter')
-rw-r--r--converter/adb_usb/README.md7
-rw-r--r--converter/adb_usb/config.h15
-rw-r--r--converter/adb_usb/keymap.c2
-rw-r--r--converter/adb_usb/matrix.c27
4 files changed, 15 insertions, 36 deletions
diff --git a/converter/adb_usb/README.md b/converter/adb_usb/README.md
index 33fd55040..3033cfa62 100644
--- a/converter/adb_usb/README.md
+++ b/converter/adb_usb/README.md
@@ -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
),
diff --git a/converter/adb_usb/config.h b/converter/adb_usb/config.h
index 094252f74..da87eed6a 100644
--- a/converter/adb_usb/config.h
+++ b/converter/adb_usb/config.h
@@ -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
diff --git a/converter/adb_usb/keymap.c b/converter/adb_usb/keymap.c
index bde829de3..5d42980d5 100644
--- a/converter/adb_usb/keymap.c
+++ b/converter/adb_usb/keymap.c
@@ -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
),
diff --git a/converter/adb_usb/matrix.c b/converter/adb_usb/matrix.c
index 18e71aa49..9b26a2a18 100644
--- a/converter/adb_usb/matrix.c
+++ b/converter/adb_usb/matrix.c
@@ -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);