summaryrefslogtreecommitdiffstats
path: root/keyboards
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards')
-rw-r--r--keyboards/hhkb/ansi/keymaps/shela/action_pseudo.c (renamed from keyboards/hhkb/ansi/keymaps/shela/action_pseudo_lut.c)84
-rw-r--r--keyboards/hhkb/ansi/keymaps/shela/action_pseudo.h27
-rw-r--r--keyboards/hhkb/ansi/keymaps/shela/action_pseudo_lut.h15
-rw-r--r--keyboards/hhkb/ansi/keymaps/shela/config.h38
-rw-r--r--keyboards/hhkb/ansi/keymaps/shela/keymap.c483
-rw-r--r--keyboards/hhkb/ansi/keymaps/shela/keymap_jis2us.h71
-rw-r--r--keyboards/hhkb/ansi/keymaps/shela/readme.md76
-rw-r--r--keyboards/hhkb/ansi/keymaps/shela/rules.mk4
8 files changed, 581 insertions, 217 deletions
diff --git a/keyboards/hhkb/ansi/keymaps/shela/action_pseudo_lut.c b/keyboards/hhkb/ansi/keymaps/shela/action_pseudo.c
index a15f5e5e0b..2ba8b3e503 100644
--- a/keyboards/hhkb/ansi/keymaps/shela/action_pseudo_lut.c
+++ b/keyboards/hhkb/ansi/keymaps/shela/action_pseudo.c
@@ -1,27 +1,42 @@
+/* Copyright 2020 shela
+ *
+ * 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
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
#include "quantum.h"
#include "command.h"
-#include "action_pseudo_lut.h"
+#include "action_pseudo.h"
static uint8_t send_key_shift_bit[SHIFT_BIT_SIZE];
/*
- * Pseudo layout action.
- * This action converts a keycode in order to output the character according to the keymap you specified
- * still your keyboard layout recognized wrongly on your OS.
- * Memo: Using other layer keymap to get keycode
+ * Action Pseudo Process.
+ * Gets the keycode in the same position of the specified layer.
+ * The keycode is sent after conversion according to the conversion keymap.
*/
-void action_pseudo_lut(keyrecord_t *record, uint8_t base_keymap_id, const uint16_t (*keymap)[2]) {
- uint8_t prev_shift;
+void action_pseudo_process(keyrecord_t *record, uint8_t base_layer, const uint16_t (*keymap)[2]) {
+ uint8_t prev_shift;
uint16_t keycode;
uint16_t pseudo_keycode;
- /* get keycode from keymap you specified */
- keycode = keymap_key_to_keycode(base_keymap_id, record->event.key);
+ /* Get keycode from specified layer */
+ keycode = keymap_key_to_keycode(base_layer, record->event.key);
- prev_shift = keyboard_report->mods & (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT));
+ prev_shift = get_mods() & MOD_MASK_SHIFT;
if (record->event.pressed) {
- /* when magic commands entered, keycode does not converted */
+ /* If magic commands entered, keycode is not converted */
if (IS_COMMAND()) {
if (prev_shift) {
add_shift_bit(keycode);
@@ -38,25 +53,21 @@ void action_pseudo_lut(keyrecord_t *record, uint8_t base_keymap_id, const uint16
if (IS_LSFT(pseudo_keycode)) {
register_code(QK_LSFT ^ pseudo_keycode);
} else {
- /* delete shift mod temporarily */
- del_mods(prev_shift);
- send_keyboard_report();
+ /* Delete shift mod temporarily */
+ unregister_mods(prev_shift);
register_code(pseudo_keycode);
- add_mods(prev_shift);
- send_keyboard_report();
+ register_mods(prev_shift);
}
} else {
pseudo_keycode = convert_keycode(keymap, keycode, false);
dprintf("pressed: %02X, converted: %04X\n", keycode, pseudo_keycode);
if (IS_LSFT(pseudo_keycode)) {
- add_weak_mods(MOD_BIT(KC_LSFT));
- send_keyboard_report();
+ register_weak_mods(MOD_LSFT);
register_code(QK_LSFT ^ pseudo_keycode);
- /* on Windows, prevent key repeat to avoid unintended output */
+ /* Prevent key repeat to avoid unintended output on Windows */
unregister_code(QK_LSFT ^ pseudo_keycode);
- del_weak_mods(MOD_BIT(KC_LSFT));
- send_keyboard_report();
+ unregister_weak_mods(MOD_LSFT);
} else {
register_code(pseudo_keycode);
}
@@ -78,9 +89,9 @@ void action_pseudo_lut(keyrecord_t *record, uint8_t base_keymap_id, const uint16
}
}
-uint16_t convert_keycode(const uint16_t (*keymap)[2], uint16_t keycode, bool shift_modded)
-{
- uint16_t pseudo_keycode;
+/* Convert keycode according to the keymap */
+uint16_t convert_keycode(const uint16_t (*keymap)[2], uint16_t keycode, bool shift_modded) {
+ uint16_t pseudo_keycode = 0x00; /* default value */
switch (keycode) {
case KC_A ... KC_CAPSLOCK:
@@ -97,23 +108,18 @@ uint16_t convert_keycode(const uint16_t (*keymap)[2], uint16_t keycode, bool shi
pseudo_keycode = keymap[keycode][0];
}
#endif
- /* if undefined, use got keycode as it is */
- if (pseudo_keycode == 0x00) {
- if (shift_modded) {
- pseudo_keycode = S(keycode);
- } else {
- pseudo_keycode = keycode;
- }
- }
- break;
- default:
- if (shift_modded) {
- pseudo_keycode = S(keycode);
- } else {
- pseudo_keycode = keycode;
- }
break;
}
+
+ /* If pseudo keycode is the default value, use the keycode as it is */
+ if (pseudo_keycode == 0x00) {
+ if (shift_modded) {
+ pseudo_keycode = S(keycode);
+ } else {
+ pseudo_keycode = keycode;
+ }
+ }
+
return pseudo_keycode;
}
diff --git a/keyboards/hhkb/ansi/keymaps/shela/action_pseudo.h b/keyboards/hhkb/ansi/keymaps/shela/action_pseudo.h
new file mode 100644
index 0000000000..7c3d38fa07
--- /dev/null
+++ b/keyboards/hhkb/ansi/keymaps/shela/action_pseudo.h
@@ -0,0 +1,27 @@
+/* Copyright 2020 shela
+ *
+ * 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
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#define SHIFT_BIT_SIZE (0xE7 / 8 + 1) /* 1bit per 1key */
+#define IS_LSFT(kc) ((QK_LSFT & (kc)) == QK_LSFT)
+
+void action_pseudo_process(keyrecord_t *, uint8_t, const uint16_t (*)[2]);
+uint16_t convert_keycode(const uint16_t (*)[2], uint16_t, bool);
+
+uint8_t get_shift_bit(uint16_t);
+void add_shift_bit(uint16_t);
+void del_shift_bit(uint16_t);
diff --git a/keyboards/hhkb/ansi/keymaps/shela/action_pseudo_lut.h b/keyboards/hhkb/ansi/keymaps/shela/action_pseudo_lut.h
deleted file mode 100644
index 681252440f..0000000000
--- a/keyboards/hhkb/ansi/keymaps/shela/action_pseudo_lut.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef ACTION_PSEUDO_LUT_H
-#define ACTION_PSEUDO_LUT_H
-
-#define SHIFT_BIT_SIZE (0xE7 / 8 + 1) // 1bit per 1key
-
-#define IS_LSFT(kc) ((QK_LSFT & (kc)) == QK_LSFT)
-
-void action_pseudo_lut(keyrecord_t *, uint8_t, const uint16_t (*)[2]);
-uint16_t convert_keycode(const uint16_t (*)[2], uint16_t, bool);
-
-uint8_t get_shift_bit(uint16_t);
-void add_shift_bit(uint16_t);
-void del_shift_bit(uint16_t);
-
-#endif
diff --git a/keyboards/hhkb/ansi/keymaps/shela/config.h b/keyboards/hhkb/ansi/keymaps/shela/config.h
index 08cc1fb46e..25794900c3 100644
--- a/keyboards/hhkb/ansi/keymaps/shela/config.h
+++ b/keyboards/hhkb/ansi/keymaps/shela/config.h
@@ -1,12 +1,38 @@
-#ifndef CONFIG_SHELA_H
-#define CONFIG_SHELA_H
+/* Copyright 2020 shela
+ *
+ * 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
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
#include "../../config.h"
+/* USB Device descriptor parameter */
+#undef VENDOR_ID
+#define VENDOR_ID 0x0853
+#undef PRODUCT_ID
+#define PRODUCT_ID 0x0100
+#undef DEVICE_VER
+#define DEVICE_VER 0x0102
+#undef MANUFACTURER
+#define MANUFACTURER Topre Corporation
+#undef PRODUCT
+#define PRODUCT HHKB Professional
+
#undef TAPPING_TERM
-#define TAPPING_TERM 230
+#define TAPPING_TERM 210
+#define SPFN_TAPPING_TERM 190 /* SpaceFN tapping term */
-#define ONESHOT_TAP_TOGGLE 2
+#define ONESHOT_TAP_TOGGLE 3
#define ONESHOT_TIMEOUT 2000
-
-#endif
diff --git a/keyboards/hhkb/ansi/keymaps/shela/keymap.c b/keyboards/hhkb/ansi/keymaps/shela/keymap.c
index 3971e8f945..f63b99a4ff 100644
--- a/keyboards/hhkb/ansi/keymaps/shela/keymap.c
+++ b/keyboards/hhkb/ansi/keymaps/shela/keymap.c
@@ -1,186 +1,433 @@
-/*
- * HHKB Pro 2 US Layout for shela
+/* Copyright 2020 shela
+ *
+ * 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
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include QMK_KEYBOARD_H
#include "keymap_jis2us.h"
-#include "action_pseudo_lut.h"
+#include "action_pseudo.h"
+
+// clang-format off
+enum keyboard_layers {
+ _QWERTY = 0,
+ _DVORAK,
+ _COLEMAK,
+ _PSEUDO,
+ _TENKEY,
+ _MOUSE,
+ _HHKB,
+ _SPACE_FN
+};
-enum keymap_layout
-{
- BASE = 0,
- PSEUDO_US,
+enum custom_keycodes {
+ QWERTY = SAFE_RANGE,
DVORAK,
- MOUSE,
+ COLEMAK,
+ PSEUDO,
TENKEY,
- HHKB,
- SPACE_FN,
+ MOUSE,
+ L_INNER,
+ R_INNER,
+ L_OUTER,
+ R_OUTER,
+ PSE_FN,
+ MACMODE,
+ DYNAMIC_MACRO_RANGE
};
+// clang-format on
-const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+/* Additional custom keycodes */
+#define MO_HHKB MO(_HHKB)
+#define LT_SPFN LT(_SPACE_FN, KC_SPC)
+#define DM_STA1 DYN_REC_START1
+#define DM_PLY1 DYN_MACRO_PLAY1
+
+/* User settings structure for the EEPROM */
+typedef union {
+ uint32_t raw;
+ struct {
+ uint8_t base_layer : 8;
+ bool mac_mode : 1;
+ };
+} user_config_t;
+
+user_config_t user_config;
+static uint8_t base_layer = _QWERTY;
+static bool mac_mode = false;
+static bool l_long_pressed = false;
+static bool l_pressed = false;
+static uint16_t l_time = 0;
+static bool r_long_pressed = false;
+static bool r_pressed = false;
+static uint16_t r_time = 0;
- /* Layer 0: Default Layer
+static uint16_t l_inner = KC_NO;
+static uint16_t l_outer = KC_NO;
+static uint16_t r_inner = KC_NO;
+static uint16_t r_outer = KC_NO;
+
+// clang-format off
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ /* Qwerty Layer
* ,-----------------------------------------------------------------------------------------.
- * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | ` | BSp |
+ * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | ` | BS |
* |-----------------------------------------------------------------------------------------|
* | Tab | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ |
* |-----------------------------------------------------------------------------------------|
- * | Control | A | S | D | F | G | H | J | K | L | ; | ' | Enter |
+ * | LControl | A | S | D | F | G | H | J | K | L | ; | ' | Enter |
* |-----------------------------------------------------------------------------------------|
- * | Shift | Z | X | C | V | B | N | M | , | . | / | Shift | Fn0 |
+ * | LShift | Z | X | C | V | B | N | M | , | . | / | RShift |HHKB |
* `-----------------------------------------------------------------------------------------'
- * |LAlt | LGui | SpaceFN | RGui |RAlt |
+ * |LOutr| LInner | SpaceFN | RInner |ROutr|
* `-----------------------------------------------------------------'
*/
- [BASE] =
- LAYOUT(KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_GRV, KC_BSPC,
- KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS,
- KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
- OSM(MOD_LSFT), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(HHKB),
- KC_LALT, KC_LGUI, LT(SPACE_FN, KC_SPACE), KC_RGUI, KC_RALT),
-
- /* Layer 1: Pseudo US Layout Layer
+ [_QWERTY] = LAYOUT(
+ KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_GRV, KC_BSPC,
+ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS,
+ KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
+ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO_HHKB,
+ L_OUTER, L_INNER, LT_SPFN, R_INNER, R_OUTER
+ ),
+
+ /* Dvorak Layer
* ,-----------------------------------------------------------------------------------------.
- * | Esc | Fn1 | Fn1 | Fn1 | Fn1 | Fn1 | Fn1 | Fn1 | Fn1 | Fn1 | Fn1 | Fn1 | Fn1 | Fn1 | BSp |
+ * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | [ | ] | ` | BS |
* |-----------------------------------------------------------------------------------------|
- * | Tab | Fn1 | Fn1 | Fn1 | Fn1 | Fn1 | Fn1 | Fn1 | Fn1 | Fn1 | Fn1 | Fn1 | Fn1 | Fn1 |
+ * | Tab | ' | , | . | P | Y | F | G | C | R | L | / | = | \ |
* |-----------------------------------------------------------------------------------------|
- * | Control | Fn1 | Fn1 | Fn1 | Fn1 | Fn1 | Fn1 | Fn1 | Fn1 | Fn1 | Fn1 | Fn1 | Enter |
+ * | LControl | A | O | E | U | I | D | H | T | N | S | - | Enter |
* |-----------------------------------------------------------------------------------------|
- * | Shift | Fn1 | Fn1 | Fn1 | Fn1 | Fn1 | Fn1 | Fn1 | Fn1 | Fn1 | Fn1 | Shift | Fn0 |
+ * | LShift | ; | Q | J | K | X | B | M | W | V | Z | RShift |HHKB |
* `-----------------------------------------------------------------------------------------'
- * |LGui | Fn3 | SpaceFN | Fn4 |RGui |
+ * |LOutr| LInner | SpaceFN | RInner |ROutr|
* `-----------------------------------------------------------------'
*/
- [PSEUDO_US] =
- LAYOUT(KC_ESC, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_BSPC,
- KC_TAB, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1,
- KC_LCTL, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_ENT,
- KC_LSFT, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_FN1, KC_RSFT, MO(HHKB),
- KC_LGUI, MT(MOD_LALT, KC_MHEN), LT(SPACE_FN, KC_SPACE), MT(MOD_RALT, KC_KANA), KC_RGUI),
-
- /* Layer 2: Dvorak Layer
+ [_DVORAK] = LAYOUT(
+ KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_LBRC, KC_RBRC, KC_GRV, KC_BSPC,
+ KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH, KC_EQL, KC_BSLS,
+ KC_LCTL, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, KC_ENT,
+ KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT, MO_HHKB,
+ L_OUTER, L_INNER, LT_SPFN, R_INNER, R_OUTER
+ ),
+
+ /* Colemak Layer
* ,-----------------------------------------------------------------------------------------.
- * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | [ | ] | ` | BSp |
+ * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | ` | BS |
* |-----------------------------------------------------------------------------------------|
- * | Tab | ' | , | . | P | Y | F | G | C | R | L | / | = | \ |
+ * | Tab | Q | W | F | P | G | J | L | U | Y | ; | [ | ] | \ |
* |-----------------------------------------------------------------------------------------|
- * | Control | A | O | E | U | I | D | H | T | N | S | - | Enter |
+ * | LControl | A | R | S | T | D | H | N | E | I | O | ' | Enter |
* |-----------------------------------------------------------------------------------------|
- * | Shift | ; | Q | J | K | X | B | M | W | V | Z | Shift | Fn0 |
+ * | LShift | Z | X | C | V | B | K | M | , | . | / | RShift |HHKB |
* `-----------------------------------------------------------------------------------------'
- * |LAlt | LGui | SpaceFN | RGui |RAlt |
+ * |LOutr| LInner | SpaceFN | RInner |ROutr|
* `-----------------------------------------------------------------'
*/
- [DVORAK] =
- LAYOUT(KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_LBRC, KC_RBRC, KC_GRV, KC_BSPC,
- KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH, KC_EQL, KC_BSLS,
- KC_LCTL, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, KC_ENT,
- KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT, MO(HHKB),
- KC_LALT, KC_LGUI, LT(SPACE_FN, KC_SPACE), KC_RGUI, KC_RALT),
-
- /* Layer 3: Mouse layer
+ [_COLEMAK] = LAYOUT(
+ KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_GRV, KC_BSPC,
+ KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_LBRC, KC_RBRC, KC_BSLS,
+ KC_LCTL, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, KC_ENT,
+ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO_HHKB,
+ L_OUTER, L_INNER, LT_SPFN, R_INNER, R_OUTER
+ ),
+
+ /* Pseudo Layer
* ,-----------------------------------------------------------------------------------------.
- * | Esc | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | | |
+ * | Esc |PseFn|PseFn|PseFn|PseFn|PseFn|PseFn|PseFn|PseFn|PseFn|PseFn|PseFn|PseFn|PseFn| BS |
* |-----------------------------------------------------------------------------------------|
- * | | | | | | | MwL | MwD | MwU | MwR | | | | |
+ * | Tab |PseFn|PseFn|PseFn|PseFn|PseFn|PseFn|PseFn|PseFn|PseFn|PseFn|PseFn|PseFn| PseFn |
* |-----------------------------------------------------------------------------------------|
- * | | | | | | | McL | McD | McU | McR | | | |
+ * | Control |PseFn|PseFn|PseFn|PseFn|PseFn|PseFn|PseFn|PseFn|PseFn|PseFn|PseFn| Enter |
* |-----------------------------------------------------------------------------------------|
- * | | | | | | | Mb1 | Mb2 | Mb3 | | | | Fn0 |
+ * | Shift |PseFn|PseFn|PseFn|PseFn|PseFn|PseFn|PseFn|PseFn|PseFn|PseFn| Shift |HHKB |
* `-----------------------------------------------------------------------------------------'
- * | | | Mb1 | | |
+ * |LOutr| LInner | SpaceFN | RInner |ROutr|
* `-----------------------------------------------------------------'
*/
- [MOUSE] =
- LAYOUT(KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NO, KC_TRNS,
- KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_WH_L, KC_WH_D, KC_WH_U, KC_WH_R, KC_NO, KC_NO, KC_NO, KC_NO,
- KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, KC_NO, KC_NO, KC_TRNS,
- KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_BTN1, KC_BTN2, KC_BTN3, KC_NO, KC_NO, KC_TRNS, MO(HHKB),
- KC_TRNS, KC_TRNS, KC_BTN1, KC_TRNS, KC_TRNS),
-
- /* Layer 4: Tenkey layer
+ [_PSEUDO] = LAYOUT(
+ KC_ESC, PSE_FN, PSE_FN, PSE_FN, PSE_FN, PSE_FN, PSE_FN, PSE_FN, PSE_FN, PSE_FN, PSE_FN, PSE_FN, PSE_FN, PSE_FN, KC_BSPC,
+ KC_TAB, PSE_FN, PSE_FN, PSE_FN, PSE_FN, PSE_FN, PSE_FN, PSE_FN, PSE_FN, PSE_FN, PSE_FN, PSE_FN, PSE_FN, PSE_FN,
+ KC_LCTL, PSE_FN, PSE_FN, PSE_FN, PSE_FN, PSE_FN, PSE_FN, PSE_FN, PSE_FN, PSE_FN, PSE_FN, PSE_FN, KC_ENT,
+ KC_LSFT, PSE_FN, PSE_FN, PSE_FN, PSE_FN, PSE_FN, PSE_FN, PSE_FN, PSE_FN, PSE_FN, PSE_FN, KC_RSFT, MO_HHKB,
+ L_OUTER, L_INNER, LT_SPFN, R_INNER, R_OUTER
+ ),
+
+ /* Tenkey layer
* ,-----------------------------------------------------------------------------------------.
- * | Esc | | | | | | | | | | / | * | - | | BSp |
+ * | Esc | | | | | | | | | | / | * | - | | BS |
* |-----------------------------------------------------------------------------------------|
- * | | | | | | | | | | 7 | 8 | 9 | + | |
+ * | Tab | | | | | | | | | 7 | 8 | 9 | + | |
* |-----------------------------------------------------------------------------------------|
- * | | | | | | | | | | 4 | 5 | 6 | Enter |
+ * | LControl | | | | | | | | | 4 | 5 | 6 | Enter |
* |-----------------------------------------------------------------------------------------|
- * | | | | | | | | | 1 | 2 | 3 | + | Fn0 |
+ * | LShift | | | | | | | | 1 | 2 | 3 | + |HHKB |
* `-----------------------------------------------------------------------------------------'
- * | | | SpaceFN | 0 | . |
+ * |LOutr| LInner | SpaceFN | 0 | . |
* `-----------------------------------------------------------------'
*/
- [TENKEY] =
- LAYOUT(KC_ESC, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_PSLS, KC_PAST, KC_PMNS, KC_NO, KC_BSPC,
- KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_KP_7, KC_KP_8, KC_KP_9, KC_PPLS, KC_NO,
- KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_KP_4, KC_KP_5, KC_KP_6, KC_PENT,
- KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_KP_1, KC_KP_2, KC_KP_3, KC_PPLS, MO(HHKB),
- KC_TRNS, KC_TRNS, LT(SPACE_FN, KC_SPACE), KC_KP_0, KC_PDOT),
-
- /* Layer 5: HHKB mode (HHKB Fn)
+ [_TENKEY] = LAYOUT(
+ KC_ESC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_PSLS, KC_PAST, KC_PMNS, XXXXXXX, KC_BSPC,
+ KC_TAB, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_P7, KC_P8, KC_P9, KC_PPLS, XXXXXXX,
+ KC_LCTL, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_P4, KC_P5, KC_P6, KC_PENT,
+ KC_LSFT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_P1, KC_P2, KC_P3, KC_PPLS, MO_HHKB,
+ L_OUTER, L_INNER, LT_SPFN, KC_P0, KC_PDOT
+ ),
+
+ /* Mouse layer
* ,-----------------------------------------------------------------------------------------.
- * | Pwr | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | Ins | Del |
+ * | Esc | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | | BS |
* |-----------------------------------------------------------------------------------------|
- * | Caps | Fn5 | Fn6 | Fn7 | Fn8 | Fn9 | | | Psc | Slk | Pus | Up | | BSp |
+ * | Tab | | | | | | WhL | WhD | WhU | WhR | | | | |
* |-----------------------------------------------------------------------------------------|
- * | | VoD | VoU | Mut | | | * | / | Hom | PgU | Lef | Rig | Enter |
+ * | LControl | | | | | | MsL | MsD | MsU | MsR | | | Enter |
* |-----------------------------------------------------------------------------------------|
- * | | | | | | | + | - | End | PgD | Dow | | |
+ * | LShift | | | | | | Mb1 | Mb2 | Mb3 | | | RShift |HHKB |
* `-----------------------------------------------------------------------------------------'
- * | | | | | |
+ * |LOutr| LInner | Mb1 | RInner |ROutr|
+ * `-----------------------------------------------------------------'
+ */
+ [_MOUSE] = LAYOUT(
+ KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, KC_BSPC,
+ KC_TAB, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_WH_L, KC_WH_D, KC_WH_U, KC_WH_R, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
+ KC_LCTL, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, XXXXXXX, XXXXXXX, KC_ENT,
+ KC_LSFT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_BTN1, KC_BTN2, KC_BTN3, XXXXXXX, XXXXXXX, KC_RSFT, MO_HHKB,
+ L_OUTER, L_INNER, KC_BTN1, R_INNER, R_OUTER
+ ),
+
+ /* HHKB Layer
+ * ,-----------------------------------------------------------------------------------------.
+ * |Power| F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | Ins | Del |
+ * |-----------------------------------------------------------------------------------------|
+ * | Caps |Qwert|Dvork|Colmk|Psedo|Tenky|Mouse| |PScr |SLck |Paus | Up | | Clear |
+ * |-----------------------------------------------------------------------------------------|
+ * | |VolD |VolU |Mute |Ejct | | * | / |Home |PgUp |Left |Rght | Enter |
+ * |-----------------------------------------------------------------------------------------|
+ * | |Sta1 |Ply1 | | Mac | | + | - | End |PgDn |Down | | |
+ * `-----------------------------------------------------------------------------------------'
+ * | | | Space | | |
* `-----------------------------------------------------------------'
*/
- [HHKB] =
- LAYOUT(KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL,
- KC_CAPS, DF(BASE), DF(PSEUDO_US), DF(MOUSE), DF(TENKEY), DF(DVORAK), KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, KC_TRNS, KC_BSPC,
- KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_TRNS, KC_TRNS, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_PENT,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
-
- /* Layer 6: SpaceFN
+ [_HHKB] = LAYOUT(
+ KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL,
+ KC_CAPS, QWERTY, DVORAK, COLEMAK, PSEUDO, TENKEY, MOUSE, XXXXXXX, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, XXXXXXX, KC_NLCK,
+ _______, KC_VOLD, KC_VOLU, KC_MUTE, KC_EJCT, XXXXXXX, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT, KC_PENT,
+ _______, DM_STA1, DM_PLY1, XXXXXXX, MACMODE, XXXXXXX, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, _______, _______,
+ _______, _______, KC_SPC, _______, _______
+ ),
+
+ /* SpaceFN Layer
* ,-----------------------------------------------------------------------------------------.
* | | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | | Del |
* |-----------------------------------------------------------------------------------------|
- * | | Hom | Up | End | | | | Hom | End | | Psc | Slk | Pau | Ins |
+ * | |Home | Up | End | | | |Home | End | |PScr |SLck |Paus | Ins |
* |-----------------------------------------------------------------------------------------|
- * | | Lef | Dow | Rig | PgU | | Lef | Dow | Up | Rig | | | |
+ * | |Left |Down |Rght |PgUp | |Left |Down | Up |Rght | | | |
* |-----------------------------------------------------------------------------------------|
- * | | | | PgD | | Spc | | PgD | PgU | | | | |
+ * | | | |PgDn | | Spc | |PgDn |PgUp | | | | |
* `-----------------------------------------------------------------------------------------'
* | | | | | |
* `-----------------------------------------------------------------'
*/
- [SPACE_FN] =
- LAYOUT(KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NO, KC_DEL,
- KC_TRNS, KC_HOME, KC_UP, KC_END, KC_NO, KC_NO, KC_NO, KC_HOME, KC_END, KC_NO, KC_PSCR, KC_SLCK, KC_PAUS, KC_INS,
- KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGUP, KC_NO, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_NO, KC_NO, KC_TRNS,
- KC_TRNS, KC_NO, KC_NO, KC_PGDN, KC_NO, KC_SPC, KC_NO, KC_PGDN, KC_PGUP, KC_NO, KC_NO, KC_TRNS, KC_NO,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
+ [_SPACE_FN] = LAYOUT(
+ _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, KC_DEL,
+ _______, KC_HOME, KC_UP, KC_END, XXXXXXX, XXXXXXX, XXXXXXX, KC_HOME, KC_END, XXXXXXX, KC_PSCR, KC_SLCK, KC_PAUS, KC_INS,
+ _______, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGUP, XXXXXXX, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, XXXXXXX, XXXXXXX, _______,
+ _______, XXXXXXX, XXXXXXX, KC_PGDN, XXXXXXX, KC_SPC, XXXXXXX, KC_PGDN, KC_PGUP, XXXXXXX, XXXXXXX, _______, XXXXXXX,
+ _______, _______, _______, _______, _______
+ ),
};
+// clang-format on
-/*
- * user defined action function
- */
-enum function_id
-{
- PSEUDO_US_FUNCTION,
-};
+void set_mac_mode_keys(bool mac_mode) {
+ if (mac_mode) {
+ l_inner = KC_LCMD;
+ l_outer = KC_LOPT;
+ r_inner = KC_RCMD;
+ r_outer = KC_ROPT;
+ } else {
+ l_inner = KC_LALT;
+ l_outer = KC_LGUI;
+ r_inner = KC_RALT;
+ r_outer = KC_RGUI;
+ }
+}
+
+void keyboard_post_init_user(void) {
+ user_config.raw = eeconfig_read_user();
+ mac_mode = user_config.mac_mode;
+ base_layer = user_config.base_layer;
+ set_mac_mode_keys(mac_mode);
+}
+
+/* Set default values for the EEPROM */
+void eeconfig_init_user(void) {
+ user_config.raw = 0;
+ user_config.base_layer = _QWERTY;
+ user_config.mac_mode = false;
+ eeconfig_update_user(user_config.raw);
+ base_layer = _QWERTY;
+ mac_mode = false;
+ set_mac_mode_keys(mac_mode);
+}
-void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
-{
+void persistent_default_layer_set(uint8_t layer) {
+ set_single_persistent_default_layer(layer);
+ user_config.base_layer = layer;
+ eeconfig_update_user(user_config.raw);
+ base_layer = layer;
+}
- switch (id)
- {
- case PSEUDO_US_FUNCTION:
- action_pseudo_lut(record, BASE, keymap_jis2us);
- break;
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ switch (keycode) {
+ case QWERTY:
+ if (record->event.pressed) {
+ persistent_default_layer_set(_QWERTY);
+ }
+ return false;
+ case DVORAK:
+ if (record->event.pressed) {
+ persistent_default_layer_set(_DVORAK);
+ }
+ return false;
+ case COLEMAK:
+ if (record->event.pressed) {
+ persistent_default_layer_set(_COLEMAK);
+ }
+ return false;
+ case PSEUDO:
+ if (record->event.pressed) {
+ if (l_pressed && !l_long_pressed) {
+ register_code(l_inner);
+ l_long_pressed = true;
+ }
+ if (r_pressed && !r_long_pressed) {
+ register_code(r_inner);
+ r_long_pressed = true;
+ }
+ set_single_persistent_default_layer(_PSEUDO);
+ }
+ return false;
+ case TENKEY:
+ if (record->event.pressed) {
+ default_layer_set(1U << _TENKEY);
+ }
+ return false;
+ case MOUSE:
+ if (record->event.pressed) {
+ default_layer_set(1U << _MOUSE);
+ }
+ return false;
+ case L_INNER:
+ if (record->event.pressed) {
+ l_pressed = true;
+ l_time = record->event.time;
+ } else {
+ if (l_pressed) {
+ if (l_long_pressed) {
+ unregister_code(l_inner);
+ l_long_pressed = false;
+ } else {
+ if (TIMER_DIFF_16(record->event.time, l_time) < TAPPING_TERM) {
+ if (mac_mode) {
+ register_code(KC_LANG2);
+ unregister_code(KC_LANG2);
+ } else {
+ register_code(KC_MHEN);
+ unregister_code(KC_MHEN);
+ }
+ } else {
+ register_code(l_inner);
+ unregister_code(l_inner);
+ }
+ }
+ l_pressed = false;
+ }
+ }
+ return false;
+ case R_INNER:
+ if (record->event.pressed) {
+ r_pressed = true;
+ r_time = record->event.time;
+ } else {
+ if (r_pressed) {
+ if (r_long_pressed) {
+ unregister_code(r_inner);
+ r_long_pressed = false;
+ } else {
+ if (TIMER_DIFF_16(record->event.time, r_time) < TAPPING_TERM) {
+ if (mac_mode) {
+ register_code(KC_LANG1);
+ unregister_code(KC_LANG1);
+ } else {
+ register_code(KC_KANA);
+ unregister_code(KC_KANA);
+ }
+ } else {
+ register_code(r_inner);
+ unregister_code(r_inner);
+ }
+ }
+ r_pressed = false;
+ }
+ }
+ return false;
+ case L_OUTER:
+ if (record->event.pressed) {
+ register_code(l_outer);
+ } else {
+ unregister_code(l_outer);
+ }
+ return false;
+ case R_OUTER:
+ if (record->event.pressed) {
+ register_code(r_outer);
+ } else {
+ unregister_code(r_outer);
+ }
+ return false;
+ case MACMODE:
+ if (record->event.pressed) {
+ /* Toggle Mac mode value */
+ mac_mode = !mac_mode;
+ user_config.mac_mode = mac_mode;
+ eeconfig_update_user(user_config.raw);
+ set_mac_mode_keys(mac_mode);
+ }
+ return false;
+ case PSE_FN:
+