change keymap for mouse keys.

This commit is contained in:
tmk 2010-10-10 22:10:23 +09:00
parent 958875247c
commit c696c95c60
3 changed files with 31 additions and 30 deletions

View File

@ -29,35 +29,35 @@ int current_layer = 0;
* |-----------------------------------------------------------| * |-----------------------------------------------------------|
* |Contro|VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter | * |Contro|VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter |
* |-----------------------------------------------------------| * |-----------------------------------------------------------|
* |Shift | | | | | | +| -|End|PgD|Dow|Shift | | * |Shift | | | | | | +| -|End|PgD|Dow|Shift |xxx|
* `-----------------------------------------------------------' * `-----------------------------------------------------------'
* |Gui |Alt |Space |Alt |Gui| * |Gui |Alt |Space |Alt |Gui|
* `--------------------------------------------' * `--------------------------------------------'
* *
* Layer2(Fn2) HHKB mouse mode * Layer2(Fn2) mouse mode
* ,-----------------------------------------------------------. * ,-----------------------------------------------------------.
* |Esc| | | | | | | | | | | | | | | * |Esc| | | | | | | | | | | | | | |
* |-----------------------------------------------------------| * |-----------------------------------------------------------|
* |Tab | | | | | | | | | | |McU| |Backs| * |Tab | | | | | | | | | | | | |Backs|
* |-----------------------------------------------------------| * |-----------------------------------------------------------|
* |Contro| | | | | | | |MwL|MwU|McL|McR|Return | * |Contro| | | | | | | |MwL|MwD|MwU|MwR|Return |
* |-----------------------------------------------------------| * |-----------------------------------------------------------|
* |Shift | | | | | | | |MwR|MwD|McD| | | * |Shift | | | | | | |McL|McD|McU|McR|xxxxxx| |
* `-----------------------------------------------------------' * `-----------------------------------------------------------'
* |Gui |Alt |Space |Mb1 |Mb2| * |Gui |Alt |Mb1 |Mb1 |Mb2|
* `--------------------------------------------' * `--------------------------------------------'
* *
* Layer3(Fn3) vi mode * Layer3(Fn3) vi mode
* ,-----------------------------------------------------------. * ,-----------------------------------------------------------.
* |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| | | * |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| | |
* |-----------------------------------------------------------| * |-----------------------------------------------------------|
* |Tab | | | | | |Hom|PgD|PgUlEnd| |MwD|MwU| | * |Tab | | | | | |Hom|PgD|PgUlEnd| |MwD|MwU|Backs|
* |-----------------------------------------------------------| * |-----------------------------------------------------------|
* |Contro| | | | | |Lef|Dow|Up |Rig| | |Return | * |Contro| | | | | |Lef|Dow|Up |Rig| | |Return |
* |-----------------------------------------------------------| * |-----------------------------------------------------------|
* |Shift | | | | |Mb2|McL|McD|McU|McR|Mb1|Mb1 | | * |Shift | | | | | | |McL|McD|McU|McR|Mb1 | |
* `-----------------------------------------------------------' * `-----------------------------------------------------------'
* |Gui|Alt |Space | |Mb2| * |Gui|Alt |Mb1 |xxxxx|Mb2|
* `-------------------------------------------' * `-------------------------------------------'
* Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel * Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel
*/ */
@ -75,8 +75,8 @@ static const uint8_t PROGMEM Keymap[][MATRIX_ROWS][MATRIX_COLS] = {
}, },
// 1: FN_1(HHKB Fn) HHKB mode // 1: FN_1(HHKB Fn) HHKB mode
{ {
{ KB_F2, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, }, { KB_F2, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO },
{ KB_F3, KB_F4, KB_NO, KB_NO, KB_MUTE, KB_F20, KB_NO, KB_NO, }, { KB_F3, KB_F4, KB_NO, KB_NO, KB_MUTE, KB_F20, KB_NO, KB_NO },
{ KB_F5, KB_F6, KB_NO, KB_NO, KB_NO, KP_ASTERISK,KP_PLUS, KB_NO }, { KB_F5, KB_F6, KB_NO, KB_NO, KB_NO, KP_ASTERISK,KP_PLUS, KB_NO },
{ KB_F1, KB_POWER, KB_CAPSLOCK,KB_LCTRL, KB_LSHIFT, KB_LGUI, KB_LALT, KB_SPACE }, { KB_F1, KB_POWER, KB_CAPSLOCK,KB_LCTRL, KB_LSHIFT, KB_LGUI, KB_LALT, KB_SPACE },
{ KB_F7, KB_F8, KB_NO, KB_PSCREEN, KB_HOME, KP_SLASH, KB_MINUS, KB_NO }, { KB_F7, KB_F8, KB_NO, KB_PSCREEN, KB_HOME, KP_SLASH, KB_MINUS, KB_NO },
@ -84,27 +84,27 @@ static const uint8_t PROGMEM Keymap[][MATRIX_ROWS][MATRIX_COLS] = {
{ KB_F9, KB_F10, KB_SCKLOCK, KB_BREAK, KB_LEFT, KB_PGUP, KB_END, KB_NO }, { KB_F9, KB_F10, KB_SCKLOCK, KB_BREAK, KB_LEFT, KB_PGUP, KB_END, KB_NO },
{ KB_F11, KB_F12, KB_NO, KB_UP, KB_RIGHT, KB_DOWN, KB_PGDOWN, KB_NO }, { KB_F11, KB_F12, KB_NO, KB_UP, KB_RIGHT, KB_DOWN, KB_PGDOWN, KB_NO },
}, },
// 2: FN_2(Right Shift) HHKB mouse mode // 2: FN_2(Right Shift) mouse mode
{ {
{ KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, },
{ KB_NO, KB_NO, KB_NO, KB_NO, KB_MUTE, KB_NO, KB_NO, KB_NO, },
{ KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO }, { KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO },
{ KB_NO, KB_ESCAPE, KB_TAB, KB_LCTRL, KB_LSHIFT, KB_LGUI, KB_LALT, KB_SPACE }, { KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO },
{ KB_NO, KB_NO, KB_NO, KB_NO, MS_WH_LEFT, KP_SLASH, KB_MINUS, KB_NO }, { KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO },
{ KB_NO, KB_ESCAPE, KB_TAB, KB_LCTRL, KB_LSHIFT, KB_LGUI, KB_LALT, MS_BTN1 },
{ KB_NO, KB_NO, KB_NO, KB_NO, MS_WH_LEFT, KB_NO, MS_LEFT, KB_NO },
{ KB_NO, KB_NO, KB_BSPACE, KB_ENTER, KB_NO, KB_NO, MS_BTN2, MS_BTN1 }, { KB_NO, KB_NO, KB_BSPACE, KB_ENTER, KB_NO, KB_NO, MS_BTN2, MS_BTN1 },
{ KB_NO, KB_NO, KB_NO, KB_NO, MS_LEFT, MS_WH_DOWN, MS_WH_RIGHT,KB_NO }, { KB_NO, KB_NO, KB_NO, KB_NO, MS_WH_UP, MS_WH_DOWN, MS_DOWN, KB_NO },
{ KB_NO, KB_NO, KB_NO, MS_UP, MS_RIGHT, MS_DOWN, MS_WH_UP, KB_NO }, { KB_NO, KB_NO, KB_NO, KB_NO, MS_WH_RIGHT,MS_RIGHT, MS_UP, KB_NO },
}, },
// 3: FN_3(Right Alt) vi mode // 3: FN_3(Right Alt) vi mode
{ {
{ KB_F2, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, }, { KB_F2, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO, KB_NO },
{ KB_F3, KB_F4, KB_NO, KB_NO, KB_NO, KB_F20, KB_NO, KB_NO, }, { KB_F3, KB_F4, KB_NO, KB_NO, KB_NO, KB_F20, KB_NO, KB_NO },
{ KB_F5, KB_F6, KB_HOME, KB_NO, KB_NO, KB_LEFT, MS_LEFT, KB_NO }, { KB_F5, KB_F6, KB_HOME, KB_NO, KB_NO, KB_LEFT, KB_NO, KB_NO },
{ KB_F1, KB_ESCAPE, KB_TAB, KB_LCTRL, KB_LSHIFT, KB_LGUI, KB_LALT, KB_SPACE }, { KB_F1, KB_ESCAPE, KB_TAB, KB_LCTRL, KB_LSHIFT, KB_LGUI, KB_LALT, MS_BTN1 },
{ KB_F7, KB_F8, KB_PGDOWN, KB_PGUP, KB_UP, KB_DOWN, MS_DOWN, KB_NO }, { KB_F7, KB_F8, KB_PGDOWN, KB_PGUP, KB_UP, KB_DOWN, MS_LEFT, KB_NO },
{ KB_INSERT, KB_NO, KB_BSPACE, KB_ENTER, KB_NO, MS_BTN1, MS_BTN2, KB_NO }, { KB_INSERT, KB_NO, KB_BSPACE, KB_ENTER, KB_NO, MS_BTN1, MS_BTN2, KB_NO },
{ KB_F9, KB_F10, KB_END, KB_NO, KB_NO, KB_RIGHT, MS_UP, KB_NO }, { KB_F9, KB_F10, KB_END, KB_NO, KB_NO, KB_RIGHT, MS_DOWN, KB_NO },
{ KB_F11, KB_F12, MS_WH_DOWN, MS_WH_UP, KB_NO, MS_BTN1, MS_RIGHT, KB_NO }, { KB_F11, KB_F12, MS_WH_UP, MS_WH_DOWN, KB_NO, MS_RIGHT, MS_UP, KB_NO },
}, },
}; };

