diff options
author | Vino Rodrigues <366673+vinorodrigues@users.noreply.github.com> | 2022-10-10 14:17:21 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-09 20:17:21 -0700 |
commit | 7aab5e4d896606a7731c8adfce41115611df75c2 (patch) | |
tree | b351bb99895c045a1e09123b637b594b66f46ee8 /keyboards/idobao/id61/keymaps | |
parent | a3d2c89c4cff53f2a72dc349227ad2075e61c363 (diff) |
[Keyboard] New IDOBAO ID61 (a.k.a. Denwir D60) (#17362)
* initial upload
* adjust keymap
* Delete config.h
* Update post.rules.mk
* remapped to correct pins
* add idobao keymap
* disable underglow
* minor fix
* right menu on windows
* imgur
* ID61_process_special_k() function
* KC_APP fix
* Update keymap.c
* pre-pr touchups
* enum layouts
* review changes recommended by tzarc
* refactor special keys to common lib
* rename layout and add info.json labels
* account for 15 possible USER keys
* post drashna review
* Fn Arrow keys added
* post review edits
* use bitmask instead of bool array in specialk.c
* move to community layout
Diffstat (limited to 'keyboards/idobao/id61/keymaps')
-rw-r--r-- | keyboards/idobao/id61/keymaps/default/keymap.c | 48 | ||||
-rw-r--r-- | keyboards/idobao/id61/keymaps/idobao/config.h | 7 | ||||
-rw-r--r-- | keyboards/idobao/id61/keymaps/idobao/keymap.c | 332 | ||||
-rw-r--r-- | keyboards/idobao/id61/keymaps/idobao/rules.mk | 7 | ||||
-rw-r--r-- | keyboards/idobao/id61/keymaps/idobao/specialk.c | 88 | ||||
-rw-r--r-- | keyboards/idobao/id61/keymaps/idobao/specialk.h | 12 | ||||
-rw-r--r-- | keyboards/idobao/id61/keymaps/via/keymap.c | 77 | ||||
-rw-r--r-- | keyboards/idobao/id61/keymaps/via/rules.mk | 3 |
8 files changed, 574 insertions, 0 deletions
diff --git a/keyboards/idobao/id61/keymaps/default/keymap.c b/keyboards/idobao/id61/keymaps/default/keymap.c new file mode 100644 index 0000000000..3d6fe4232f --- /dev/null +++ b/keyboards/idobao/id61/keymaps/default/keymap.c @@ -0,0 +1,48 @@ +// Copyright 2022 Vino Rodrigues (@vinorodrigues) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ + * │Esc│ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │Backspc│ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ + * │ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ \ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ + * │ Caps │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ Enter │ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ + * │ Shift │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ Shift │ + * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ + * │Ctrl│Win │Alt │ │ Fn │Alt │Menu│Ctrl│ + * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ + */ + [0] = LAYOUT_60_ansi( + KC_GESC, 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_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_CAPS, 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, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(1), KC_RALT, KC_APP, KC_RCTL + ), + + /* + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ + * │ ~ │F1 │F2 │F3 │F4 │F5 │F6 │F7 │F8 │F9 │F10│F11│F12│ │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ + * │ │ │ ↑ │ │ │Tog│Hu+│Sa+│Br+│Sp+│PSc│Hom│End│ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ + * │ │ ← │ ↓ │ → │ │Mod│Hu-│Sa-│Br-│Sp-│PUp│PDn│ │ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ + * │ │ │ │ │ │Rst│NKR│ │ │Ins│Del│ ↑ │ + * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ + * │ │ │ │ │ │ ← │ ↓ │ → │ + * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ + */ + [1] = LAYOUT_60_ansi( + KC_GRV, 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_UP, _______, _______, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, RGB_SPI, KC_PSCR, KC_HOME, KC_END, _______, + _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, RGB_SPD, KC_PGUP, KC_PGDN, _______, + _______, _______, _______, _______, _______, QK_BOOT, NK_TOGG, _______, _______, KC_INS, KC_DEL, KC_UP, + _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RGHT + ) +}; diff --git a/keyboards/idobao/id61/keymaps/idobao/config.h b/keyboards/idobao/id61/keymaps/idobao/config.h new file mode 100644 index 0000000000..81568ec7ae --- /dev/null +++ b/keyboards/idobao/id61/keymaps/idobao/config.h @@ -0,0 +1,7 @@ +// Copyright 2022 Vino Rodrigues (@vinorodrigues) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +/* Denwir D60 has solid back case - no underglow LED's are visible. */ +#define ID61_DISABLE_UNDERGLOW diff --git a/keyboards/idobao/id61/keymaps/idobao/keymap.c b/keyboards/idobao/id61/keymaps/idobao/keymap.c new file mode 100644 index 0000000000..8315d1498d --- /dev/null +++ b/keyboards/idobao/id61/keymaps/idobao/keymap.c @@ -0,0 +1,332 @@ +// Copyright 2022 Vino Rodrigues (@vinorodrigues) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H +#include "specialk.h" +#include "version.h" + +typedef union { + uint32_t raw; + struct { + bool in_arrow_mode:1; + #ifdef RGB_MATRIX_ENABLE + bool rgb_disable_perkey:1; + #ifndef ID61_DISABLE_UNDERGLOW + bool rgb_disable_underglow:1; + #endif // ID61_DISABLE_UNDERGLOW + #endif // RGB_MATRIX_ENABLE + }; +} user_config_t; + +enum { + _BASE = 0, + _FN1, + _FN2, + _FN3 +}; + +enum { + KC_MCON = USER00, // macOS Open Mission Control + KC_LPAD, // macOS Open Launchpad + KB_ARRW, // toggle right modifiers are arrows feature + KB_RSFT, // right shift or up arrow + KB_RALT, // right alt or left arrow + KB_RAPP, // menu or down arrow (Windows Menu) + KB_RCOM, // right gui or left arrow (macOS Command) + KB_ROPT, // right alt or down arrow (macOS Option) + KB_RCTL, // right ctrl ot right arrow + KB_VRSN // debug, type version +}; + +enum macos_consumer_usages { + _AC_SHOW_ALL_WINDOWS = 0x29F, // mapped to KC_MCON + _AC_SHOW_ALL_APPS = 0x2A0 // mapped to KC_LPAD +}; + +/* Special Keys */ +#define SK_LT1C LT(_FN1, KC_CAPS) // Layer Tap 1, i.e., Tap = Caps Lock, Hold = Layer 1 +#define SK_LT2A LT(_FN2, KC_APP) // Layer Tap 2, i.e., Tap = Menu, Hold = Layer 2 + +/* key matrix */ +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ + * │Esc│ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │Backspc│ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ + * │ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ \ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ + * │*Caps*│ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ Enter │ *Caps* => Tap = Caps Lock, Hold = Layer 1 (Fn1) + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ + * │ Shift │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ ↑Shift │ + * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ + * │Ctrl│Win │Alt │ │Fn1 │←Alt│↓Mnu│→Ctl│ + * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ + */ + [_BASE] = LAYOUT_60_ansi( + KC_GESC, 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_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, + SK_LT1C, 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, KB_RSFT, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(_FN1), KB_RALT, KB_RAPP, KB_RCTL + ), + + /* + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ + * │ ' │F1 │F2 │F3 │F4 │F5 │F6 │F7 │F8 │F9 │F10│F11│F12│ Del │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ + * │ArwMd│ │ ↑ │ │ │Tog│Hu+│Sa+│Br+│Sp+│PSc│Hom│End│ Ins │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ + * │ │ ← │ ↓ │ → │ │Mod│Hu-│Sa-│Br-│Sp-│ │PUp│ │ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ + * │ │ │ │ │Ver│Rst│NKR│ │ │ │PDn│ │ + * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ + * │ │ │ │ │ │ │ │ │ + * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ + */ + [_FN1] = LAYOUT_60_ansi( + KC_GRV, 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_DEL, + KB_ARRW, _______, KC_UP, _______, _______, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, RGB_SPI, KC_PSCR, KC_HOME, KC_END, KC_INS, + _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, RGB_SPD, _______, KC_PGUP, _______, + _______, _______, _______, _______, KB_VRSN, QK_BOOT, NK_TOGG, _______, _______, _______, KC_PGDN, _______, + _______, _______, _______, _______, _______, _______, _______, _______ + ), + + /* + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ + * │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ + * │ │ │ │ │ │ │ │ │ + * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ + */ + [_FN2] = LAYOUT_60_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______ + ), + + [_FN3] = LAYOUT_60_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______ + ) +}; + +user_config_t user_config; + +#ifdef RGB_MATRIX_ENABLE + +/* + * RGB Stuff + */ + +#define ID61_CAPS_LOCK_KEY_INDEX 32 // position of Caps Lock key + +#define ID61_CAPS_LOCK_MAX_BRIGHTNESS 0xFF +#ifdef RGB_MATRIX_MAXIMUM_BRIGHTNESS + #undef ID61_CAPS_LOCK_MAX_BRIGHTNESS + #define ID61_CAPS_LOCK_MAX_BRIGHTNESS RGB_MATRIX_MAXIMUM_BRIGHTNESS +#endif + +#define ID61_CAPS_LOCK_VAL_STEP 8 +#ifdef RGB_MATRIX_VAL_STEP + #undef ID61_CAPS_LOCK_VAL_STEP + #define ID61_CAPS_LOCK_VAL_STEP RGB_MATRIX_VAL_STEP +#endif + +void ID61_update_rgb_mode(void) { + uint8_t flags = LED_FLAG_ALL; + + if (user_config.rgb_disable_perkey + #ifndef ID61_DISABLE_UNDERGLOW + && user_config.rgb_disable_underglow + #endif // ID61_DISABLE_UNDERGLOW + ) { + flags = 0; // All OFF Condition + } else { + if (user_config.rgb_disable_perkey) { + #ifndef ID61_DISABLE_UNDERGLOW + flags = LED_FLAG_UNDERGLOW | 0xF0; + #else + flags = 0xF0; + #endif // ID61_DISABLE_UNDERGLOW + } + #ifndef ID61_DISABLE_UNDERGLOW + if (user_config.rgb_disable_underglow) { + flags = LED_FLAG_MODIFIER | LED_FLAG_KEYLIGHT | LED_FLAG_INDICATOR | 0xF0; + } + #endif // ID61_DISABLE_UNDERGLOW + } + + if (flags == 0) { + rgb_matrix_set_flags(0); + rgb_matrix_set_color_all(HSV_OFF); + } else { + rgb_matrix_set_flags(flags); + rgb_matrix_enable_noeeprom(); + } + + eeconfig_update_kb(user_config.raw); // write back to EEPROM +} + +void ID61_get_rgb_mode(void) { + user_config.raw = eeconfig_read_kb(); // read config from EEPROM + ID61_update_rgb_mode(); +} + +void keyboard_post_init_user(void) { + ID61_get_rgb_mode(); +} + +void eeconfig_init_user(void) { + // EEPROM is getting reset! + user_config.raw = 0; + ID61_update_rgb_mode(); +} + +void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { + // Caps Lock key stuff + + if (host_keyboard_led_state().caps_lock) { + uint8_t v = rgb_matrix_get_val(); + if (v < ID61_CAPS_LOCK_VAL_STEP) { + v = ID61_CAPS_LOCK_VAL_STEP; + } else if (v < (ID61_CAPS_LOCK_MAX_BRIGHTNESS - ID61_CAPS_LOCK_VAL_STEP)) { + if (!user_config.rgb_disable_perkey) { + v += ID61_CAPS_LOCK_VAL_STEP; // inc. by one more step than current brightness + } // else leave as current brightness + } else { + v = ID61_CAPS_LOCK_MAX_BRIGHTNESS; + } + rgb_matrix_set_color(ID61_CAPS_LOCK_KEY_INDEX, v, v, v); // white, brightness adjusted + } else if (user_config.rgb_disable_perkey) { + rgb_matrix_set_color(ID61_CAPS_LOCK_KEY_INDEX, HSV_OFF); // off + } +} + +#endif // RGB_MATRIX_ENABLE + +/* + * Extra keys and RGB Toggle handler + */ + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + + // handle RGB toggle key - this ensures caps lock always works + #ifdef RGB_MATRIX_ENABLE + + case QK_BOOT: + if (record->event.pressed) { + rgb_matrix_set_color_all(RGB_MATRIX_MAXIMUM_BRIGHTNESS, 0, 0); // All red + rgb_matrix_driver.flush(); + } + return true; + + case RGB_TOG: + /* roll through the LED modes + * | Level | Per-key | Underglow | + * |-------------|---------|-----------| + * | 0 (default) | on | on | + * | 1 | OFF | on | + * | 2 | on | OFF | + * | 3 | OFF | OFF | + * + * for ID61_DISABLE_UNDERGLOW + * | Level | Per-key | + * |-------------|---------| + * | 0 (default) | on | + * | 1 | OFF | + */ + if (record->event.pressed) { + if ( (!user_config.rgb_disable_perkey) + #ifndef ID61_DISABLE_UNDERGLOW + && (!user_config.rgb_disable_underglow) + #endif // ID61_DISABLE_UNDERGLOW + ) { + user_config.rgb_disable_perkey = 1; + + #ifndef ID61_DISABLE_UNDERGLOW + + } else if ( user_config.rgb_disable_perkey && (!user_config.rgb_disable_underglow) ) { + user_config.rgb_disable_perkey = 0; + user_config.rgb_disable_underglow = 1; + + } else if ( (!user_config.rgb_disable_perkey) && user_config.rgb_disable_underglow ) { + user_config.rgb_disable_perkey = 1; + + #endif // ID61_DISABLE_UNDERGLOW + + } else { + user_config.rgb_disable_perkey = 0; + #ifndef ID61_DISABLE_UNDERGLOW + user_config.rgb_disable_underglow = 0; + #endif // ID61_DISABLE_UNDERGLOW + } + ID61_update_rgb_mode(); + } + return false; + + case EE_CLR: + if (!record->event.pressed) { // on release + ID61_get_rgb_mode(); + } + return true; // let this one pass on + + #endif // RGB_MATRIX_ENABLE + + case KB_ARRW: + if (record->event.pressed) { + user_config.in_arrow_mode ^= 1; + } + return false; + + case KB_RSFT: return ID61_process_special_k(keycode, record, user_config.in_arrow_mode, KC_RSFT, KC_UP, KC_PGUP); + case KB_RALT: return ID61_process_special_k(keycode, record, user_config.in_arrow_mode, KC_RALT, KC_LEFT, KC_HOME); + case KB_RAPP: return ID61_process_special_k(keycode, record, user_config.in_arrow_mode, KC_APP, KC_DOWN, KC_PGDN); + case KB_RCOM: return ID61_process_special_k(keycode, record, user_config.in_arrow_mode, KC_RGUI, KC_LEFT, KC_HOME); + case KB_ROPT: return ID61_process_special_k(keycode, record, user_config.in_arrow_mode, KC_RALT, KC_DOWN, KC_PGDN); + case KB_RCTL: return ID61_process_special_k(keycode, record, user_config.in_arrow_mode, KC_RCTL, KC_RIGHT, KC_END); + + // print firmware version + case KB_VRSN: + if (!get_mods()) { + if (!record->event.pressed) { + SEND_STRING(QMK_KEYBOARD ":" QMK_KEYMAP " (v" QMK_VERSION ")"); + } + } + return false; + + // @see: https://github.com/qmk/qmk_firmware/issues/10111#issuecomment-752300353 + case KC_MCON: + if (record->event.pressed) { + host_consumer_send(_AC_SHOW_ALL_WINDOWS); + } else { + host_consumer_send(0); + } + return false; + + case KC_LPAD: + if (record->event.pressed) { + host_consumer_send(_AC_SHOW_ALL_APPS); + } else { + host_consumer_send(0); + } + return false; + + // Shift + Backspace = Delete, see: https://docs.qmk.fm/#/feature_advanced_keycodes?id=shift-backspace-for-delete + case KC_BSPC: return ID61_backspace_special(keycode, record); + + default: + return true; /* Process all other keycodes normally */ + } +} diff --git a/keyboards/idobao/id61/keymaps/idobao/rules.mk b/keyboards/idobao/id61/keymaps/idobao/rules.mk new file mode 100644 index 0000000000..e18baf7261 --- /dev/null +++ b/keyboards/idobao/id61/keymaps/idobao/rules.mk @@ -0,0 +1,7 @@ +# Copyright 2022 Vino Rodrigues (@vinorodrigues) +# SPDX-License-Identifier: GPL-2.0-or-later + +LTO_ENABLE = yes +VIA_ENABLE = yes + +SRC += specialk.c diff --git a/keyboards/idobao/id61/keymaps/idobao/specialk.c b/keyboards/idobao/id61/keymaps/idobao/specialk.c new file mode 100644 index 0000000000..358d0cb764 --- /dev/null +++ b/keyboards/idobao/id61/keymaps/idobao/specialk.c @@ -0,0 +1,88 @@ +// Copyright 2022 Vino Rodrigues (@vinorodrigues) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "specialk.h" + +bool delkey_registered = false; +uint32_t __keycode_raised = 0; + +bool get_keycode_raised(uint8_t n) { + return __keycode_raised & (1 << n); +} + +void set_keycode_raised(uint8_t n, bool b) { + if (b) { + __keycode_raised |= 1 << n; + } else { + __keycode_raised &= ~(1 << n); + } +} + +bool ID61_process_special_k(uint16_t keycode, keyrecord_t *record, bool arrow_mode, uint8_t k_norm, uint8_t k_spcl, uint8_t k_altr) { + bool is_raised = get_highest_layer(layer_state|default_layer_state) != 0; + + if (record->event.pressed) { + set_keycode_raised(keycode - USER00, is_raised); // save for key release event + if (is_raised) { + // *** Fn keyed *** + if (arrow_mode) { + // alternate key + register_code(k_altr); + } else { + // special key + register_code(k_spcl); + } + } else { + // *** normal, un-Fn'ed *** + if (arrow_mode) { + // special key + register_code(k_spcl); + } else { + // normal key + register_code(k_norm); + } + } + } else { + if (get_keycode_raised(keycode - USER00)) { + // *** Fn keyed *** + if (arrow_mode) { + // alternate key + unregister_code(k_altr); + } else { + // special key + unregister_code(k_spcl); + } + } else { + // *** normal, un-Fn'ed *** + if (arrow_mode) { + // special key + unregister_code(k_spcl); + } else { + // normal key + unregister_code(k_norm); + } + } + } + return false; +} + +bool ID61_backspace_special(uint16_t keycode, keyrecord_t *record) { + uint8_t mod_state = get_mods(); + + if (record->event.pressed) { + if (mod_state & MOD_MASK_SHIFT) { + del_mods(MOD_MASK_SHIFT); + register_code(KC_DEL); + delkey_registered = true; + set_mods(mod_state); + return false; + } + } else { + if (delkey_registered) { + unregister_code(KC_DEL); + delkey_registered = false; + return false; + } + } + return true; // normal backspace, pass on +} diff --git a/keyboards/idobao/id61/keymaps/idobao/specialk.h b/keyboards/idobao/id61/keymaps/idobao/specialk.h new file mode 100644 index 0000000000..a2ec124de8 --- /dev/null +++ b/keyboards/idobao/id61/keymaps/idobao/specialk.h @@ -0,0 +1,12 @@ +// Copyright 2022 Vino Rodrigues (@vinorodrigues) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include <stdint.h> +#include <stdbool.h> +#include "util.h" +#include "quantum.h" + +bool ID61_process_special_k(uint16_t keycode, keyrecord_t *record, bool arrow_mode, uint8_t k_norm, uint8_t k_spcl, uint8_t k_altr); +bool ID61_backspace_special(uint16_t keycode, keyrecord_t *record); diff --git a/keyboards/idobao/id61/keymaps/via/keymap.c b/keyboards/idobao/id61/keymaps/via/keymap.c new file mode 100644 index 0000000000..6935194df8 --- /dev/null +++ b/keyboards/idobao/id61/keymaps/via/keymap.c @@ -0,0 +1,77 @@ +// Copyright 2022 Vino Rodrigues (@vinorodrigues) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ + * │Esc│ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │Backspc│ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ + * │ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ \ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ + * │ Caps │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ Enter │ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ + * │ Shift │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ Shift │ + * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ + * │Ctrl│Win │Alt │ │ Fn │Alt │Menu│Ctrl│ + * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ + */ + [0] = LAYOUT_60_ansi( + KC_GESC, 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_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_CAPS, 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, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(1), KC_RALT, KC_APP, KC_RCTL + ), + + /* + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ + * │ ~ │F1 │F2 │F3 │F4 │F5 │F6 │F7 │F8 │F9 │F10│F11│F12│ │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ + * │ │ │ ↑ │ │ │Tog│Hu+│Sa+│Br+│Sp+│PSc│Hom│End│ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ + * │ │ ← │ ↓ │ → │ │Mod│Hu-│Sa-│Br-│Sp-│PUp│PDn│ │ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ + * │ │ │ │ │ │Rst│NKR│ │ │Ins│Del│ ↑ │ + * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ + * │ │ │ │ │ │ ← │ ↓ │ → │ + * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ + */ + [1] = LAYOUT_60_ansi( + KC_GRV, 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_UP, _______, _______, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, RGB_SPI, KC_PSCR, KC_HOME, KC_END, _______, + _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, RGB_SPD, KC_PGUP, KC_PGDN, _______, + _______, _______, _______, _______, _______, QK_BOOT, NK_TOGG, _______, _______, KC_INS, KC_DEL, KC_UP, + _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RGHT + ), + + /* + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ + * │ │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ + * │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ + * │ │ │ │ │ │ │ │ │ + * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ + */ + [2] = LAYOUT_60_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______ + ), + + [3] = LAYOUT_60_ansi( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______ + ) +}; diff --git a/keyboards/idobao/id61/keymaps/via/rules.mk b/keyboards/idobao/id61/keymaps/via/rules.mk new file mode 100644 index 0000000000..974ef99660 --- /dev/null +++ b/keyboards/idobao/id61/keymaps/via/rules.mk @@ -0,0 +1,3 @@ + +LTO_ENABLE = yes +VIA_ENABLE = yes |