From 81be065fa538c5978363d379302b069ba23860aa Mon Sep 17 00:00:00 2001 From: jack <59737601+ItsWaffIe@users.noreply.github.com> Date: Mon, 19 Apr 2021 03:22:18 -0600 Subject: [PATCH 1/2] [Keyboard] VIA Support for LCK75 (#12402) --- keyboards/lck75/keymaps/via/keymap.c | 53 ++++++++++++++++++++++++++++ keyboards/lck75/keymaps/via/rules.mk | 2 ++ keyboards/lck75/lck75.c | 10 +++--- 3 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 keyboards/lck75/keymaps/via/keymap.c create mode 100644 keyboards/lck75/keymaps/via/rules.mk diff --git a/keyboards/lck75/keymaps/via/keymap.c b/keyboards/lck75/keymaps/via/keymap.c new file mode 100644 index 0000000000..697de925b5 --- /dev/null +++ b/keyboards/lck75/keymaps/via/keymap.c @@ -0,0 +1,53 @@ +/* Copyright 2021 ItsWaffle/waffle#6666 + * 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 . + */ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_lck75_ansi( + KC_GESC, 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_PSCR, KC_MUTE, + KC_GRV, 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_INS, + 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_DEL, + KC_NO, 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_PGUP, + 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_UP, KC_PGDN, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RIGHT + ), + + [1] = LAYOUT_lck75_ansi( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_LGUI, KC_TRNS, KC_TRNS, KC_RALT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + + [2] = LAYOUT_lck75_ansi( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + + [3] = LAYOUT_lck75_ansi( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ) +}; diff --git a/keyboards/lck75/keymaps/via/rules.mk b/keyboards/lck75/keymaps/via/rules.mk new file mode 100644 index 0000000000..541a15608a --- /dev/null +++ b/keyboards/lck75/keymaps/via/rules.mk @@ -0,0 +1,2 @@ +VIA_ENABLE = yes +LTO_ENABLE = no diff --git a/keyboards/lck75/lck75.c b/keyboards/lck75/lck75.c index 3bcf350a19..8fc674d03f 100644 --- a/keyboards/lck75/lck75.c +++ b/keyboards/lck75/lck75.c @@ -36,10 +36,10 @@ __attribute__((weak)) oled_rotation_t oled_init_user(oled_rotation_t rotation) { } __attribute__((weak)) void oled_task_user(void) { -uint32_t anim_timer = 0; -uint32_t anim_sleep = 0; -uint8_t current_idle_frame = 0; -uint8_t current_tap_frame = 0; +static uint32_t anim_timer = 0; +static uint32_t anim_sleep = 0; +static uint8_t current_idle_frame = 0; +static uint8_t current_tap_frame = 0; static const char PROGMEM idle[IDLE_FRAMES][ANIM_SIZE] = { @@ -140,4 +140,4 @@ uint8_t current_tap_frame = 0; } } -#endif \ No newline at end of file +#endif From 2274631c8fd4fb6b20f6dc9e571dfb43625f629e Mon Sep 17 00:00:00 2001 From: Robert Verst Date: Mon, 19 Apr 2021 11:22:49 +0200 Subject: [PATCH 2/2] [Keymap] Fix handling of RV_LOCK and RV_SNAP for windows (#12498) Co-authored-by: Robert Verst --- users/rverst/rverst.c | 39 +++++++-------------------------------- 1 file changed, 7 insertions(+), 32 deletions(-) diff --git a/users/rverst/rverst.c b/users/rverst/rverst.c index 0524c6011d..23391caa6a 100644 --- a/users/rverst/rverst.c +++ b/users/rverst/rverst.c @@ -197,15 +197,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { // Lock computer case RV_LOCK: if (mode == MAC || mode == MAC_UNI) { - register_code(KC_LGUI); - register_code(KC_LCTL); - tap_code(KC_Q); - unregister_code(KC_LCTL); - unregister_code(KC_LGUI); + tap_code16(G(C(KC_Q))); } else if (mode == WINDOWS || mode == WINDOWS_UNI) { - register_code(KC_LGUI); - tap_code(KC_L); - register_code(KC_LGUI); + tap_code16(G(KC_L)); } return false; @@ -215,23 +209,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (ls) unregister_code(KC_LSFT); if (rs) unregister_code(KC_RSFT); - register_code(KC_LGUI); - register_code(KC_LSFT); - if (as) - tap_code(KC_5); - else - tap_code(KC_4); - unregister_code(KC_LSFT); - unregister_code(KC_LGUI); + tap_code16(G(S(as ? KC_4 : KC_5))); if (ls) register_code(KC_LSFT); if (rs) register_code(KC_RSFT); } else if (mode == WINDOWS || mode == WINDOWS_UNI) { - register_code(KC_LGUI); - register_code(KC_LSFT); - tap_code(KC_S); - register_code(KC_LSFT); - register_code(KC_LGUI); + tap_code16(G(S(KC_S))); } return false; @@ -260,9 +243,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (ls) unregister_code(KC_LSFT); if (rs) unregister_code(KC_RSFT); - register_code(KC_LALT); - tap_code(KC_U); - unregister_code(KC_LALT); + tap_code16(A(KC_U)); if (as) register_code(KC_LSFT); if (keycode == RV_AUML) { @@ -318,11 +299,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (is_unicode(mode)) { send_unicode_string("€"); } else if (mode == MAC) { - register_code(KC_LALT); - register_code(KC_LSFT); - tap_code(KC_2); - unregister_code(KC_LSFT); - unregister_code(KC_LALT); + tap_code16(S(A(KC_2))); } else if (mode == WINDOWS) { register_code(KC_RALT); tap_code(KC_0); @@ -343,9 +320,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { send_unicode_string("ß"); } } else if (mode == MAC) { - register_code(KC_LALT); - tap_code(KC_S); - unregister_code(KC_LALT); + tap_code16(A(KC_S)); } else if (mode == WINDOWS) { register_code(KC_RALT); tap_code(KC_2);