View File

@ -37,7 +37,7 @@ void matrix_init(void)
// row & col output(PB0-6) // row & col output(PB0-6)
DDRB = 0xFF; DDRB = 0xFF;
PORTB = KEY_SELELCT(0, 0); PORTB = KEY_SELELCT(0, 0);
// key input(KEY/VALID) // KEY & VALID input w/o pullup(PE6,7)
DDRE = 0x3F; DDRE = 0x3F;
PORTE = 0x00; PORTE = 0x00;

9
tmk.c
View File

@ -69,6 +69,7 @@ int main(void)
// Wait an extra second for the PC's operating system to load drivers // Wait an extra second for the PC's operating system to load drivers
// and do whatever it does to actually be ready for input // and do whatever it does to actually be ready for input
// needs such long time in my PC. // needs such long time in my PC.
/* wait for debug print. no need for normal use */
for (int i =0; i < 6; i++) { for (int i =0; i < 6; i++) {
LED_CONFIG; LED_CONFIG;
LED_ON; LED_ON;
@ -146,10 +147,10 @@ int main(void)
if (code == MS_BTN3) mouse_btn |= 1<<2; if (code == MS_BTN3) mouse_btn |= 1<<2;
if (code == MS_BTN4) mouse_btn |= 1<<3; if (code == MS_BTN4) mouse_btn |= 1<<3;
if (code == MS_BTN5) mouse_btn |= 1<<4; if (code == MS_BTN5) mouse_btn |= 1<<4;
if (code == MS_WH_UP) mouse_wheel -= 1; if (code == MS_WH_UP) mouse_wheel += 1;
if (code == MS_WH_DOWN) mouse_wheel += 1; if (code == MS_WH_DOWN) mouse_wheel -= 1;
if (code == MS_WH_LEFT) mouse_hwheel -= 1; if (code == MS_WH_LEFT) mouse_hwheel += 1;
if (code == MS_WH_RIGHT) mouse_hwheel += 1; if (code == MS_WH_RIGHT) mouse_hwheel -= 1;
} else { } else {
// normal keys // normal keys
if (key_index < 6) if (key_index < 6)