diff options
| -rw-r--r-- | keyboard/gh60/Makefile (renamed from keyboard/gh60/Makefile.lufa) | 23 | ||||
| -rw-r--r-- | keyboard/gh60/README.md | 64 | ||||
| -rw-r--r-- | keyboard/gh60/keymap_common.c | 30 | ||||
| -rw-r--r-- | keyboard/gh60/keymap_common.h | 69 | ||||
| -rw-r--r-- | keyboard/gh60/keymap_hasu.c (renamed from keyboard/gh60/keymap.c) | 108 | ||||
| -rw-r--r-- | keyboard/gh60/keymap_plain.c (renamed from keyboard/gh60/keymap_plain.h) | 6 | ||||
| -rw-r--r-- | keyboard/gh60/keymap_poker.c (renamed from keyboard/gh60/keymap_poker.h) | 6 | ||||
| -rw-r--r-- | keyboard/gh60/keymap_poker_bit.c (renamed from keyboard/gh60/keymap_poker_bit.h) | 6 | ||||
| -rw-r--r-- | keyboard/gh60/keymap_poker_set.c (renamed from keyboard/gh60/keymap_poker_set.h) | 6 |
9 files changed, 143 insertions, 175 deletions
diff --git a/keyboard/gh60/Makefile.lufa b/keyboard/gh60/Makefile index ad7d219e3..108a85c59 100644 --- a/keyboard/gh60/Makefile.lufa +++ b/keyboard/gh60/Makefile | |||
| @@ -48,9 +48,14 @@ TOP_DIR = ../.. | |||
| 48 | TARGET_DIR = . | 48 | TARGET_DIR = . |
| 49 | 49 | ||
| 50 | # project specific files | 50 | # project specific files |
| 51 | SRC = keymap.c \ | 51 | SRC = keymap_common.c \ |
| 52 | matrix.c \ | 52 | matrix.c \ |
| 53 | led.c | 53 | led.c |
| 54 | ifdef KEYMAP | ||
| 55 | SRC := keymap_$(KEYMAP).c $(SRC) | ||
| 56 | else | ||
| 57 | SRC := keymap_poker.c $(SRC) | ||
| 58 | endif | ||
| 54 | 59 | ||
| 55 | CONFIG_H = config.h | 60 | CONFIG_H = config.h |
| 56 | 61 | ||
| @@ -93,7 +98,7 @@ ARCH = AVR8 | |||
| 93 | F_USB = $(F_CPU) | 98 | F_USB = $(F_CPU) |
| 94 | 99 | ||
| 95 | # Interrupt driven control endpoint task(+60) | 100 | # Interrupt driven control endpoint task(+60) |
| 96 | #OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT | 101 | OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT |
| 97 | 102 | ||
| 98 | 103 | ||
| 99 | # Boot Section Size in *bytes* | 104 | # Boot Section Size in *bytes* |
| @@ -114,7 +119,7 @@ EXTRAKEY_ENABLE = yes # Audio control and System control(+450) | |||
| 114 | CONSOLE_ENABLE = yes # Console for debug(+400) | 119 | CONSOLE_ENABLE = yes # Console for debug(+400) |
| 115 | COMMAND_ENABLE = yes # Commands for debug and configuration | 120 | COMMAND_ENABLE = yes # Commands for debug and configuration |
| 116 | SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend | 121 | SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend |
| 117 | #NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA | 122 | NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA |
| 118 | 123 | ||
| 119 | 124 | ||
| 120 | # Optimize size but this may cause error "relocation truncated to fit" | 125 | # Optimize size but this may cause error "relocation truncated to fit" |
| @@ -127,15 +132,3 @@ VPATH += $(TOP_DIR) | |||
| 127 | include $(TOP_DIR)/protocol/lufa.mk | 132 | include $(TOP_DIR)/protocol/lufa.mk |
| 128 | include $(TOP_DIR)/common.mk | 133 | include $(TOP_DIR)/common.mk |
| 129 | include $(TOP_DIR)/rules.mk | 134 | include $(TOP_DIR)/rules.mk |
| 130 | |||
| 131 | plain: OPT_DEFS += -DKEYMAP_PLAIN | ||
| 132 | plain: all | ||
| 133 | |||
| 134 | poker: OPT_DEFS += -DKEYMAP_POKER | ||
| 135 | poker: all | ||
| 136 | |||
| 137 | poker_set: OPT_DEFS += -DKEYMAP_POKER_SET | ||
| 138 | poker_set: all | ||
| 139 | |||
| 140 | poker_bit: OPT_DEFS += -DKEYMAP_POKER_BIT | ||
| 141 | poker_bit: all | ||
diff --git a/keyboard/gh60/README.md b/keyboard/gh60/README.md index 4dc4e5ee2..9068c3898 100644 --- a/keyboard/gh60/README.md +++ b/keyboard/gh60/README.md | |||
| @@ -10,28 +10,20 @@ DIY compact keyboard designed and run by komar007 and Geekhack community. | |||
| 10 | ## Build | 10 | ## Build |
| 11 | Move to this directory then just run `make` like: | 11 | Move to this directory then just run `make` like: |
| 12 | 12 | ||
| 13 | $ make -f Makfile.[pjrc|lufa] | 13 | $ make |
| 14 | 14 | ||
| 15 | Use `Makefile.pjrc` if you want to use PJRC stack or use `Makefile.lufa` for LUFA stack. | 15 | Use `make -f Makefile.pjrc` if you want to use PJRC stack but I find no reason to do so now. |
| 16 | |||
| 17 | |||
| 18 | ## Boot Magic | ||
| 19 | Plugin pressing these `Boot Magic` key. | ||
| 20 | |||
| 21 | - `Fn` key for bootloader kick up. | ||
| 22 | - `D` key for Debug enable. | ||
| 23 | 16 | ||
| 24 | 17 | ||
| 25 | ## Keymap | 18 | ## Keymap |
| 26 | Two version of keymap are available. `Plan`, `Poker` and `Funky`(default). | 19 | Several version of keymap are available; `plain`, `poker_bit`, `poker_set`, `hasu` and `poker`(default). See keymap document(you can find in README.md of top) and `keymap_*.c` to define your own favourite keymap. |
| 27 | See keymap.c to define your own favourite keymap. | ||
| 28 | 20 | ||
| 29 | $ make -f Makefile.[pjrc|lufa] [plain|poker] | 21 | $ make KEYMAP=[poker|plain|poker_set|poker_bit|hasu] |
| 30 | 22 | ||
| 31 | ### 1. Plain keymap | 23 | ### 1. Plain keymap |
| 32 | This will be useful if you want to use key mapping tool like AHK. | 24 | Even without any Fn layer. This will be useful if you want to use key mapping tool like AHK. |
| 33 | 25 | ||
| 34 | See [keymap_plain.h](keymap_plain.h) for detail. | 26 | See [keymap_plain.c](keymap_plain.c) for detail. |
| 35 | 27 | ||
| 36 | #### 1.0 Plain Default Layer | 28 | #### 1.0 Plain Default Layer |
| 37 | ,-----------------------------------------------------------. | 29 | ,-----------------------------------------------------------. |
| @@ -48,9 +40,13 @@ See [keymap_plain.h](keymap_plain.h) for detail. | |||
| 48 | 40 | ||
| 49 | ### 2 Poker keymap | 41 | ### 2 Poker keymap |
| 50 | 42 | ||
| 51 | See [keymap_poker.h](keymap_poker.h) for Poker layer emulation, [keymap_poker_bit.h](keymap_poker_bit.h) and [keymap_poker_set.h](keymap_poker_set.h) for better support of Esc and arrow. | 43 | [keymap_poker.c](keymap_poker.c) emulates original Poker layer emulation. |
| 44 | [keymap_poker_bit.c](keymap_poker_bit.c) and [keymap_poker_set.c](keymap_poker_set.c) offers better support of Esc and arrow like: | ||
| 52 | 45 | ||
| 53 | These keymap supports Colemak, Dvorak and Workmans, use `Magic` + {`1`, `2`, `3`} to switch and `Magic` + `0` to return to Qwerty. | 46 | Fn + Esc = ` |
| 47 | Fn + {left, down, up, right} = {home, pgdown, pgup, end} | ||
| 48 | |||
| 49 | `poker` keymap supports Colemak, Dvorak and Workmans, use `Magic` + {`1`, `2`, `3`} to switch and `Magic` + `0` to return to Qwerty, where `Magic` is `LShift` + `RShift`. | ||
| 54 | 50 | ||
| 55 | #### 2.0 Poker Default Layer | 51 | #### 2.0 Poker Default Layer |
| 56 | ,-----------------------------------------------------------. | 52 | ,-----------------------------------------------------------. |
| @@ -65,32 +61,6 @@ See [keymap_poker.h](keymap_poker.h) for Poker layer emulation, [keymap_poker_bi | |||
| 65 | |Ctrl|Gui |Alt | Space |Fn |Gui |App |Ctrl| | 61 | |Ctrl|Gui |Alt | Space |Fn |Gui |App |Ctrl| |
| 66 | `-----------------------------------------------------------' | 62 | `-----------------------------------------------------------' |
| 67 | 63 | ||
| 68 | #### 2.1 Poker Arrow Layer | ||
| 69 | ,-----------------------------------------------------------. | ||
| 70 | | | | | | | | | | | | | | | | | ||
| 71 | |-----------------------------------------------------------| | ||
| 72 | | | | | | | | | | | | | | | | | ||
| 73 | |-----------------------------------------------------------| | ||
| 74 | | | | | | | | | | | | | | | | ||
| 75 | |-----------------------------------------------------------| | ||
| 76 | | | | | | | | | | | | | Up | | ||
| 77 | |-----------------------------------------------------------| | ||
| 78 | | | | | |Fn |Left|Down|Righ| | ||
| 79 | `-----------------------------------------------------------' | ||
| 80 | |||
| 81 | #### 2.2 Poker Esc Layer | ||
| 82 | ,-----------------------------------------------------------. | ||
| 83 | |Esc| | | | | | | | | | | | | | | ||
| 84 | |-----------------------------------------------------------| | ||
| 85 | | | | | | | | | | | | | | | | | ||
| 86 | |-----------------------------------------------------------| | ||
| 87 | | | | | | | | | | | | | | | | ||
| 88 | |-----------------------------------------------------------| | ||
| 89 | | | | | | | | | | | | | | | ||
| 90 | |-----------------------------------------------------------| | ||
| 91 | | | | | |Fn | | | | | ||
| 92 | `-----------------------------------------------------------' | ||
| 93 | |||
| 94 | #### 2.1 Poker Fn Layer | 64 | #### 2.1 Poker Fn Layer |
| 95 | ,-----------------------------------------------------------. | 65 | ,-----------------------------------------------------------. |
| 96 | |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| | | 66 | |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| | |
| @@ -99,17 +69,15 @@ See [keymap_poker.h](keymap_poker.h) for Poker layer emulation, [keymap_poker_bi | |||
| 99 | |-----------------------------------------------------------| | 69 | |-----------------------------------------------------------| |
| 100 | | |Lef|Dow|Rig| | |Psc|Slk|Pau| |Tsk|End| | | 70 | | |Lef|Dow|Rig| | |Psc|Slk|Pau| |Tsk|End| | |
| 101 | |-----------------------------------------------------------| | 71 | |-----------------------------------------------------------| |
| 102 | | |Del| |Web|Mut|VoU|VoD| |PgU|PgD|Del| | | 72 | | |Del| |Web|Mut|VoU|VoD| |PgU|PgD|Del| Up | |
| 103 | |-----------------------------------------------------------| | 73 | |-----------------------------------------------------------| |
| 104 | | | | | FnS |Fn | | | | | 74 | | | | | FnS |Fn |Left|Down|Righ| |
| 105 | `-----------------------------------------------------------' | 75 | `-----------------------------------------------------------' |
| 106 | 76 | ||
| 107 | 77 | ||
| 108 | 78 | ||
| 109 | ### 3. Funky keymap | 79 | ### 3. Hasu keymap |
| 110 | This is my keymap(default) with HHKB, Vi cursor and Mousekey layer. | 80 | This is my keymap with HHKB, Vi cursor and Mousekey layer. See [keymap_hasu.c](keymap_hasu.c) for detail. |
| 111 | |||
| 112 | See [keymap.c](keymap.c) for detail. | ||
| 113 | 81 | ||
| 114 | #### 3.0 Funky Default Layer | 82 | #### 3.0 Funky Default Layer |
| 115 | ,-----------------------------------------------------------. | 83 | ,-----------------------------------------------------------. |
diff --git a/keyboard/gh60/keymap_common.c b/keyboard/gh60/keymap_common.c new file mode 100644 index 000000000..7b6379f6b --- /dev/null +++ b/keyboard/gh60/keymap_common.c | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2012,2013 Jun Wako <wakojun@gmail.com> | ||
| 3 | |||
| 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 | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | #include "keymap_common.h" | ||
| 18 | |||
| 19 | |||
| 20 | /* translates key to keycode */ | ||
| 21 | uint8_t keymap_key_to_keycode(uint8_t layer, key_t key) | ||
| 22 | { | ||
| 23 | return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]); | ||
| 24 | } | ||
| 25 | |||
| 26 | /* translates Fn keycode to action */ | ||
| 27 | action_t keymap_fn_to_action(uint8_t keycode) | ||
| 28 | { | ||
| 29 | return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) }; | ||
| 30 | } | ||
diff --git a/keyboard/gh60/keymap_common.h b/keyboard/gh60/keymap_common.h new file mode 100644 index 000000000..2105caabd --- /dev/null +++ b/keyboard/gh60/keymap_common.h | |||
| @@ -0,0 +1,69 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2012,2013 Jun Wako <wakojun@gmail.com> | ||
| 3 | |||
| 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 | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | #ifndef KEYMAP_COMMON_H | ||
| 18 | #define KEYMAP_COMMON_H | ||
| 19 | |||
| 20 | #include <stdint.h> | ||
| 21 | #include <stdbool.h> | ||
| 22 | #include <avr/pgmspace.h> | ||
| 23 | #include "keycode.h" | ||
| 24 | #include "action.h" | ||
| 25 | #include "action_macro.h" | ||
| 26 | #include "report.h" | ||
| 27 | #include "host.h" | ||
| 28 | #include "print.h" | ||
| 29 | #include "debug.h" | ||
| 30 | #include "keymap.h" | ||
| 31 | |||
| 32 | |||
| 33 | extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; | ||
| 34 | extern const uint16_t fn_actions[]; | ||
| 35 | |||
| 36 | |||
| 37 | /* GH60 keymap definition macro | ||
| 38 | * K2C, K31 and K3C are extra keys for ISO | ||
| 39 | */ | ||
| 40 | #define KEYMAP( \ | ||
| 41 | K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \ | ||
| 42 | K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ | ||
| 43 | K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, \ | ||
| 44 | K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \ | ||
| 45 | K40, K41, K42, K45, K4A, K4B, K4C, K4D \ | ||
| 46 | ) { \ | ||
| 47 | { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D }, \ | ||
| 48 | { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D }, \ | ||
| 49 | { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D }, \ | ||
| 50 | { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D }, \ | ||
| 51 | { KC_##K40, KC_##K41, KC_##K42, KC_NO, KC_NO, KC_##K45, KC_NO, KC_NO, KC_NO, KC_NO, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D } \ | ||
| 52 | } | ||
| 53 | |||
| 54 | /* ANSI valiant. No extra keys for ISO */ | ||
| 55 | #define KEYMAP_ANSI( \ | ||
| 56 | K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \ | ||
| 57 | K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ | ||
| 58 | K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2D, \ | ||
| 59 | K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, \ | ||
| 60 | K40, K41, K42, K45, K4A, K4B, K4C, K4D \ | ||
| 61 | ) KEYMAP( \ | ||
| 62 | K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \ | ||
| 63 | K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ | ||
| 64 | K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, NO, K2D, \ | ||
| 65 | K30, NO, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, NO, K3D, \ | ||
| 66 | K40, K41, K42, K45, K4A, K4B, K4C, K4D \ | ||
| 67 | ) | ||
| 68 | |||
| 69 | #endif | ||
diff --git a/keyboard/gh60/keymap.c b/keyboard/gh60/keymap_hasu.c index edc1caf19..e648687aa 100644 --- a/keyboard/gh60/keymap.c +++ b/keyboard/gh60/keymap_hasu.c | |||
| @@ -1,77 +1,8 @@ | |||
| 1 | /* | 1 | #include "keymap_common.h" |
| 2 | Copyright 2012,2013 Jun Wako <wakojun@gmail.com> | ||
| 3 | |||
| 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 | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | #include <stdint.h> | ||
| 18 | #include <stdbool.h> | ||
| 19 | #include <avr/pgmspace.h> | ||
| 20 | #include "keycode.h" | ||
| 21 | #include "action.h" | ||
| 22 | #include "action_macro.h" | ||
| 23 | #include "report.h" | ||
| 24 | #include "host.h" | ||
| 25 | #include "print.h" | ||
| 26 | #include "debug.h" | ||
| 27 | #include "keymap.h" | ||
| 28 | |||
| 29 | |||
| 30 | /* GH60 keymap definition macro | ||
| 31 | * K2C, K31 and K3C are extra keys for ISO | ||
| 32 | */ | ||
| 33 | #define KEYMAP( \ | ||
| 34 | K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \ | ||
| 35 | K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ | ||
| 36 | K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, \ | ||
| 37 | K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, \ | ||
| 38 | K40, K41, K42, K45, K4A, K4B, K4C, K4D \ | ||
| 39 | ) { \ | ||
| 40 | { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D }, \ | ||
| 41 | { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D }, \ | ||
| 42 | { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D }, \ | ||
| 43 | { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D }, \ | ||
| 44 | { KC_##K40, KC_##K41, KC_##K42, KC_NO, KC_NO, KC_##K45, KC_NO, KC_NO, KC_NO, KC_NO, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D } \ | ||
| 45 | } | ||
| 46 | 2 | ||
| 47 | /* ANSI valiant. No extra keys for ISO */ | 3 | const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
| 48 | #define KEYMAP_ANSI( \ | ||
| 49 | K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \ | ||
| 50 | K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ | ||
| 51 | K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2D, \ | ||
| 52 | K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3D, \ | ||
| 53 | K40, K41, K42, K45, K4A, K4B, K4C, K4D \ | ||
| 54 | ) KEYMAP( \ | ||
| 55 | K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \ | ||
| 56 | K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, \ | ||
| 57 | K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, NO, K2D, \ | ||
| 58 | K30, NO, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, NO, K3D, \ | ||
| 59 | K40, K41, K42, K45, K4A, K4B, K4C, K4D \ | ||
| 60 | ) | ||
| 61 | |||
| 62 | |||
| 63 | #if defined(KEYMAP_PLAIN) | ||
| 64 | #include "keymap_plain.h" | ||
| 65 | #elif defined(KEYMAP_POKER) | ||
| 66 | #include "keymap_poker.h" | ||
| 67 | #elif defined(KEYMAP_POKER_SET) | ||
| 68 | #include "keymap_poker_set.h" | ||
| 69 | #elif defined(KEYMAP_POKER_BIT) | ||
| 70 | #include "keymap_poker_bit.h" | ||
| 71 | #else | ||
| 72 | static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 73 | /* | 4 | /* |
| 74 | * Funky | 5 | * Hasu |
| 75 | */ | 6 | */ |
| 76 | /* Keymap 0: Default Layer | 7 | /* Keymap 0: Default Layer |
| 77 | * ,-----------------------------------------------------------. | 8 | * ,-----------------------------------------------------------. |
| @@ -200,7 +131,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 200 | /* | 131 | /* |
| 201 | * Fn action definition | 132 | * Fn action definition |
| 202 | */ | 133 | */ |
| 203 | static const uint16_t PROGMEM fn_actions[] = { | 134 | const uint16_t PROGMEM fn_actions[] = { |
| 204 | [0] = ACTION_LAYER_MOMENTARY(4), | 135 | [0] = ACTION_LAYER_MOMENTARY(4), |
| 205 | [1] = ACTION_LAYER_TAP_KEY(5, KC_SLASH), | 136 | [1] = ACTION_LAYER_TAP_KEY(5, KC_SLASH), |
| 206 | [2] = ACTION_LAYER_TAP_KEY(6, KC_SCLN), | 137 | [2] = ACTION_LAYER_TAP_KEY(6, KC_SCLN), |
| @@ -212,34 +143,3 @@ static const uint16_t PROGMEM fn_actions[] = { | |||
| 212 | [8] = ACTION_DEFAULT_LAYER_SET(3), // set workman layout | 143 | [8] = ACTION_DEFAULT_LAYER_SET(3), // set workman layout |
| 213 | [9] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_GRV), | 144 | [9] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_GRV), |
| 214 | }; | 145 | }; |
| 215 | #endif | ||
| 216 | |||
| 217 | |||
| 218 | |||
| 219 | #define KEYMAPS_SIZE (sizeof(keymaps) / sizeof(keymaps[0])) | ||
| 220 | #define FN_ACTIONS_SIZE (sizeof(fn_actions) / sizeof(fn_actions[0])) | ||
| 221 | |||
| 222 | /* translates key to keycode */ | ||
| 223 | uint8_t keymap_key_to_keycode(uint8_t layer, key_t key) | ||
| 224 | { | ||
| 225 | if (layer < KEYMAPS_SIZE) { | ||
| 226 | return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]); | ||
| 227 | } else { | ||
| 228 | // XXX: this may cuaes bootlaoder_jump inconsistent fail. | ||
| 229 | //debug("key_to_keycode: base "); debug_dec(layer); debug(" is invalid.\n"); | ||
| 230 | // fall back to layer 0 | ||
| 231 | return pgm_read_byte(&keymaps[0][(key.row)][(key.col)]); | ||
| 232 | } | ||
| 233 | } | ||
| 234 | |||
| 235 | /* translates Fn keycode to action */ | ||
| 236 | action_t keymap_fn_to_action(uint8_t keycode) | ||
| 237 | { | ||
| 238 | action_t action; | ||
| 239 | if (FN_INDEX(keycode) < FN_ACTIONS_SIZE) { | ||
| 240 | action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]); | ||
| 241 | } else { | ||
| 242 | action.code = ACTION_NO; | ||
| 243 | } | ||
| 244 | return action; | ||
| 245 | } | ||
diff --git a/keyboard/gh60/keymap_plain.h b/keyboard/gh60/keymap_plain.c index 52d11256c..3138c1807 100644 --- a/keyboard/gh60/keymap_plain.h +++ b/keyboard/gh60/keymap_plain.c | |||
| @@ -1,4 +1,6 @@ | |||
| 1 | static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 1 | #include "keymap_common.h" |
| 2 | |||
| 3 | const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 2 | /* 0: qwerty */ | 4 | /* 0: qwerty */ |
| 3 | KEYMAP(ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \ | 5 | KEYMAP(ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \ |
| 4 | TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \ | 6 | TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \ |
| @@ -6,4 +8,4 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 6 | LSFT,NO, Z, X, C, V, B, N, M, COMM,DOT, SLSH,NO, RSFT, \ | 8 | LSFT,NO, Z, X, C, V, B, N, M, COMM,DOT, SLSH,NO, RSFT, \ |
| 7 | LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL), | 9 | LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL), |
| 8 | }; | 10 | }; |
| 9 | static const uint16_t PROGMEM fn_actions[] = {}; | 11 | const uint16_t PROGMEM fn_actions[] = {}; |
diff --git a/keyboard/gh60/keymap_poker.h b/keyboard/gh60/keymap_poker.c index 164299949..7a612ee44 100644 --- a/keyboard/gh60/keymap_poker.h +++ b/keyboard/gh60/keymap_poker.c | |||
| @@ -1,4 +1,6 @@ | |||
| 1 | static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 1 | #include "keymap_common.h" |
| 2 | |||
| 3 | const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 2 | /* 0: qwerty */ | 4 | /* 0: qwerty */ |
| 3 | KEYMAP_ANSI( | 5 | KEYMAP_ANSI( |
| 4 | GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \ | 6 | GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \ |
| @@ -88,7 +90,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 88 | TRNS,TRNS,TRNS,FN6, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \ | 90 | TRNS,TRNS,TRNS,FN6, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \ |
| 89 | TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS), | 91 | TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS), |
| 90 | }; | 92 | }; |
| 91 | static const uint16_t PROGMEM fn_actions[] = { | 93 | const uint16_t PROGMEM fn_actions[] = { |
| 92 | /* Poker Layout */ | 94 | /* Poker Layout */ |
| 93 | [0] = ACTION_LAYER_MOMENTARY(6), // to Fn overlay | 95 | [0] = ACTION_LAYER_MOMENTARY(6), // to Fn overlay |
| 94 | [1] = ACTION_LAYER_TOGGLE(4), // toggle arrow overlay | 96 | [1] = ACTION_LAYER_TOGGLE(4), // toggle arrow overlay |
diff --git a/keyboard/gh60/keymap_poker_bit.h b/keyboard/gh60/keymap_poker_bit.c index 1b498351d..b8870fdd8 100644 --- a/keyboard/gh60/keymap_poker_bit.h +++ b/keyboard/gh60/keymap_poker_bit.c | |||
| @@ -1,7 +1,9 @@ | |||
| 1 | #include "keymap_common.h" | ||
| 2 | |||
| 1 | // Poker fix with toggle and bit operation | 3 | // Poker fix with toggle and bit operation |
| 2 | // Fn + Esc = ` | 4 | // Fn + Esc = ` |
| 3 | // Fn + {left, down, up, right} = {home, pgdown, pgup, end} | 5 | // Fn + {left, down, up, right} = {home, pgdown, pgup, end} |
| 4 | static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 6 | const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
| 5 | /* 0: qwerty */ | 7 | /* 0: qwerty */ |
| 6 | KEYMAP_ANSI( | 8 | KEYMAP_ANSI( |
| 7 | GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \ | 9 | GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \ |
| @@ -38,7 +40,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 38 | TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, UP, \ | 40 | TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, UP, \ |
| 39 | TRNS,TRNS,TRNS, TRNS, TRNS,LEFT,DOWN,RGHT), | 41 | TRNS,TRNS,TRNS, TRNS, TRNS,LEFT,DOWN,RGHT), |
| 40 | }; | 42 | }; |
| 41 | static const uint16_t PROGMEM fn_actions[] = { | 43 | const uint16_t PROGMEM fn_actions[] = { |
| 42 | /* Poker Layout */ | 44 | /* Poker Layout */ |
| 43 | [0] = ACTION_LAYER_BIT_XOR(1, 0b0101, ON_BOTH), // Poker Fn(with fix for Esc) | 45 | [0] = ACTION_LAYER_BIT_XOR(1, 0b0101, ON_BOTH), // Poker Fn(with fix for Esc) |
| 44 | [1] = ACTION_LAYER_TOGGLE(5), // Poker Arrow toggle | 46 | [1] = ACTION_LAYER_TOGGLE(5), // Poker Arrow toggle |
diff --git a/keyboard/gh60/keymap_poker_set.h b/keyboard/gh60/keymap_poker_set.c index e1e4d80ee..aaa31fc57 100644 --- a/keyboard/gh60/keymap_poker_set.h +++ b/keyboard/gh60/keymap_poker_set.c | |||
| @@ -1,7 +1,9 @@ | |||
| 1 | #include "keymap_common.h" | ||
| 2 | |||
| 1 | // Poker fix with set(state transition) | 3 | // Poker fix with set(state transition) |
| 2 | // Fn + Esc = ` | 4 | // Fn + Esc = ` |
| 3 | // Fn + {left, down, up, right} = {home, pgdown, pgup, end} | 5 | // Fn + {left, down, up, right} = {home, pgdown, pgup, end} |
| 4 | static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 6 | const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
| 5 | /* 0: qwerty */ | 7 | /* 0: qwerty */ |
| 6 | KEYMAP_ANSI( | 8 | KEYMAP_ANSI( |
| 7 | GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \ | 9 | GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \ |
| @@ -63,7 +65,7 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 63 | /* | 65 | /* |
| 64 | * Fn action definition | 66 | * Fn action definition |
| 65 | */ | 67 | */ |
| 66 | static const uint16_t PROGMEM fn_actions[] = { | 68 | const uint16_t PROGMEM fn_actions[] = { |
| 67 | /* Poker Layout */ | 69 | /* Poker Layout */ |
| 68 | [0] = ACTION_LAYER_SET(4, ON_PRESS), // FN0 move to Fn'd when press | 70 | [0] = ACTION_LAYER_SET(4, ON_PRESS), // FN0 move to Fn'd when press |
| 69 | [1] = ACTION_LAYER_SET(5, ON_PRESS), // FN1 move to Fn'd arrow when press | 71 | [1] = ACTION_LAYER_SET(5, ON_PRESS), // FN1 move to Fn'd arrow when press |
