From a400681ccf56b41a4badece43f73939329a1fe47 Mon Sep 17 00:00:00 2001 From: farfalleflickan <6597735+farfalleflickan@users.noreply.github.com> Date: Thu, 22 Jul 2021 08:57:35 +0200 Subject: [Keyboard] Updated keyboard & keymaps (#12667) Co-authored-by: pastapojken <6597735+pastapojken@users.noreply.github.com> --- keyboards/nack/keymaps/farfalleflickan/keymap.h | 116 ++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 keyboards/nack/keymaps/farfalleflickan/keymap.h (limited to 'keyboards/nack/keymaps/farfalleflickan/keymap.h') diff --git a/keyboards/nack/keymaps/farfalleflickan/keymap.h b/keyboards/nack/keymaps/farfalleflickan/keymap.h new file mode 100644 index 0000000000..212f45ffdb --- /dev/null +++ b/keyboards/nack/keymaps/farfalleflickan/keymap.h @@ -0,0 +1,116 @@ +/* Copyright 2020 farfalleflickan + * + * 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 . + */ + +#pragma once +#include "quantum.h" + +void add_to_prev(uint16_t kc); +void unreg_prev(void); +void timer_timeout_keymap(void); +bool process_record_user(uint16_t keycode, keyrecord_t *record); + +// Normal shift status +#define SHIFT_NORM(kc1, kc2) \ +if (record->event.pressed) { \ + timer_timeout_keymap(); \ + if (lshift) { \ + register_code(KC_LSFT); \ + unregister_code(kc2); \ + register_code(kc2); \ + add_to_prev(kc2); \ + } else { \ + unregister_code(KC_LSFT); \ + unregister_code(kc1); \ + register_code(kc1); \ + } \ +} else { \ + unregister_code(kc1); \ + unregister_code(kc2); \ +} \ +return false; + +// Always shifted +#define SHIFT_ALL(kc1, kc2) \ +if (record->event.pressed) { \ + timer_timeout_keymap(); \ + register_code(KC_LSFT); \ + if (lshift) { \ + unregister_code(kc2); \ + register_code(kc2); \ + add_to_prev(kc2); \ + } else { \ + unregister_code(kc1); \ + register_code(kc1); \ + add_to_prev(kc1); \ + } \ +} else { \ + unregister_code(kc1); \ + unregister_code(kc2); \ + unreg_prev(); \ + if (lshift) \ + register_code(KC_LSFT); \ + else \ + unregister_code(KC_LSFT); \ +} \ +return false; + +// Never shifted +#define SHIFT_NO(kc1, kc2) \ +if (record->event.pressed) { \ + timer_timeout_keymap(); \ + unregister_code(KC_LSFT); \ + if (lshift) { \ + unregister_code(kc2); \ + register_code(kc2); \ + add_to_prev(kc2); \ + } else { \ + unregister_code(kc1); \ + register_code(kc1); \ + } \ +} else { \ + unregister_code(kc1); \ + unregister_code(kc2); \ + unreg_prev(); \ + if (lshift) \ + register_code(KC_LSFT); \ + else \ + unregister_code(KC_LSFT); \ +} \ +return false; + +//Never RALT +#define RALT_NO(kc1, kc2) \ +if (record->event.pressed) { \ + timer_timeout_keymap(); \ + unregister_code(KC_RALT); \ + if (ralt) { \ + unregister_code(kc2); \ + register_code(kc2); \ + add_to_prev(kc2); \ + } else { \ + unregister_code(kc1); \ + register_code(kc1); \ + } \ +} else { \ + unregister_code(kc1); \ + unregister_code(kc2); \ + unreg_prev(); \ + if (ralt) \ + register_code(KC_RALT); \ + else \ + unregister_code(KC_RALT); \ +} \ +return false; -- cgit v1.2.3