From 35dbe8ba035c8eefc1051226aa8e3dd7cd63a912 Mon Sep 17 00:00:00 2001 From: Joel Elkins Date: Wed, 2 Jun 2021 15:59:52 -0500 Subject: [Keymap] merge jdelkins userspace and associated keymaps (#11276) * [Keymap] merge jdelkins userspace and associated keymaps * Add copyright & license info * Change rgblight_config.enable to rgblight_is_enabled() * Update keyboards/dz60/keymaps/jdelkins/keymap.c Co-authored-by: Drashna Jaelre * Update keyboards/dz60/keymaps/jdelkins/keymap.c Co-authored-by: Drashna Jaelre * Update keyboards/dz60/keymaps/jdelkins/keymap.c Co-authored-by: Drashna Jaelre * Remove superfluous includes * Change EXTRAFLAGS+=-flto to LTO_ENABLE=yes * Remove unnecessary jdelkins_ss symlink in users * Add copyright and license notices * Use preferred way to determine capslock / numlock state Co-authored-by: Drashna Jaelre * Add #pragma once to a header Co-authored-by: Drashna Jaelre * Include QMK_KEYBOARD_H only once, in userspace header * Remove unnecessary initialization in matrix_init_keymap * Do process_record_keymap before cases handled in process_record_user * Reorganize & simplify secrets feature enablement * Use tap_code16 Co-authored-by: Ryan * Remove superfluous break Co-authored-by: Ryan * Remove copyright from rules.mk Co-authored-by: Ryan * Remove copyright from rules.mk Co-authored-by: Ryan * Use tap_code16 Co-authored-by: Ryan * include "print.h" instead of Co-authored-by: Ryan * Use tap_cod16 Co-authored-by: Ryan * Use tap_code16 Co-authored-by: Ryan * Use tap_code16 Co-authored-by: Ryan * Use tap_code16 Co-authored-by: Ryan * Remove copyright from rules.mk Co-authored-by: Ryan * add #pragma once to a header Co-authored-by: Ryan * include "print.h" instead of Co-authored-by: Ryan * Remove copyright from rules.mk Co-authored-by: Ryan * Remove copyright from rules.mk Co-authored-by: Ryan * Remove copyright from rules.mk Co-authored-by: Ryan * Use tap_code16 Co-authored-by: Ryan * Use tap_code16 Co-authored-by: Ryan * Use :flash target where possible * Remove special case flash target and use PROGRAM_CMD * dz60/jdelkins_ss: use tap_code16 Co-authored-by: Drashna Jaelre Co-authored-by: Ryan --- users/jdelkins/jdelkins.h | 134 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 users/jdelkins/jdelkins.h (limited to 'users/jdelkins/jdelkins.h') diff --git a/users/jdelkins/jdelkins.h b/users/jdelkins/jdelkins.h new file mode 100644 index 0000000000..ddec8dc4ae --- /dev/null +++ b/users/jdelkins/jdelkins.h @@ -0,0 +1,134 @@ +/* + Copyright 2020 Joel Elkins + + 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 QMK_KEYBOARD_H + +// Secrets + +#if !defined(NO_SECRETS) && __has_include("secrets.h") +# define DO_SECRETS +#endif + +void send_secret_string(uint8_t n); + +// standard layers + +enum jdelkins_layers { + _QWERTY = 0, + _RPT, + _GAME, + _FUNC, + _KP, + _SECRETS, + _ADJUST, + _LAYER_MAX +}; + +// key definitions + +typedef union { + uint32_t raw; + struct { + bool system_mac :1; + }; +} user_config_t; + +extern user_config_t user_config; + +static inline void do_mac_key(uint16_t norm_key, uint16_t mac_key, keyrecord_t *record) { + uint16_t key = user_config.system_mac ? mac_key : norm_key; + if (record->event.pressed) + register_code16(key); + else + unregister_code16(key); +} + +enum jdelkins_keycodes { + KB_MAKE = SAFE_RANGE, + KB_FLSH, + KB_VRSN, + KB_BOOT, + FW_WRD, + BK_WRD, + KB_BOL, + KB_EOL, + TG_SYS, + KB_COPY, + KB_PASTE, + MY_GUI, + MY_ALT, + MY_RGUI, + MY_RALT, + MY_CALC, + +#ifdef DO_SECRETS + KC_SECRET_1, + KC_SECRET_2, + KC_SECRET_3, + KC_SECRET_4, + KC_SECRET_5, + KC_SECRET_6, +#endif + + USER_SAFE_RANGE, +}; + +#ifdef DO_SECRETS +# define KC_SEC1 KC_SECRET_1 +# define KC_SEC2 KC_SECRET_2 +# define KC_SEC3 KC_SECRET_3 +# define KC_SEC4 KC_SECRET_4 +# define KC_SEC5 KC_SECRET_5 +# define KC_SEC6 KC_SECRET_6 +#else +# define KC_SEC1 KC_NO +# define KC_SEC2 KC_NO +# define KC_SEC3 KC_NO +# define KC_SEC4 KC_NO +# define KC_SEC5 KC_NO +# define KC_SEC6 KC_NO +#endif + +#define MODS_SHIFT (get_mods() & MOD_MASK_SHIFT) +#define MODS_CTRL (get_mods() & MOD_MASK_CTRL) +#define MODS_ALT (get_mods() & MOD_MASK_ALT) +#define MODS_GUI (get_mods() & MOD_MASK_GUI) + +#define MY_CAPS LCTL_T(KC_CAPS) +#define MY_SPC LT(_FUNC, KC_SPC) + +#define NUMLOCK_ON host_keyboard_led_state().num_lock +#define CAPSLOCK_ON host_keyboard_led_state().caps_lock + +#ifdef TAP_DANCE_ENABLE + +enum { + SINGLE_TAP = 1, + SINGLE_HOLD = 2, + DOUBLE_TAP = 3, + DOUBLE_HOLD = 4, + DOUBLE_SINGLE_TAP = 5, //send two single taps + TRIPLE_TAP = 6, + TRIPLE_HOLD = 7 +}; + +int cur_dance(qk_tap_dance_state_t *state); // prefer tap +int hold_cur_dance(qk_tap_dance_state_t *state); // prefer hold + +#endif // TAP_DANCE_ENABLE -- cgit v1.2.3