From 1105f2eb47e79a7a4ce8d31dd1f6d7b09afccb2d Mon Sep 17 00:00:00 2001 From: Adrian L Lange Date: Tue, 20 Jul 2021 03:48:00 +0200 Subject: [PATCH] [Keymap] Update bface p3lim keymap (#13582) --- .../winkeyless/bface/keymaps/p3lim/README.md | 13 ++- .../winkeyless/bface/keymaps/p3lim/keymap.c | 86 +++++++++++++------ .../winkeyless/bface/keymaps/p3lim/rules.mk | 1 + 3 files changed, 70 insertions(+), 30 deletions(-) create mode 100644 keyboards/winkeyless/bface/keymaps/p3lim/rules.mk diff --git a/keyboards/winkeyless/bface/keymaps/p3lim/README.md b/keyboards/winkeyless/bface/keymaps/p3lim/README.md index 81f99ec966..94e84e7f22 100644 --- a/keyboards/winkeyless/bface/keymaps/p3lim/README.md +++ b/keyboards/winkeyless/bface/keymaps/p3lim/README.md @@ -2,13 +2,20 @@ ![](https://user-images.githubusercontent.com/26496/61170794-bf8a2c80-a56e-11e9-893f-f1766e7a9a04.png) -My layout using the winkeyless b.face X2 PCB. The keys indicated with a gray color was not supported by the layout so a custom one was made. +My layout using the winkeyless b.face X2 PCB. ### Building & Flashing -- Hold LCTRL while connecting to put in flashing mode -- Follow instructions in the main _bface_ directory +- Set up QMK + - `pip install --user qmk` + - `qmk setup` +- Add udev rules if on Linux + - Follow the docs: +- Build and flash + - `qmk flash -kb winkeyless/bface -km p3lim` +- Hold bottom-left key while connecting to put in flashing mode ### Layout notes +The keys indicated with a gray color in the image above was not supported by the layout so a custom matrix was made. The two additional keys were on pins 22+41 and 22+42, C3+B1 and C3+B2, which is mapped to col 10 row 1 and col 10 row 2 in the matrix. diff --git a/keyboards/winkeyless/bface/keymaps/p3lim/keymap.c b/keyboards/winkeyless/bface/keymaps/p3lim/keymap.c index 0ec1245291..f702810f9c 100644 --- a/keyboards/winkeyless/bface/keymaps/p3lim/keymap.c +++ b/keyboards/winkeyless/bface/keymaps/p3lim/keymap.c @@ -1,5 +1,5 @@ /* -Copyright 2019 Adrian L Lange +Copyright 2019-2021 Adrian L Lange 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 @@ -16,7 +16,6 @@ along with this program. If not, see . */ #include QMK_KEYBOARD_H -#include "quantum.h" #define LAYOUT_p3lim(\ K04, K14, K24, K34, K44, K54, K16, KB6, KB7, K17, KA4, KB4, KC4, KE4, \ @@ -37,13 +36,13 @@ along with this program. If not, see . enum my_keycodes { C_ESC0 = SAFE_RANGE, // layer 0 esc - C_ESC1 // layer 1 esc + C_ESC1, // layer 1 esc + C_NO1, // æ, requires RCTL to be a compose key in software + C_NO2, // ø, requires RCTL to be a compose key in software + C_NO3 // å, requires RCTL to be a compose key in software }; // use compiler macros for simpler stuff -#define C_NO1 RALT(KC_QUOT) -#define C_NO2 RALT(KC_SCLN) -#define C_NO3 RALT(KC_LBRC) #define C_KVM1 LCA(KC_1) #define C_KVM2 LCA(KC_2) #define C_KVM3 LCA(KC_3) @@ -77,7 +76,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |-----------------------------------------------------------------------------------------+ * | Caps | Home| Up | End | PgUp| | | | | | | | | | * |---------------------------------------------------------------------------------| | - * | | Left| Down|Right| PgDn| | | | | | | | | | + * | | Left| Down|Right| PgDn|PrtSc| | | | | | | | | * |-----------------------------------------------------------------------------------------+ * | | KVM1| KVM2| KVM3| KVM4| | | | | | | | | * |-----------------------------------------------------------------------------------------+ @@ -87,7 +86,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [1] = LAYOUT_p3lim( C_ESC1, 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_CAPS, KC_HOME, KC_UP, KC_END, KC_PGUP, _______, _______, _______, _______, _______, _______, _______, _______, - _______, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, KC_PSCR, _______, _______, _______, _______, _______, _______, _______, _______, _______, C_KVM1, C_KVM2, C_KVM3, C_KVM4, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_NO, _______, _______ ), @@ -123,32 +122,65 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ }; +static bool grave_esc_shifted = false; + bool process_record_user(uint16_t keycode, keyrecord_t *record){ + const uint8_t mods = get_mods(); + uint8_t shifted = mods & MOD_MASK_SHIFT; + switch(keycode){ case C_ESC0: // layer 0 if(record->event.pressed){ - if(get_mods() & MOD_MASK_SHIFT) - register_code(KC_GRAVE); - else - register_code(KC_ESCAPE); - } else { - if(get_mods() & MOD_MASK_SHIFT) - unregister_code(KC_GRAVE); - else - unregister_code(KC_ESCAPE); - } + grave_esc_shifted = shifted; + register_code(shifted ? KC_GRAVE : KC_ESCAPE); + } else + unregister_code(grave_esc_shifted ? KC_GRAVE : KC_ESCAPE); return false; case C_ESC1: // layer 1 if(record->event.pressed){ - if(get_mods() & MOD_MASK_SHIFT) - register_code(KC_ESCAPE); - else - register_code(KC_GRAVE); - } else { - if(get_mods() & MOD_MASK_SHIFT) - unregister_code(KC_ESCAPE); - else - unregister_code(KC_GRAVE); + grave_esc_shifted = shifted; + register_code(shifted ? KC_ESCAPE : KC_GRAVE); + } else + unregister_code(grave_esc_shifted ? KC_ESCAPE : KC_GRAVE); + return false; + case C_NO1: // æ + if(record->event.pressed){ + // we use shift for A and E to make it capitalized, no need to handle it here + tap_code(KC_RCTL); + tap_code(KC_A); + tap_code(KC_E); + } + return false; + case C_NO2: // ø + // the "/" symbol can't be shifted, so we have to deal with that + if(record->event.pressed){ + if(shifted){ + unregister_code(KC_LSFT); // reset the shift state, I always use LSFT personally + tap_code(KC_RCTL); + tap_code(KC_SLSH); + tap_code16(S(KC_O)); + register_code(KC_LSFT); // enable the shift state again to keep state consistent + } else { + tap_code(KC_RCTL); + tap_code(KC_SLSH); + tap_code(KC_O); + } + } + return false; + case C_NO3: // å + // the "o" symbol can't be shifted, so we have to deal with that + if(record->event.pressed){ + if(shifted){ + unregister_code(KC_LSFT); // reset the shift state, I always use LSFT personally + tap_code(KC_RCTL); + tap_code(KC_O); + tap_code16(S(KC_A)); + register_code(KC_LSFT); // enable the shift state again to keep state consistent + } else { + tap_code(KC_RCTL); + tap_code(KC_O); + tap_code(KC_A); + } } return false; } diff --git a/keyboards/winkeyless/bface/keymaps/p3lim/rules.mk b/keyboards/winkeyless/bface/keymaps/p3lim/rules.mk new file mode 100644 index 0000000000..e0ed6f0c2d --- /dev/null +++ b/keyboards/winkeyless/bface/keymaps/p3lim/rules.mk @@ -0,0 +1 @@ +RGBLIGHT_ENABLE = no