diff options
| author | tmk <nobody@nowhere> | 2012-11-13 10:04:35 +0900 |
|---|---|---|
| committer | tmk <nobody@nowhere> | 2012-11-13 10:07:59 +0900 |
| commit | ce4857e021adf0dede358b9334c3bf9d783cb641 (patch) | |
| tree | 0e50220e053586c8fb203f78d2f3769a61ae1a8d /keyboard/hid_liber | |
| parent | 98052b8afd52c93e2d5a1e6acd6afd6e6d2a288c (diff) | |
| download | qmk_firmware-ce4857e021adf0dede358b9334c3bf9d783cb641.tar.gz qmk_firmware-ce4857e021adf0dede358b9334c3bf9d783cb641.zip | |
Fix and keymap of hid_liber from alaricljs at geekhack.org.
Diffstat (limited to 'keyboard/hid_liber')
| -rw-r--r-- | keyboard/hid_liber/Makefile.lufa | 8 | ||||
| -rw-r--r-- | keyboard/hid_liber/Makefile.pjrc | 13 | ||||
| -rw-r--r-- | keyboard/hid_liber/config.h | 4 | ||||
| -rw-r--r-- | keyboard/hid_liber/keymap.c | 197 | ||||
| -rw-r--r-- | keyboard/hid_liber/matrix.c | 52 |
5 files changed, 148 insertions, 126 deletions
diff --git a/keyboard/hid_liber/Makefile.lufa b/keyboard/hid_liber/Makefile.lufa index 1f365da11..2d560b9a6 100644 --- a/keyboard/hid_liber/Makefile.lufa +++ b/keyboard/hid_liber/Makefile.lufa | |||
| @@ -39,7 +39,7 @@ | |||
| 39 | #---------------------------------------------------------------------------- | 39 | #---------------------------------------------------------------------------- |
| 40 | 40 | ||
| 41 | # Target file name (without extension). | 41 | # Target file name (without extension). |
| 42 | TARGET = macway_lufa | 42 | TARGET = hid_liber_lufa |
| 43 | 43 | ||
| 44 | # Directory common source filess exist | 44 | # Directory common source filess exist |
| 45 | TOP_DIR = ../.. | 45 | TOP_DIR = ../.. |
| @@ -97,10 +97,10 @@ F_USB = $(F_CPU) | |||
| 97 | # Build Options | 97 | # Build Options |
| 98 | # comment out to disable the options. | 98 | # comment out to disable the options. |
| 99 | # | 99 | # |
| 100 | MOUSEKEY_ENABLE = yes # Mouse keys | 100 | #MOUSEKEY_ENABLE = yes # Mouse keys |
| 101 | EXTRAKEY_ENABLE = yes # Audio control and System control | 101 | EXTRAKEY_ENABLE = yes # Audio control and System control |
| 102 | CONSOLE_ENABLE = yes # Console for debug | 102 | CONSOLE_ENABLE = yes # Console for debug |
| 103 | #NKRO_ENABLE = yes # USB Nkey Rollover | 103 | #NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA |
| 104 | #PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support | 104 | #PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support |
| 105 | 105 | ||
| 106 | 106 | ||
| @@ -108,7 +108,7 @@ CONSOLE_ENABLE = yes # Console for debug | |||
| 108 | # Teensy halfKay 512 | 108 | # Teensy halfKay 512 |
| 109 | # Atmel DFU loader 4096 | 109 | # Atmel DFU loader 4096 |
| 110 | # LUFA bootloader 4096 | 110 | # LUFA bootloader 4096 |
| 111 | #OPT_DEFS += -DBOOT_SIZE=4096 | 111 | OPT_DEFS += -DBOOT_SIZE=4096 |
| 112 | 112 | ||
| 113 | 113 | ||
| 114 | # Search Path | 114 | # Search Path |
diff --git a/keyboard/hid_liber/Makefile.pjrc b/keyboard/hid_liber/Makefile.pjrc index ecc236e3d..8e349c8da 100644 --- a/keyboard/hid_liber/Makefile.pjrc +++ b/keyboard/hid_liber/Makefile.pjrc | |||
| @@ -39,7 +39,7 @@ | |||
| 39 | #---------------------------------------------------------------------------- | 39 | #---------------------------------------------------------------------------- |
| 40 | 40 | ||
| 41 | # Target file name (without extension). | 41 | # Target file name (without extension). |
| 42 | TARGET = macway_pjrc | 42 | TARGET = hid_liber_pjrc |
| 43 | 43 | ||
| 44 | # Directory common source filess exist | 44 | # Directory common source filess exist |
| 45 | TOP_DIR = ../.. | 45 | TOP_DIR = ../.. |
| @@ -74,16 +74,11 @@ F_CPU = 16000000 | |||
| 74 | # Build Options | 74 | # Build Options |
| 75 | # comment out to disable the options. | 75 | # comment out to disable the options. |
| 76 | # | 76 | # |
| 77 | MOUSEKEY_ENABLE = yes # Mouse keys | 77 | #MOUSEKEY_ENABLE = yes # Mouse keys |
| 78 | #PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support | 78 | #PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support |
| 79 | EXTRAKEY_ENABLE = yes # Audio control and System control | 79 | EXTRAKEY_ENABLE = yes # Audio control and System control |
| 80 | #NKRO_ENABLE = yes # USB Nkey Rollover | 80 | NKRO_ENABLE = yes # USB Nkey Rollover |
| 81 | 81 | CONSOLE_ENABLE = yes # Console for debug | |
| 82 | |||
| 83 | |||
| 84 | #---------------- Programming Options -------------------------- | ||
| 85 | PROGRAM_CMD = teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex | ||
| 86 | |||
| 87 | 82 | ||
| 88 | 83 | ||
| 89 | # Search Path | 84 | # Search Path |
diff --git a/keyboard/hid_liber/config.h b/keyboard/hid_liber/config.h index 71e349a7c..792727165 100644 --- a/keyboard/hid_liber/config.h +++ b/keyboard/hid_liber/config.h | |||
| @@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 24 | #define PRODUCT_ID 0xB919 | 24 | #define PRODUCT_ID 0xB919 |
| 25 | #define DEVICE_VER 0x0001 | 25 | #define DEVICE_VER 0x0001 |
| 26 | #define MANUFACTURER t.m.k. | 26 | #define MANUFACTURER t.m.k. |
| 27 | #define PRODUCT HID Leberation | 27 | #define PRODUCT HID Liberation |
| 28 | 28 | ||
| 29 | 29 | ||
| 30 | /* message strings */ | 30 | /* message strings */ |
| @@ -39,7 +39,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 39 | //#define MATRIX_HAS_GHOST | 39 | //#define MATRIX_HAS_GHOST |
| 40 | 40 | ||
| 41 | /* Set 0 if need no debouncing */ | 41 | /* Set 0 if need no debouncing */ |
| 42 | #define DEBOUNCE 5 | 42 | #define DEBOUNCE 7 |
| 43 | 43 | ||
| 44 | 44 | ||
| 45 | /* key combination for command */ | 45 | /* key combination for command */ |
diff --git a/keyboard/hid_liber/keymap.c b/keyboard/hid_liber/keymap.c index 0378ecc5d..ecfa5cbe6 100644 --- a/keyboard/hid_liber/keymap.c +++ b/keyboard/hid_liber/keymap.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Copyright 2012 Jun Wako <wakojun@gmail.com> | 2 | Copyright 2011 Jun Wako <wakojun@gmail.com> |
| 3 | 3 | ||
| 4 | This program is free software: you can redistribute it and/or modify | 4 | This program is free software: you can redistribute it and/or modify |
| 5 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU General Public License as published by |
| @@ -16,7 +16,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | /* | 18 | /* |
| 19 | * Keymap for Macway mod | 19 | * Keymap for HID Liberator controller |
| 20 | */ | 20 | */ |
| 21 | #include <stdint.h> | 21 | #include <stdint.h> |
| 22 | #include <stdbool.h> | 22 | #include <stdbool.h> |
| @@ -30,60 +30,33 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 30 | 30 | ||
| 31 | // Convert physical keyboard layout to matrix array. | 31 | // Convert physical keyboard layout to matrix array. |
| 32 | // This is a macro to define keymap easily in keyboard layout form. | 32 | // This is a macro to define keymap easily in keyboard layout form. |
| 33 | /* | ||
| 34 | * Tenkeyless keyboard: | ||
| 35 | * ,---. ,---------------. ,---------------. ,---------------. ,-----------. | ||
| 36 | * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| | ||
| 37 | * `---' `---------------' `---------------' `---------------' `-----------' | ||
| 38 | * ,-----------------------------------------------------------. ,-----------. | ||
| 39 | * |~ | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | |Ins|Hom|PgU| | ||
| 40 | * |-----------------------------------------------------------| |-----------| | ||
| 41 | * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | ||
| 42 | * |-----------------------------------------------------------| `-----------' | ||
| 43 | * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return | | ||
| 44 | * |-----------------------------------------------------------| ,---. | ||
| 45 | * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | |Up | | ||
| 46 | * |-----------------------------------------------------------| ,-----------. | ||
| 47 | * |Ctl|Gui|Alt| Space |Alt|Gui|App|Ctl| |Lef|Dow|Rig| | ||
| 48 | * `-----------------------------------------------------------' `-----------' | ||
| 49 | * | ||
| 50 | * TODO: You should define follwing macro properly. It won't be compiled until done. | ||
| 51 | * | ||
| 52 | * Keymap array sapce has 18*8 slot, row is designated with A-Q and col with 0-7. | ||
| 53 | * In this macro KA0 means key at row:A/col:0, KR7 means key at rowR/col7. | ||
| 54 | * Empty slot of keymap should has KC_NO.For example row:B/col:0 has no key | ||
| 55 | * so you must define KC_NO in this slot.(from hid_liber/ansi_iso_jis.c) | ||
| 56 | * Esc key locates at row:A/col:1 so fist argument of macro should say KA1. | ||
| 57 | * Right arrow key locates at row:Q/col:2 so last argument of macro should say KQ2. | ||
| 58 | * | ||
| 59 | * NOTE: Except above examples, the rest of macro definition is garbage just for place holder. | ||
| 60 | */ | ||
| 61 | #define KEYMAP( \ | 33 | #define KEYMAP( \ |
| 62 | KA1,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \ | 34 | KG1, KH7, KJ7, KJ6, KJ1, KO5, KL1, KA6, KA7, KD7, KD5, KD1, KD2, KB5, KB3, KO3, \ |
| 63 | K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, KF0,KEC,KFD, \ | 35 | KG7, KG5, KH5, KJ5, KI5, KI7, KK7, KK5, KL5, KA5, KC5, KC7, KL7, KD6, KQ7, KN7, KM7, \ |
| 64 | K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5D, KF1,KE9,KFA, \ | 36 | KG6, KG3, KH3, KJ3, KI3, KI6, KK6, KK3, KL3, KA3, KC3, KC6, KL6, KD4, KP7, KN5, KM5, \ |
| 65 | K58,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, \ | 37 | KH6, KG4, KH4, KJ4, KI4, KI1, KK1, KK4, KL4, KA4, KC4, KC1, KD0, \ |
| 66 | K12,K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, KF5, \ | 38 | KF6, KQ0, KG0, KH0, KJ0, KI0, KI2, KK2, KK0, KL0, KA0, KC2, KF4, KN1, \ |
| 67 | K14,K9F,K11, K29, K91,KA7,KAF,K94, KEB,KF2,KQ2 \ | 39 | KO7, KE6, KB1, KP1, KB2, KR4, KA2, KO0, KN2, KP2, KQ2 \ |
| 68 | ) { \ | 40 | ) { \ |
| 69 | { KC_##KA0, KC_##KA1, KC_##KA2, KC_##KA3, KC_##KA4, KC_##KA5, KC_##KA6, KC_##KA7 }, \ | 41 | /* 0 1 2 3 4 5 6 7 */ \ |
| 70 | { KC_NO, KC_##KB1, KC_##KB2, KC_##KB3, KC_##KB4, KC_##KB5, KC_##KB6, KC_##KB7 }, \ | 42 | /* A */ { KC_##KA0, KC_NO , KC_##KA2, KC_##KA3, KC_##KA4, KC_##KA5, KC_##KA6, KC_##KA7 }, \ |
| 71 | { KC_##KC0, KC_##KC1, KC_##KC2, KC_##KC3, KC_##KC4, KC_##KC5, KC_##KC6, KC_##KC7 }, \ | 43 | /* B */ { KC_NO , KC_##KB1, KC_##KB2, KC_##KB3, KC_NO , KC_##KB5, KC_NO , KC_NO }, \ |
| 72 | { KC_##KD0, KC_##KD1, KC_##KD2, KC_##KD3, KC_##KD4, KC_##KD5, KC_##KD6, KC_##KD7 }, \ | 44 | /* C */ { KC_NO , KC_##KC1, KC_##KC2, KC_##KC3, KC_##KC4, KC_##KC5, KC_##KC6, KC_##KC7 }, \ |
| 73 | { KC_##KE0, KC_##KE1, KC_##KE2, KC_##KE3, KC_##KE4, KC_##KE5, KC_##KE6, KC_##KE7 }, \ | 45 | /* D */ { KC_##KD0, KC_##KD1, KC_##KD2, KC_NO , KC_##KD4, KC_##KD5, KC_##KD6, KC_##KD7 }, \ |
| 74 | { KC_##KF0, KC_##KF1, KC_##KF2, KC_##KF3, KC_##KF4, KC_##KF5, KC_##KF6, KC_##KF7 }, \ | 46 | /* E */ { KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_##KE6, KC_NO }, \ |
| 75 | { KC_##KG0, KC_##KG1, KC_##KG2, KC_##KG3, KC_##KG4, KC_##KG5, KC_##KG6, KC_##KG7 }, \ | 47 | /* F */ { KC_NO , KC_NO , KC_NO , KC_NO , KC_##KF4, KC_NO , KC_##KF6, KC_NO }, \ |
| 76 | { KC_##KH0, KC_##KH1, KC_##KH2, KC_##KH3, KC_##KH4, KC_##KH5, KC_##KH6, KC_##KH7 }, \ | 48 | /* G */ { KC_##KG0, KC_##KG1, KC_NO , KC_##KG3, KC_##KG4, KC_##KG5, KC_##KG6, KC_##KG7 }, \ |
| 77 | { KC_##KI0, KC_##KI1, KC_##KI2, KC_##KI3, KC_##KI4, KC_##KI5, KC_##KI6, KC_##KI7 }, \ | 49 | /* H */ { KC_##KH0, KC_NO , KC_NO , KC_##KH3, KC_##KH4, KC_##KH5, KC_##KH6, KC_##KH7 }, \ |
| 78 | { KC_##KJ0, KC_##KJ1, KC_##KJ2, KC_##KJ3, KC_##KJ4, KC_##KJ5, KC_##KJ6, KC_##KJ7 }, \ | 50 | /* I */ { KC_##KI0, KC_##KI1, KC_##KI2, KC_##KI3, KC_##KI4, KC_##KI5, KC_##KI6, KC_##KI7 }, \ |
| 79 | { KC_##KK0, KC_##KK1, KC_##KK2, KC_##KK3, KC_##KK4, KC_##KK5, KC_##KK6, KC_##KK7 }, \ | 51 | /* J */ { KC_##KJ0, KC_##KJ1, KC_NO , KC_##KJ3, KC_##KJ4, KC_##KJ5, KC_##KJ6, KC_##KJ7 }, \ |
| 80 | { KC_##KL0, KC_##KL1, KC_##KL2, KC_##KL3, KC_##KL4, KC_##KL5, KC_##KL6, KC_##KL7 }, \ | 52 | /* K */ { KC_##KK0, KC_##KK1, KC_##KK2, KC_##KK3, KC_##KK4, KC_##KK5, KC_##KK6, KC_##KK7 }, \ |
| 81 | { KC_##KM0, KC_##KM1, KC_##KM2, KC_##KM3, KC_##KM4, KC_##KM5, KC_##KM6, KC_##KM7 }, \ | 53 | /* L */ { KC_##KL0, KC_##KL1, KC_NO , KC_##KL3, KC_##KL4, KC_##KL5, KC_##KL6, KC_##KL7 }, \ |
| 82 | { KC_##KN0, KC_##KN1, KC_##KN2, KC_##KN3, KC_##KN4, KC_##KN5, KC_##KN6, KC_##KN7 }, \ | 54 | /* M */ { KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_##KM5, KC_NO , KC_##KM7 }, \ |
| 83 | { KC_##KO0, KC_##KO1, KC_##KO2, KC_##KO3, KC_##KO4, KC_##KO5, KC_##KO6, KC_##KO7 }, \ | 55 | /* N */ { KC_NO , KC_##KN1, KC_##KN2, KC_NO , KC_NO , KC_##KN5, KC_NO , KC_##KN7 }, \ |
| 84 | { KC_##KP0, KC_##KP1, KC_##KP2, KC_##KP3, KC_##KP4, KC_##KP5, KC_##KP6, KC_##KP7 }, \ | 56 | /* O */ { KC_##KO0, KC_NO , KC_NO , KC_##KO3, KC_NO , KC_##KO5, KC_NO , KC_##KO7 }, \ |
| 85 | { KC_##KQ0, KC_##KQ1, KC_##KQ2, KC_##KQ3, KC_##KQ4, KC_##KQ5, KC_##KQ6, KC_##KQ7 }, \ | 57 | /* P */ { KC_NO , KC_##KP1, KC_##KP2, KC_NO , KC_NO , KC_NO , KC_NO , KC_##KP7 }, \ |
| 86 | { KC_##KR0, KC_##KR1, KC_##KR2, KC_##KR3, KC_##KR4, KC_##KR5, KC_##KR6, KC_##KR7 } \ | 58 | /* Q */ { KC_NO , KC_NO , KC_##KQ2, KC_NO , KC_NO , KC_NO , KC_NO , KC_##KQ7 }, \ |
| 59 | /* R */ { KC_NO , KC_NO , KC_NO , KC_NO , KC_##KR4, KC_NO , KC_NO , KC_NO } \ | ||
| 87 | } | 60 | } |
| 88 | 61 | ||
| 89 | #define KEYCODE(layer, row, col) (pgm_read_byte(&keymaps[(layer)][(row)][(col)])) | 62 | #define KEYCODE(layer, row, col) (pgm_read_byte(&keymaps[(layer)][(row)][(col)])) |
| @@ -92,13 +65,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 92 | // Assign Fn key(0-7) to a layer to which switch with the Fn key pressed. | 65 | // Assign Fn key(0-7) to a layer to which switch with the Fn key pressed. |
| 93 | static const uint8_t PROGMEM fn_layer[] = { | 66 | static const uint8_t PROGMEM fn_layer[] = { |
| 94 | 0, // Fn0 | 67 | 0, // Fn0 |
| 95 | 0, // Fn1 | 68 | 1, // Fn1 |
| 96 | 0, // Fn2 | 69 | 2, // Fn2 |
| 97 | 0, // Fn3 | 70 | 3, // Fn3 |
| 98 | 0, // Fn4 | 71 | 4, // Fn4 |
| 99 | 0, // Fn5 | 72 | 5, // Fn5 |
| 100 | 0, // Fn6 | 73 | 6, // Fn6 |
| 101 | 0 // Fn7 | 74 | 7 // Fn7 |
| 102 | }; | 75 | }; |
| 103 | 76 | ||
| 104 | // Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer. | 77 | // Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer. |
| @@ -114,32 +87,84 @@ static const uint8_t PROGMEM fn_keycode[] = { | |||
| 114 | KC_NO // Fn7 | 87 | KC_NO // Fn7 |
| 115 | }; | 88 | }; |
| 116 | 89 | ||
| 117 | /* See common/keycode.h for short name of key symbol. */ | 90 | /* |
| 91 | * Tenkeyless keyboard default layout, ISO & ANSI (ISO is next to right shift, | ||
| 92 | * not present on ANSI, other ISO switches move from ANSI layout but are same | ||
| 93 | * switch | ||
| 94 | * | ||
| 95 | * ,---. ,---------------. ,---------------. ,---------------. ,-----------. | ||
| 96 | * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| | ||
| 97 | * `---' `---------------' `---------------' `---------------' `-----------' | ||
| 98 | * ,-----------------------------------------------------------. ,-----------. | ||
| 99 | * |~ | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | |Ins|Hom|PgU| | ||
| 100 | * |-----------------------------------------------------------| |-----------| | ||
| 101 | * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | ||
| 102 | * |-----------------------------------------------------------| `-----------' | ||
| 103 | * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Return | | ||
| 104 | * |-----------------------------------------------------------| ,---. | ||
| 105 | * |Shft|ISO| Z| X| C| V| B| N| M| ,| .| /|Shift | |Up | | ||
| 106 | * |-----------------------------------------------------------| ,-----------. | ||
| 107 | * |Ctl|Gui|Alt| Space |Alt|Gui|App|Ctl| |Lef|Dow|Rig| | ||
| 108 | * `-----------------------------------------------------------' `-----------' | ||
| 109 | */ | ||
| 110 | |||
| 111 | |||
| 118 | static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 112 | static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
| 119 | /* Layer 0: Default Layer | 113 | /* Layer 0: Default Layer |
| 120 | * ,---. ,---------------. ,---------------. ,---------------. ,-----------. | 114 | * |
| 121 | * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| | 115 | * ANSI: |
| 122 | * `---' `---------------' `---------------' `---------------' `-----------' | 116 | * |
| 123 | * ,-----------------------------------------------------------. ,-----------. | 117 | * ,---. ,---------------. ,---------------. ,---------------. ,-----------. |
| 124 | * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| | 118 | * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |
| 125 | * |-----------------------------------------------------------| |-----------| | 119 | * `---' `---------------' `---------------' `---------------' `-----------' |
| 126 | * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 120 | * ,-----------------------------------------------------------. ,-----------. |
| 127 | * |-----------------------------------------------------------| `-----------' | 121 | * |~ | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | |Ins|Hom|PgU| |
| 128 | * |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | | 122 | * |-----------------------------------------------------------| |-----------| |
| 129 | * |-----------------------------------------------------------| ,---. | 123 | * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| |
| 130 | * |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 124 | * |-----------------------------------------------------------| `-----------' |
| 131 | * |-----------------------------------------------------------| ,-----------. | 125 | * |FN1 | A| S| D| F| G| H| J| K| L| ;| '|Return | |
| 132 | * |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl| |Lef|Dow|Rig| | 126 | * |-----------------------------------------------------------| ,---. |
| 133 | * `-----------------------------------------------------------' `-----------' | 127 | * |Shft | Z| X| C| V| B| N| M| ,| .| /|Shift | |Up | |
| 134 | */ | 128 | * |-----------------------------------------------------------| ,-----------. |
| 135 | KEYMAP( | 129 | * |Ctl|Gui|Alt| Space |Alt|Gui|App|Ctl| |Lef|Dow|Rig| |
| 136 | ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, | 130 | * `-----------------------------------------------------------' `-----------' |
| 137 | GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, | 131 | */ |
| 138 | TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, | 132 | |
| 139 | CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, | 133 | KEYMAP(\ |
| 140 | LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, | 134 | ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR, SLCK, BRK, \ |
| 141 | LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT | 135 | GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS, EQL, BSPC, INS, HOME, PGUP, \ |
| 142 | ), | 136 | TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC, RBRC, BSLS, DEL, END, PGDN, \ |
| 137 | FN1, A, S, D, F, G, H, J, K, L, SCLN, QUOT, ENT, \ | ||
| 138 | LSFT, 0, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT, UP, \ | ||
| 139 | LCTL, LGUI, LALT, SPC, RALT, RGUI, APP, RCTL, LEFT, DOWN, RGHT), | ||
| 140 | |||
| 141 | |||
| 142 | /* | ||
| 143 | * ,---. ,---------------. ,---------------. ,---------------. ,-----------. | ||
| 144 | * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Slp| | ||
| 145 | * `---' `---------------' `---------------' `---------------' `-----------' | ||
| 146 | * ,-----------------------------------------------------------. ,-----------. | ||
| 147 | * |~ | 1| 2| 3| 4| 5| 6| 7| 8| 9|Mut|V- |V+ |Backsp | |Ins|Hom|PgU| | ||
| 148 | * |-----------------------------------------------------------| |-----------| | ||
| 149 | * |Tab | Q| W| E| R| T| Y| U| I|MSt|Ply|Prv|Nxt|Media| |Del|End|PgD| | ||
| 150 | * |-----------------------------------------------------------| `-----------' | ||
| 151 | * |FN1 | A| S| D| F| G| H| J| K| L| ;| '|Return | | ||
| 152 | * |-----------------------------------------------------------| ,---. | ||
| 153 | * |Shft | Z| X|Clc| V| B| N| M| ,| .| /|Caps | |Up | | ||
| 154 | * |-----------------------------------------------------------| ,-----------. | ||
| 155 | * |Ctl|Gui|Alt| Space |Alt|Gui|App|Ctl| |Lef|Dow|Rig| | ||
| 156 | * `-----------------------------------------------------------' `-----------' | ||
| 157 | */ | ||
| 158 | |||
| 159 | KEYMAP(\ | ||
| 160 | ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR, SLCK, SLEP, \ | ||
| 161 | GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9,MUTE, VOLD, VOLU, BSPC, INS, HOME, PGUP, \ | ||
| 162 | TAB, Q, W, E, R, T, Y, U, I,MSTP,MPLY, MPRV, MNXT, MSEL, DEL, END, PGDN, \ | ||
| 163 | FN1, A, S, D, F, G, H, J, K, L, SCLN, QUOT, ENT, \ | ||
| 164 | LSFT, NO, Z, X,CALC, V, B, N, M, COMM, DOT, SLSH, CAPS, UP, \ | ||
| 165 | LCTL, LGUI, LALT, SPC, RALT, RGUI, APP, RCTL, LEFT, DOWN, RGHT), | ||
| 166 | |||
| 167 | |||
| 143 | }; | 168 | }; |
| 144 | 169 | ||
| 145 | 170 | ||
diff --git a/keyboard/hid_liber/matrix.c b/keyboard/hid_liber/matrix.c index 8e3739197..6798b36d7 100644 --- a/keyboard/hid_liber/matrix.c +++ b/keyboard/hid_liber/matrix.c | |||
| @@ -19,7 +19,7 @@ | |||
| 19 | 19 | ||
| 20 | 20 | ||
| 21 | #ifndef DEBOUNCE | 21 | #ifndef DEBOUNCE |
| 22 | # define DEBOUNCE 5 | 22 | # define DEBOUNCE 0 |
| 23 | #endif | 23 | #endif |
| 24 | static uint8_t debouncing = DEBOUNCE; | 24 | static uint8_t debouncing = DEBOUNCE; |
| 25 | 25 | ||
| @@ -30,8 +30,6 @@ static matrix_row_t _matrix0[MATRIX_ROWS]; | |||
| 30 | static matrix_row_t _matrix1[MATRIX_ROWS]; | 30 | static matrix_row_t _matrix1[MATRIX_ROWS]; |
| 31 | 31 | ||
| 32 | 32 | ||
| 33 | #define NROW 18 | ||
| 34 | #define NCOL 8 | ||
| 35 | #define _DDRA (uint8_t *const)&DDRA | 33 | #define _DDRA (uint8_t *const)&DDRA |
| 36 | #define _DDRB (uint8_t *const)&DDRB | 34 | #define _DDRB (uint8_t *const)&DDRB |
| 37 | #define _DDRC (uint8_t *const)&DDRC | 35 | #define _DDRC (uint8_t *const)&DDRC |
| @@ -64,35 +62,39 @@ static matrix_row_t _matrix1[MATRIX_ROWS]; | |||
| 64 | 62 | ||
| 65 | /* Specifies the ports and pin numbers for the rows */ | 63 | /* Specifies the ports and pin numbers for the rows */ |
| 66 | static | 64 | static |
| 67 | uint8_t *const row_ddr[NROW] = { _DDRB, _DDRB, | 65 | uint8_t *const row_ddr[MATRIX_ROWS] = { |
| 68 | _DDRC, _DDRC, | 66 | _DDRB, _DDRB, |
| 69 | _DDRD, _DDRD, _DDRD, _DDRD, _DDRD, _DDRD, _DDRD, _DDRD, | 67 | _DDRC, _DDRC, |
| 70 | _DDRF, _DDRF, _DDRF, _DDRF, _DDRF, _DDRF}; | 68 | _DDRD, _DDRD, _DDRD, _DDRD, _DDRD, _DDRD, _DDRD, _DDRD, |
| 69 | _DDRF, _DDRF, _DDRF, _DDRF, _DDRF, _DDRF}; | ||
| 71 | 70 | ||
| 72 | static | 71 | static |
| 73 | uint8_t *const row_port[NROW] = { _PORTB, _PORTB, | 72 | uint8_t *const row_port[MATRIX_ROWS] = { |
| 74 | _PORTC, _PORTC, | 73 | _PORTB, _PORTB, |
| 75 | _PORTD, _PORTD, _PORTD, _PORTD, _PORTD, _PORTD, _PORTD, _PORTD, | 74 | _PORTC, _PORTC, |
| 76 | _PORTF, _PORTF, _PORTF, _PORTF, _PORTF, _PORTF}; | 75 | _PORTD, _PORTD, _PORTD, _PORTD, _PORTD, _PORTD, _PORTD, _PORTD, |
| 76 | _PORTF, _PORTF, _PORTF, _PORTF, _PORTF, _PORTF}; | ||
| 77 | 77 | ||
| 78 | static | 78 | static |
| 79 | uint8_t *const row_pin[NROW] = { _PINB, _PINB, | 79 | uint8_t *const row_pin[MATRIX_ROWS] = { |
| 80 | _PINC, _PINC, | 80 | _PINB, _PINB, |
| 81 | _PIND, _PIND, _PIND, _PIND, _PIND, _PIND, _PIND, _PIND, | 81 | _PINC, _PINC, |
| 82 | _PINF, _PINF, _PINF, _PINF, _PINF, _PINF}; | 82 | _PIND, _PIND, _PIND, _PIND, _PIND, _PIND, _PIND, _PIND, |
| 83 | _PINF, _PINF, _PINF, _PINF, _PINF, _PINF}; | ||
| 83 | 84 | ||
| 84 | static | 85 | static |
| 85 | const uint8_t row_bit[NROW] = { _BIT4, _BIT7, | 86 | const uint8_t row_bit[MATRIX_ROWS] = { |
| 86 | _BIT6, _BIT7, | 87 | _BIT4, _BIT7, |
| 87 | _BIT0, _BIT1, _BIT2, _BIT3, _BIT4, _BIT5, _BIT6, _BIT7, | 88 | _BIT6, _BIT7, |
| 88 | _BIT0, _BIT1, _BIT4, _BIT5, _BIT6, _BIT7}; | 89 | _BIT0, _BIT1, _BIT2, _BIT3, _BIT4, _BIT5, _BIT6, _BIT7, |
| 90 | _BIT0, _BIT1, _BIT4, _BIT5, _BIT6, _BIT7}; | ||
| 89 | 91 | ||
| 90 | static | 92 | static |
| 91 | const uint8_t mask = 0x0E; | 93 | const uint8_t mask = 0x0E; |
| 92 | 94 | ||
| 93 | /* Specifies the ports and pin numbers for the columns */ | 95 | /* Specifies the ports and pin numbers for the columns */ |
| 94 | static | 96 | static |
| 95 | const uint8_t col_bit[NCOL] = { 0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E}; | 97 | const uint8_t col_bit[MATRIX_COLS] = { 0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E}; |
| 96 | 98 | ||
| 97 | static | 99 | static |
| 98 | inline void pull_column(int col) { | 100 | inline void pull_column(int col) { |
| @@ -110,7 +112,7 @@ void setup_io_pins(void) { | |||
| 110 | uint8_t row; | 112 | uint8_t row; |
| 111 | DDRB |= 0x0E; | 113 | DDRB |= 0x0E; |
| 112 | PORTB &= ~0x0E; | 114 | PORTB &= ~0x0E; |
| 113 | for(row = 0; row < NROW; row++) { | 115 | for(row = 0; row < MATRIX_ROWS; row++) { |
| 114 | *row_ddr[row] &= ~row_bit[row]; | 116 | *row_ddr[row] &= ~row_bit[row]; |
| 115 | *row_port[row] &= ~row_bit[row]; | 117 | *row_port[row] &= ~row_bit[row]; |
| 116 | } | 118 | } |
| @@ -140,7 +142,7 @@ void matrix_init(void) | |||
| 140 | // To use PORTF disable JTAG with writing JTD bit twice within four cycles. | 142 | // To use PORTF disable JTAG with writing JTD bit twice within four cycles. |
| 141 | MCUCR |= (1<<JTD); | 143 | MCUCR |= (1<<JTD); |
| 142 | MCUCR |= (1<<JTD); | 144 | MCUCR |= (1<<JTD); |
| 143 | 145 | ||
| 144 | // initialize row and col | 146 | // initialize row and col |
| 145 | setup_io_pins(); | 147 | setup_io_pins(); |
| 146 | setup_leds(); | 148 | setup_leds(); |
| @@ -160,10 +162,10 @@ uint8_t matrix_scan(void) | |||
| 160 | matrix = tmp; | 162 | matrix = tmp; |
| 161 | } | 163 | } |
| 162 | 164 | ||
| 163 | for (uint8_t col = 0; col < NCOL; col++) { // 0-7 | 165 | for (uint8_t col = 0; col < MATRIX_COLS; col++) { // 0-7 |
| 164 | pull_column(col); // output hi on theline | 166 | pull_column(col); // output hi on theline |
| 165 | _delay_us(1); // without this wait it won't read stable value. | 167 | _delay_us(3); // without this wait it won't read stable value. |
| 166 | for (uint8_t row = 0; row < NROW; row++) { // 0-17 | 168 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { // 0-17 |
| 167 | bool prev_bit = matrix[row] & (1<<col); | 169 | bool prev_bit = matrix[row] & (1<<col); |
| 168 | bool curr_bit = *row_pin[row] & row_bit[row]; | 170 | bool curr_bit = *row_pin[row] & row_bit[row]; |
| 169 | if (prev_bit != curr_bit) { | 171 | if (prev_bit != curr_bit) { |
