From 805ce3c1309421df6166b085b70f53c494f9946b Mon Sep 17 00:00:00 2001 From: tmk Date: Tue, 22 May 2012 00:14:02 +0900 Subject: Fix key stuck bug of M0110A support. - rewrite special key handling in m0110.c - add mouse keys to keymap --- m0110_usb/README.md | 27 ++++++--------------------- m0110_usb/config.h | 2 +- m0110_usb/keymap.c | 39 ++++++++++++++++++++------------------- m0110_usb/matrix.c | 49 ++----------------------------------------------- 4 files changed, 29 insertions(+), 88 deletions(-) (limited to 'm0110_usb') diff --git a/m0110_usb/README.md b/m0110_usb/README.md index a948af91b9..92b58f684a 100644 --- a/m0110_usb/README.md +++ b/m0110_usb/README.md @@ -105,15 +105,15 @@ You can change keymaps by editing *keymap.c*. `---------------------------------------------------------' `---------------' #### *HHKB/WASD cursor Layer(Fn0)* ,---------------------------------------------------------. ,---------------. - |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk| =| /| *| + |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk|Mb1|Mb3|Mb2| |---------------------------------------------------------| |---------------| - |Caps |Hom| Up|PgU| | | | |Psc|Slk|Pau|Up |Ins| | | 7| 8| 9| -| + |Caps |Hom| Up|PgU| | | | |Psc|Slk|Pau|Up |Ins| | |MwD|McU|MwU|MwU| |-----------------------------------------------------' | |---------------| - |Fn0 |Lef|Dow|Rig| | | | |Hom|PgU|Lef|Rig|Return| | 4| 5| 6| +| + |Fn0 |Lef|Dow|Rig| | | | |Hom|PgU|Lef|Rig|Return| |McL|McD|McR|MwD| |---------------------------------------------------------| |---------------| - |Shift |End| |PgD| |VoD|VoU|Mut|End|PgD|Dow|Shif|Up | | 1| 2| 3| | - |---------------------------------------------------------| |-----------|Ent| - |Ctrl |Alt | Space | \|Lft|Rgt|Dn | | 0| .| | + |Shift |End| |PgD| |VoD|VoU|Mut|End|PgD|Dow|Shif|Up | |MwL|McD|MwR| | + |---------------------------------------------------------| |-----------|Mb2| + |Ctrl |Alt | Space |Gui | \|Lft|Rgt|Dn | | Mb1|Mb3| | `---------------------------------------------------------' `---------------' @@ -124,18 +124,3 @@ You can use [PJRC HID listen](http://www.pjrc.com/teensy/hid_listen.html) to see The converter has some functions for debug, press `Alt+Gui+H` simultaneously to get help. These function is totally undocumented, tentative, inconsistent and buggy. - - - -Arrow Keys ----------- -Dedicated arrow keys of the M0110A are transmitting the same scancodes as the keypad but also, -its [=], [/], [*] and [+] keys (hereafter referred to as "calc" keys) are not assigned new -scancodes but, instead, transmit a sequence of scancodes which emulates the [Shift] key press, -followed by the same scancode sequence of the arrow keys! -The problem with that approach is that, while in most cases it's easy to distinguish between -a user-generated [Shift] key event (press or release) followed by an arrow or a calc key and -a simulated [Shift] key event generated upon a calc key event, when the user is typing fairly -fast, it is possible that the two events become indistinguishable, and produce undesired results --- nothing major, though, just one or two stray characters or cursor movements; it will NOT -format your drives, kill your cat or make your wife run away with the pizza boy. diff --git a/m0110_usb/config.h b/m0110_usb/config.h index de20d7c88c..4563d6da54 100644 --- a/m0110_usb/config.h +++ b/m0110_usb/config.h @@ -1,5 +1,5 @@ /* -Copyright 2011 Jun Wako +Copyright 2011,2012 Jun Wako This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/m0110_usb/keymap.c b/m0110_usb/keymap.c index 31399c343a..939010c6d0 100644 --- a/m0110_usb/keymap.c +++ b/m0110_usb/keymap.c @@ -1,5 +1,5 @@ /* -Copyright 2011 Jun Wako +Copyright 2011,2012 Jun Wako This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -88,7 +88,7 @@ static const uint8_t PROGMEM fn_keycode[] = { static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* * The keymap works with both M0110 and M0110A keyboards. As you can see, the M0110A is a superset - * of the M0110 keyboard, with only one exception: the right Alt key(Enter in M0110) does not exist + * of the M0110 keyboard, with only one exception: 'Enter' in M0110 does not exist * on the M0110A, but since it generates a unique scan code which is not used for some other key in * the M0110A, they are totally interchangeable. In fact, the M0110A is functionally (almost) * identical to the combination of the M0110 along with the M0120 keypad. The only difference @@ -110,18 +110,19 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |Ctrl |Alt | Space |Gui| \|Lft|Rgt|Dn | | 0| .| | * `---------------------------------------------------------' `---------------' * - * HHKB/WASD cursor Layer(Fn0): + * HHKB/WASD/Mouse Layer(Fn0): * ,---------------------------------------------------------. ,---------------. - * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk| =| /| *| + * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Delet| |Nlk|Mb1|Mb3|Mb2| * |---------------------------------------------------------| |---------------| - * |Caps |Hom| Up|PgU| | | | |Psc|Slk|Pau|Up |Ins| | | 7| 8| 9| -| + * |Caps |Hom| Up|PgU| | | | |Psc|Slk|Pau|Up |Ins| | |MwD|McU|MwU|MwU| * |-----------------------------------------------------' | |---------------| - * |Fn0 |Lef|Dow|Rig| | | | |Hom|PgU|Lef|Rig|Return| | 4| 5| 6| +| + * |Fn0 |Lef|Dow|Rig| | | | |Hom|PgU|Lef|Rig|Return| |McL|McD|McR|MwD| * |---------------------------------------------------------| |---------------| - * |Shift |End| |PgD| |VoD|VoU|Mut|End|PgD|Dow|Shif|Up | | 1| 2| 3| | - * |---------------------------------------------------------| |-----------|Ent| - * |Ctrl |Alt | Space |Gui | \|Lft|Rgt|Dn | | 0| .| | + * |Shift |End| |PgD| |VoD|VoU|Mut|End|PgD|Dow|Shif|Up | |MwL|McD|MwR| | + * |---------------------------------------------------------| |-----------|Mb2| + * |Ctrl |Alt | Space |Gui | \|Lft|Rgt|Dn | | Mb1|Mb3| | * `---------------------------------------------------------' `---------------' + * Mb: Mouse Button / Mc: Mouse Cursor / Mw: Mouse Wheel * * NOTE: You can register Esc by hitting(press&release) Fn0 quickly. * NOTE: Gui between Space and \ is Enter on M0110 not exists on M0110A. @@ -130,7 +131,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ #ifndef HASU KEYMAP( - GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, LGUI,PEQL,PSLS,PAST, + GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, LGUI,EQL, PSLS,PAST, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, P7, P8, P9, PMNS, FN0, 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, UP, P1, P2, P3, PENT, @@ -138,17 +139,17 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), // HHKB & WASD KEYMAP( - ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,PEQL,PSLS,PAST, - CAPS,HOME,UP, PGUP,NO, NO, NO, NO, PSCR,SLCK,BRK, UP, INS, P7, P8, P9, PMNS, - FN0, LEFT,DOWN,RGHT,NO, NO, NO, NO, HOME,PGUP,LEFT,RGHT, ENT, P4, P5, P6, PPLS, - LSFT,END, NO, PGDN,NO, VOLD,VOLU,MUTE,END, PGDN,DOWN, UP, P1, P2, P3, PENT, - LCTL,LALT, SPC, LGUI,BSLS,LEFT,RGHT,DOWN, P0, PDOT + ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,BTN1,BTN3,BTN2, + CAPS,HOME,UP, PGUP,NO, NO, NO, NO, PSCR,SLCK,BRK, UP, INS, WH_D,MS_U,WH_U,WH_U, + FN0, LEFT,DOWN,RGHT,NO, NO, NO, NO, HOME,PGUP,LEFT,RGHT, ENT, MS_L,MS_D,MS_R,WH_D, + LSFT,END, NO, PGDN,NO, VOLD,VOLU,MUTE,END, PGDN,DOWN, UP, WH_L,MS_D,WH_R,BTN2, + LCTL,LALT, SPC, LGUI,BSLS,LEFT,RGHT,DOWN, BTN1, BTN3 ), #else // hasu's keymap // To enable use this 'make' option: make EXTRAFLAGS=-DHASU KEYMAP( - ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, ESC, PEQL,PSLS,PAST, + ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, LGUI,EQL, PSLS,PAST, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, P7, P8, P9, PMNS, LCTL,A, S, D, F, G, H, J, K, L, FN1, QUOT, ENT, P4, P5, P6, PPLS, LSFT,Z, X, C, V, B, N, M, COMM,DOT, FN2, FN3, P1, P2, P3, PENT, @@ -156,7 +157,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), // HHKB & WASD KEYMAP( - GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,PEQL,PSLS,PAST, + GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST, CAPS,HOME,UP, PGUP,NO, NO, NO, NO, PSCR,SLCK,BRK, UP, INS, P7, P8, P9, PMNS, LCTL,LEFT,DOWN,RGHT,NO, NO, NO, NO, HOME,PGUP,LEFT,RGHT, ENT, P4, P5, P6, PPLS, LSFT,END, NO, PGDN,NO, VOLD,VOLU,MUTE,END, PGDN,DOWN, FN3, P1, P2, P3, PENT, @@ -164,7 +165,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), // vi mousekeys KEYMAP( - GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,PEQL,PSLS,PAST, + GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST, CAPS,NO, NO, NO, NO, NO, WH_L,WH_D,WH_U,WH_R,NO, NO, NO, P7, P8, P9, PMNS, NO, VOLD,VOLU,MUTE,NO, NO, MS_L,MS_D,MS_U,MS_R,FN1, NO, ENT, P4, P5, P6, PPLS, LSFT,NO, NO, NO, NO, BTN3,BTN2,BTN1,NO, NO, NO, UP, P1, P2, P3, PENT, @@ -172,7 +173,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), // vi cusorkeys KEYMAP( - GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,PEQL,PSLS,PAST, + GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, NLCK,EQL, PSLS,PAST, CAPS,NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, NO, NO, NO, P7, P8, P9, PMNS, NO, NO, NO, NO, NO, NO, LEFT,DOWN,UP, RGHT,NO, NO, ENT, P4, P5, P6, PPLS, LSFT,NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, FN2, UP, P1, P2, P3, PENT, diff --git a/m0110_usb/matrix.c b/m0110_usb/matrix.c index b28045b9c1..1ca6894c44 100644 --- a/m0110_usb/matrix.c +++ b/m0110_usb/matrix.c @@ -1,5 +1,5 @@ /* -Copyright 2011 Jun Wako +Copyright 2011,2012 Jun Wako This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -36,11 +36,6 @@ along with this program. If not, see . #define ROW(key) ((key)>>3&0x0F) #define COL(key) ((key)&0x07) -#define ARROW_UP_BREAK (0x4D | 0x80) -#define ARROW_DOWN_BREAK (0x48 | 0x80) -#define ARROW_LEFT_BREAK (0x46 | 0x80) -#define ARROW_RIGHT_BREAK (0x42 | 0x80) - static bool is_modified = false; @@ -48,9 +43,6 @@ static bool is_modified = false; static uint8_t *matrix; static uint8_t _matrix0[MATRIX_ROWS]; -#ifdef MATRIX_HAS_GHOST -static bool matrix_has_ghost_in_row(uint8_t row); -#endif static void register_key(uint8_t key); @@ -100,20 +92,6 @@ uint8_t matrix_scan(void) return 0; } else if (key == M0110_ERROR) { return 0; - } else if (key == ARROW_UP_BREAK || - key == ARROW_DOWN_BREAK || - key == ARROW_LEFT_BREAK || - key == ARROW_RIGHT_BREAK) { - // WORK AROUND: exceptional handling for M0110A - // Unregister both Arrow key and coressponding Calc key when receive Arrow key break. - // - // Shift + Calc keys(=/*+): - // Send no Shift break(0xF1) when release Calc keys. Can't be desinguished from Arrow keys. - // (press: 0x71, 0x79, 0xXX release: 0x79, 0xXX) - // See m0110.c for key events and scan codes. - is_modified = true; - register_key(key); - register_key(key|M0110_CALC_OFFSET); } else { #ifdef MATRIX_HAS_LOCKING_CAPS if (host_keyboard_leds() & (1<