diff options
| author | Seth Barberee <seth.barberee@gmail.com> | 2021-05-08 10:26:51 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-08 10:26:51 -0700 |
| commit | b7fe24923e29218b15233163d9fe0ac5f332d3fc (patch) | |
| tree | 442ad0be96649a8031e12be9006d6e307ec2f98a | |
| parent | 067a6f017477938f965b1c4af4dace288d906730 (diff) | |
| download | qmk_firmware-b7fe24923e29218b15233163d9fe0ac5f332d3fc.tar.gz qmk_firmware-b7fe24923e29218b15233163d9fe0ac5f332d3fc.zip | |
Update sethBarberee Userspace (#12620)
* update for LTO and guard RGBLED_SPLIT
* Revert "update for LTO and guard RGBLED_SPLIT"
This reverts commit ce81177cbe330ae3e1e14c264dc0cb0946f08d70.
* Revert "Revert "update for LTO and guard RGBLED_SPLIT""
This reverts commit 67da0ce9f38777064ad094c1ecba7ce17a40994f.
* update iris keymap for keymap_kc removal and overhaul userspace
* add licenses
* fix tap_dance error when rgblight is disabled and update/clean iris/sinc maps
| -rw-r--r-- | keyboards/keebio/iris/keymaps/sethBarberee/config.h | 30 | ||||
| -rw-r--r-- | keyboards/keebio/iris/keymaps/sethBarberee/keymap.c | 181 | ||||
| -rw-r--r-- | keyboards/keebio/iris/keymaps/sethBarberee/rules.mk | 6 | ||||
| -rw-r--r-- | keyboards/keebio/sinc/keymaps/sethBarberee/config.h | 30 | ||||
| -rw-r--r-- | keyboards/keebio/sinc/keymaps/sethBarberee/keymap.c | 71 | ||||
| -rw-r--r-- | keyboards/keebio/sinc/keymaps/sethBarberee/rules.mk | 3 | ||||
| -rw-r--r-- | keyboards/wilba_tech/zeal60/keymaps/sethBarberee/rules.mk | 1 | ||||
| -rw-r--r-- | users/sethBarberee/config.h | 69 | ||||
| -rw-r--r-- | users/sethBarberee/rgb_light.c | 52 | ||||
| -rw-r--r-- | users/sethBarberee/rgb_light.h | 21 | ||||
| -rw-r--r-- | users/sethBarberee/rules.mk | 9 | ||||
| -rw-r--r-- | users/sethBarberee/sethBarberee.c | 112 | ||||
| -rw-r--r-- | users/sethBarberee/sethBarberee.h | 56 | ||||
| -rw-r--r-- | users/sethBarberee/tap_dance.c | 89 | ||||
| -rw-r--r-- | users/sethBarberee/tap_dance.h | 43 | ||||
| -rw-r--r-- | users/sethBarberee/wrappers.h | 55 |
16 files changed, 604 insertions, 224 deletions
diff --git a/keyboards/keebio/iris/keymaps/sethBarberee/config.h b/keyboards/keebio/iris/keymaps/sethBarberee/config.h index c031c0326..bd2ec4121 100644 --- a/keyboards/keebio/iris/keymaps/sethBarberee/config.h +++ b/keyboards/keebio/iris/keymaps/sethBarberee/config.h | |||
| @@ -30,32 +30,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 30 | 30 | ||
| 31 | #undef RGBLED_NUM | 31 | #undef RGBLED_NUM |
| 32 | #define RGBLED_NUM 8 | 32 | #define RGBLED_NUM 8 |
| 33 | #define RGBLIGHT_ANIMATIONS | ||
| 34 | #define RGBLIGHT_SLEEP | ||
| 35 | #define RGBLIGHT_HUE_STEP 8 | ||
| 36 | #define RGBLIGHT_SAT_STEP 8 | ||
| 37 | #define RGBLIGHT_VAL_STEP 8 | ||
| 38 | #undef RGBLED_SPLIT | ||
| 39 | #define RGBLED_SPLIT { RGBLED_NUM, 0} // defined to sync animations | ||
| 40 | |||
| 41 | #define FORCE_NKRO // force NKRO on by default | ||
| 42 | |||
| 43 | #undef TAPPING_TERM | ||
| 44 | #define TAPPING_TERM 200 | ||
| 45 | |||
| 46 | 33 | ||
| 47 | #if !defined(NO_DEBUG) && !defined(CONSOLE_ENABLE) | 34 | #undef RGBLED_SPLIT |
| 48 | #define NO_DEBUG | 35 | #define RGBLED_SPLIT { RGBLED_NUM, 0} |
| 49 | #endif // !NO_DEBUG | ||
| 50 | #if !defined(NO_PRINT) && !defined(CONSOLE_ENABLE) | ||
| 51 | #define NO_PRINT | ||
| 52 | #endif // !NO_PRINT | ||
| 53 | |||
| 54 | #define NO_MUSIC_MODE | ||
| 55 | |||
| 56 | // Override caps lock indication from my userspace | ||
| 57 | //#undef NORMAL_MODE | ||
| 58 | //#define NORMAL_MODE 1 | ||
| 59 | |||
| 60 | //#undef CAPS_LOCK_MODE | ||
| 61 | //#define CAPS_LOCK_MODE 28 | ||
diff --git a/keyboards/keebio/iris/keymaps/sethBarberee/keymap.c b/keyboards/keebio/iris/keymaps/sethBarberee/keymap.c index 1e39c33d1..269350403 100644 --- a/keyboards/keebio/iris/keymaps/sethBarberee/keymap.c +++ b/keyboards/keebio/iris/keymaps/sethBarberee/keymap.c | |||
| @@ -1,26 +1,24 @@ | |||
| 1 | #include QMK_KEYBOARD_H | 1 | /* Copyright 2021 SethBarberee <seth.barberee@gmail.com> |
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 2 | #include "sethBarberee.h" | 16 | #include "sethBarberee.h" |
| 3 | 17 | ||
| 4 | extern backlight_config_t backlight_config; | 18 | extern backlight_config_t backlight_config; |
| 5 | 19 | ||
| 6 | enum layers { | ||
| 7 | _QWERTY, | ||
| 8 | _LOWER, | ||
| 9 | _RAISE, | ||
| 10 | _ADJUST | ||
| 11 | }; | ||
| 12 | |||
| 13 | enum custom_keycodes { | ||
| 14 | QWERTY = SAFE_RANGE, | ||
| 15 | LOWER, | ||
| 16 | RAISE, | ||
| 17 | ADJUST, | ||
| 18 | }; | ||
| 19 | |||
| 20 | #define KC_ KC_TRNS | 20 | #define KC_ KC_TRNS |
| 21 | 21 | ||
| 22 | #define KC_LOWR LOWER | ||
| 23 | #define KC_RASE RAISE | ||
| 24 | #define KC_RST RESET | 22 | #define KC_RST RESET |
| 25 | #define KC_BL_S BL_STEP | 23 | #define KC_BL_S BL_STEP |
| 26 | #define KC_RTOG RGB_TOG | 24 | #define KC_RTOG RGB_TOG |
| @@ -33,147 +31,54 @@ enum custom_keycodes { | |||
| 33 | #define KC_RVAD RGB_VAD | 31 | #define KC_RVAD RGB_VAD |
| 34 | #define KC_VK VLK_TOG | 32 | #define KC_VK VLK_TOG |
| 35 | 33 | ||
| 34 | #define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__) | ||
| 35 | |||
| 36 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 36 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
| 37 | 37 | ||
| 38 | [_QWERTY] = LAYOUT_kc( | 38 | [_QWERTY] = LAYOUT_wrapper( |
| 39 | //,----+----+----+----+----+----. ,----+----+----+----+----+----. | 39 | KC_ECAP, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, KC_MINS, |
| 40 | ECAP, 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 ,MINS, | 40 | KC_TAB , _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, KC_DEL , |
| 41 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | 41 | KC_LSFT, _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, |
| 42 | TAB , Q , W , E , R , T , Y , U , I , O , P ,DEL , | 42 | KC_LCTL, _________________QWERTY_L3_________________, KC_SPC, KC_RASE, _________________QWERTY_R3_________________,KC_RSFT, |
| 43 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | 43 | KC_LGUI, KC_LOWR, KC_SPC, KC_BSPC , KC_ENT, KC_LALT |
| 44 | LSFT, A , S , D , F , G , H , J , K , L ,SCLN,QUOT, | ||
| 45 | //|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----| | ||
| 46 | LCTL, Z , X , C , V , B , SPC, RASE, N , M ,COMM,DOT ,SLSH,RSFT, | ||
| 47 | //`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----' | ||
| 48 | LGUI,LOWR, SPC, BSPC ,ENT,LALT | ||
| 49 | // `----+----+----' `----+----+----' | ||
| 50 | ), | 44 | ), |
| 51 | 45 | ||
| 52 | [_LOWER] = LAYOUT_kc( | 46 | [_LOWER] = LAYOUT( |
| 53 | //,----+----+----+----+----+----. ,----+----+----+----+----+----. | 47 | KC_TILD,KC_EXLM, KC_AT ,KC_HASH,KC_DLR ,KC_PERC, KC_CIRC,KC_AMPR,KC_ASTR,KC_LPRN,KC_RPRN,KC_BSPC, |
| 54 | TILD,EXLM, AT ,HASH,DLR ,PERC, CIRC,AMPR,ASTR,LPRN,RPRN,BSPC, | 48 | KC_RST ,_______,_______, KC_UP ,_______,_______, KC_GRV , KC_P7 , KC_P8 , KC_P9 ,_______,_______, |
| 55 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | 49 | KC_DEL ,_______,KC_LEFT,KC_DOWN,KC_RGHT,KC_LBRC, KC_RBRC, KC_P4 , KC_P5 , KC_P6 ,KC_PLUS,KC_PIPE, |
| 56 | RST , , , UP , , , GRV , P7 , P8 , P9 , , , | 50 | KC_BL_S,_______,_______,_______,_______,KC_LCBR,KC_LPRN, KC_RPRN,KC_RCBR, KC_P1 , KC_P2 , KC_P3 ,KC_MINS,_______, |
| 57 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | 51 | _______,_______,KC_LPRN, KC_DEL ,_______, KC_P0 |
| 58 | DEL , ,LEFT,DOWN,RGHT,LBRC, RBRC, P4 , P5 , P6 ,PLUS,PIPE, | ||
| 59 | //|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----| | ||
| 60 | BL_S, , , , ,LCBR,LPRN, RPRN,RCBR, P1 , P2 , P3 ,MINS, , | ||
| 61 | //`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----' | ||
| 62 | , ,LPRN , DEL , , P0 | ||
| 63 | // `----+----+----' `----+----+----' | ||
| 64 | ), | 52 | ), |
| 65 | 53 | ||
| 66 | [_RAISE] = LAYOUT_kc( | 54 | [_RAISE] = LAYOUT( |
| 67 | //,----+----+----+----+----+----. ,----+----+----+----+----+----. | 55 | KC_F12 , KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , KC_F7 , KC_F8 , KC_F9 ,KC_F10 ,KC_F11 , |
| 68 | F12 , F1 , F2 , F3 , F4 , F5 , F6 , F7 , F8 , F9 ,F10 ,F11 , | 56 | _______,_______,_______,_______,_______,_______, _______, _______,_______,_______,_______,_______, |
| 69 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | 57 | _______,KC_MPRV,KC_MNXT,KC_VOLU,KC_PGUP,KC_UNDS, KC_EQL ,KC_HOME,_______,_______,_______,KC_BSLS, |
| 70 | , , , , , , , , , , , , | 58 | KC_MUTE,KC_MSTP,KC_MPLY,KC_VOLD,KC_PGDN,KC_MINS,_______, _______,KC_PLUS,KC_END ,_______,_______,_______,_______, |
| 71 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | 59 | _______,_______,_______, _______,_______, _______ |
| 72 | ,MPRV,MNXT,VOLU,PGUP,UNDS, EQL ,HOME, , , ,BSLS, | ||
| 73 | //|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----| | ||
| 74 | MUTE,MSTP,MPLY,VOLD,PGDN,MINS, , ,PLUS,END , , , , , | ||
| 75 | //`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----' | ||
| 76 | , , , , , | ||
| 77 | // `----+----+----' `----+----+----' | ||
| 78 | ), | 60 | ), |
| 79 | 61 | ||
| 80 | [_ADJUST] = LAYOUT_kc( | 62 | [_ADJUST] = LAYOUT( |
| 81 | //,----+----+----+----+----+----. ,----+----+----+----+----+----. | 63 | //,----+----+----+----+----+----. ,----+----+----+----+----+----. |
| 82 | , , , , , , , , , , , , | 64 | _______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______, |
| 83 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | 65 | //|----+----+----+----+----+----| |----+----+----+----+----+----| |
| 84 | RTOG,RMOD,RHUI,RSAI,RVAI, , , , , , , , | 66 | KC_RTOG,KC_RMOD,KC_RHUI,KC_RSAI,KC_RVAI,_______, _______,_______,_______,_______,_______,_______, |
| 85 | //|----+----+----+----+----+----| |----+----+----+----+----+----| | 67 | //|----+----+----+----+----+----| |----+----+----+----+----+----| |
| 86 | VK, ,RHUD,RSAD,RVAD, , , , , , , , | 68 | KC_VK, _______,KC_RHUD,KC_RSAD,KC_RVAD,_______, _______,_______,_______,_______,_______,_______, |
| 87 | //|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----| | 69 | //|----+----+----+----+----+----+----. ,----|----+----+----+----+----+----| |
| 88 | BL_S,RST , , , , , , , , , , , , , | 70 | KC_BL_S,KC_RST ,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,_______, |
| 89 | //`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----' | 71 | //`----+----+----+--+-+----+----+----/ \----+----+----+----+----+----+----' |
| 90 | , , , , , | 72 | _______,_______,_______, _______,_______, _______ |
| 91 | // `----+----+----' `----+----+----' | 73 | // `----+----+----' `----+----+----' |
| 92 | ) | 74 | ) |
| 93 | 75 | ||
| 94 | }; | 76 | }; |
| 95 | 77 | ||
| 96 | void keyboard_pre_init_user(void) { | 78 | void suspend_power_down_keymap(void){ |
| 97 | // Make sure the red LEDs don't light | ||
| 98 | setPinOutput(D5); | ||
| 99 | writePinHigh(D5); | ||
| 100 | |||
| 101 | setPinOutput(B0); | ||
| 102 | writePinHigh(B0); | ||
| 103 | } | ||
| 104 | |||
| 105 | void keyboard_post_init_user(void){ | ||
| 106 | rgblight_enable_noeeprom(); // enable the RGBs | ||
| 107 | rgblight_sethsv_noeeprom_red(); // set to red | ||
| 108 | rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING + 3); // set to breathing | ||
| 109 | } | ||
| 110 | |||
| 111 | void suspend_power_down_user(void){ | ||
| 112 | backlight_config.enable = false; // disable LED backlight | 79 | backlight_config.enable = false; // disable LED backlight |
| 113 | } | 80 | } |
| 114 | 81 | ||
| 115 | void suspend_wakeup_init_user(void){ | 82 | void suspend_wakeup_init_keymap(void){ |
| 116 | backlight_config.enable = true; // enable LED backlight | 83 | backlight_config.enable = true; // enable LED backlight |
| 117 | } | 84 | } |
| 118 | |||
| 119 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 120 | switch (keycode) { | ||
| 121 | case QWERTY: | ||
| 122 | if (record->event.pressed) { | ||
| 123 | set_single_persistent_default_layer(_QWERTY); | ||
| 124 | } | ||
| 125 | return false; | ||
| 126 | break; | ||
| 127 | case LOWER: | ||
| 128 | if (record->event.pressed) { | ||
| 129 | layer_on(_LOWER); | ||
| 130 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 131 | } else { | ||
| 132 | layer_off(_LOWER); | ||
| 133 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 134 | } | ||
| 135 | return false; | ||
| 136 | break; | ||
| 137 | case RAISE: | ||
| 138 | if (record->event.pressed) { | ||
| 139 | layer_on(_RAISE); | ||
| 140 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 141 | } else { | ||
| 142 | layer_off(_RAISE); | ||
| 143 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 144 | } | ||
| 145 | return false; | ||
| 146 | break; | ||
| 147 | case ADJUST: | ||
| 148 | if (record->event.pressed) { | ||
| 149 | layer_on(_ADJUST); | ||
| 150 | } else { | ||
| 151 | layer_off(_ADJUST); | ||
| 152 | } | ||
| 153 | return false; | ||
| 154 | break; | ||
| 155 | } | ||
| 156 | return true; | ||
| 157 | } | ||
| 158 | |||
| 159 | uint32_t layer_state_set_user(uint32_t state){ | ||
| 160 | switch(biton32(state)) { | ||
| 161 | case _QWERTY: | ||
| 162 | rgblight_sethsv_noeeprom(HSV_RED); | ||
| 163 | break; | ||
| 164 | case _LOWER: | ||
| 165 | rgblight_sethsv_noeeprom(HSV_GREEN); | ||
| 166 | break; | ||
| 167 | case _RAISE: | ||
| 168 | rgblight_sethsv_noeeprom(HSV_BLUE); | ||
| 169 | break; | ||
| 170 | case _ADJUST: | ||
| 171 | rgblight_sethsv_noeeprom(HSV_ORANGE); | ||
| 172 | break; | ||
| 173 | default: | ||
| 174 | rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_GRADIENT + 3); | ||
| 175 | break; | ||
| 176 | |||
| 177 | } | ||
| 178 | return state; | ||
| 179 | } | ||
diff --git a/keyboards/keebio/iris/keymaps/sethBarberee/rules.mk b/keyboards/keebio/iris/keymaps/sethBarberee/rules.mk index 5df198b7b..b282b1aa4 100644 --- a/keyboards/keebio/iris/keymaps/sethBarberee/rules.mk +++ b/keyboards/keebio/iris/keymaps/sethBarberee/rules.mk | |||
| @@ -1,9 +1,5 @@ | |||
| 1 | BOOTMAGIC_ENABLE = no | ||
| 2 | CONSOLE_ENABLE = no | 1 | CONSOLE_ENABLE = no |
| 3 | EXTRAKEY_ENABLE = yes # Audio control and System control(+450) | 2 | NKRO_ENABLE = yes |
| 4 | NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
| 5 | BACKLIGHT_ENABLE = yes # Enable my Red LEDS | ||
| 6 | RGBLIGHT_ENABLE = yes # Enable my RGBS | ||
| 7 | VELOCIKEY_ENABLE = yes # I like RGB | 3 | VELOCIKEY_ENABLE = yes # I like RGB |
| 8 | TAP_DANCE_ENABLE = yes # fancy fancy Caps | 4 | TAP_DANCE_ENABLE = yes # fancy fancy Caps |
| 9 | LTO_ENABLE = yes # Enable link time optimization | 5 | LTO_ENABLE = yes # Enable link time optimization |
diff --git a/keyboards/keebio/sinc/keymaps/sethBarberee/config.h b/keyboards/keebio/sinc/keymaps/sethBarberee/config.h new file mode 100644 index 000000000..2d66aefc3 --- /dev/null +++ b/keyboards/keebio/sinc/keymaps/sethBarberee/config.h | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2017 Danny Nguyen <danny@keeb.io> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #pragma once | ||
| 19 | |||
| 20 | /* Use I2C or Serial, not both */ | ||
| 21 | // | ||
| 22 | //#define USE_SERIAL | ||
| 23 | //#define USE_I2C | ||
| 24 | |||
| 25 | //#ifdef RGBLIGHT_ENABLE | ||
| 26 | //# ifdef NORMAL_MODE | ||
| 27 | //# undef NORMAL_MODE | ||
| 28 | //# define NORMAL_MODE RGBLIGHT_MODE_TWINKLE + 4 | ||
| 29 | //# endif | ||
| 30 | //#endif | ||
diff --git a/keyboards/keebio/sinc/keymaps/sethBarberee/keymap.c b/keyboards/keebio/sinc/keymaps/sethBarberee/keymap.c new file mode 100644 index 000000000..3d55f2c09 --- /dev/null +++ b/keyboards/keebio/sinc/keymaps/sethBarberee/keymap.c | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | /* Copyright 2021 SethBarberee <seth.barberee@gmail.com> | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | #include "sethBarberee.h" | ||
| 17 | |||
| 18 | #define LAYOUT_80_with_macro_wrapper(...) LAYOUT_80_with_macro(__VA_ARGS__) | ||
| 19 | |||
| 20 | |||
| 21 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 22 | [_QWERTY] = LAYOUT_80_with_macro_wrapper( | ||
| 23 | KC_MUTE, KC_ECAP, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, KC_F11, KC_F12, KC_DEL, KC_MUTE, | ||
| 24 | KC_F1, KC_F2, KC_GRV, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________,KC_MINS, KC_EQL, _______, KC_BSPC, KC_HOME, | ||
| 25 | KC_F3, KC_F4, KC_TAB, _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, KC_LBRC, KC_RBRC, KC_BSLS, KC_END, | ||
| 26 | KC_F5, KC_F6, KC_LSFT, _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, KC_ENT, KC_PGUP, | ||
| 27 | KC_F7, KC_F8, KC_LSFT, _________________QWERTY_L3_________________, _________________QWERTY_R3_________________, KC_RSFT, KC_UP, KC_PGDN, | ||
| 28 | KC_F9, KC_F10, KC_LCTL, KC_LALT, KC_LGUI, KC_LOWR, _______, KC_SPC, KC_RASE, KC_BSPC, KC_RALT, KC_RCTL, KC_RGUI, KC_LEFT, KC_DOWN, KC_RGHT | ||
| 29 | ), | ||
| 30 | [_LOWER] = LAYOUT_80_with_macro_wrapper( | ||
| 31 | RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, | ||
| 32 | RGB_HUI, RGB_HUD, KC_GESC, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, KC_F11, KC_F12, _______, _______, KC_MPRV, | ||
| 33 | RGB_SAI, RGB_SAD, RGB_TOG, _______, _______, _______, _______, KC_LPRN, KC_RPRN, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, | ||
| 34 | RGB_VAI, RGB_VAD, _______, _______, _______, _______, _______, KC_LCBR, KC_RCBR, _______, _______, _______, _______, _______, _______, KC_VOLU, | ||
| 35 | RGB_MOD, RGB_RMOD, _______, _______, _______, _______, _______, KC_LBRC, KC_RBRC, _______, _______, _______, _______, _______, _______, KC_VOLD, | ||
| 36 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ | ||
| 37 | ), | ||
| 38 | |||
| 39 | [_RAISE] = LAYOUT_80_with_macro_wrapper( | ||
| 40 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 41 | RESET, KC_VRSN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 42 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 43 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 44 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 45 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ | ||
| 46 | ), | ||
| 47 | [_ADJUST] = LAYOUT_80_with_macro_wrapper( | ||
| 48 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 49 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 50 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 51 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 52 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 53 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ | ||
| 54 | ), | ||
| 55 | }; | ||
| 56 | |||
| 57 | void encoder_update_user(uint8_t index, bool clockwise) { | ||
| 58 | if (index == 0) { | ||
| 59 | if (clockwise) { | ||
| 60 | tap_code(KC_PGDN); | ||
| 61 | } else { | ||
| 62 | tap_code(KC_PGUP); | ||
| 63 | } | ||
| 64 | } else if (index == 1) { | ||
| 65 | if (clockwise) { | ||
| 66 | tap_code(KC_VOLU); | ||
| 67 | } else { | ||
| 68 | tap_code(KC_VOLD); | ||
| 69 | } | ||
| 70 | } | ||
| 71 | } | ||
diff --git a/keyboards/keebio/sinc/keymaps/sethBarberee/rules.mk b/keyboards/keebio/sinc/keymaps/sethBarberee/rules.mk new file mode 100644 index 000000000..049c5ae9b --- /dev/null +++ b/keyboards/keebio/sinc/keymaps/sethBarberee/rules.mk | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | BACKLIGHT_ENABLE=no | ||
| 2 | CONSOLE_ENABLE=no | ||
| 3 | TAP_DANCE_ENABLE=yes | ||
diff --git a/keyboards/wilba_tech/zeal60/keymaps/sethBarberee/rules.mk b/keyboards/wilba_tech/zeal60/keymaps/sethBarberee/rules.mk index fcf3767e1..21b93c595 100644 --- a/keyboards/wilba_tech/zeal60/keymaps/sethBarberee/rules.mk +++ b/keyboards/wilba_tech/zeal60/keymaps/sethBarberee/rules.mk | |||
| @@ -1 +1,2 @@ | |||
| 1 | BOOTMAGIC_ENABLE = lite | 1 | BOOTMAGIC_ENABLE = lite |
| 2 | VIA_ENABLE = yes | ||
diff --git a/users/sethBarberee/config.h b/users/sethBarberee/config.h index a849ac0e7..785c7bc88 100644 --- a/users/sethBarberee/config.h +++ b/users/sethBarberee/config.h | |||
| @@ -1,8 +1,69 @@ | |||
| 1 | /* Copyright 2021 SethBarberee <seth.barberee@gmail.com> | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | #pragma once | ||
| 17 | |||
| 1 | #ifdef RGBLIGHT_ENABLE | 18 | #ifdef RGBLIGHT_ENABLE |
| 2 | # ifndef CAPS_LOCK_MODE | 19 | # define RGBLIGHT_SLEEP |
| 3 | # define CAPS_LOCK_MODE 1 | 20 | # ifndef RGBLIGHT_HUE_STEP |
| 21 | # define RGBLIGHT_HUE_STEP 8 | ||
| 22 | #endif | ||
| 23 | # ifndef RGBLIGHT_SAT_STEPT | ||
| 24 | # define RGBLIGHT_SAT_STEP 8 | ||
| 25 | #endif | ||
| 26 | # ifndef RGBLIGHT_VAL_STEP | ||
| 27 | # define RGBLIGHT_VAL_STEP 8 | ||
| 28 | #endif | ||
| 29 | // Trim animations I don't use/like | ||
| 30 | # ifdef RGBLIGHT_ANIMATIONS | ||
| 31 | # undef RGBLIGHT_ANIMATIONS | ||
| 4 | # endif | 32 | # endif |
| 5 | # ifndef NORMAL_MODE | 33 | # define RGBLIGHT_EFFECT_BREATHING |
| 6 | # define NORMAL_MODE 4 | 34 | # define RGBLIGHT_EFFECT_STATIC_GRADIENT |
| 35 | # define RGBLIGHT_EFFECT_TWINKLE | ||
| 36 | # ifndef CAPS_LOCK_MODE | ||
| 37 | # define CAPS_LOCK_MODE RGBLIGHT_MODE_STATIC_LIGHT | ||
| 7 | # endif | 38 | # endif |
| 39 | #endif // RGBLIGHT_ENABLE | ||
| 40 | |||
| 41 | #ifndef AUDIO_ENABLE | ||
| 42 | # define NO_MUSIC_MODE | ||
| 43 | #endif // AUDIO_ENABLE | ||
| 44 | |||
| 45 | #define FORCE_NKRO // Force NKRO on by default | ||
| 46 | |||
| 47 | // Totally taken from @drashna's userspace | ||
| 48 | #ifdef TAPPING_TERM | ||
| 49 | # undef TAPPING_TERM | ||
| 50 | #endif // TAPPING_TERM | ||
| 51 | // | ||
| 52 | // Keeping these commented for examples when I want to tweak per keyboard | ||
| 53 | // but setting a default across my boards for now | ||
| 54 | // | ||
| 55 | //#if defined(KEYBOARD_ergodox_ez) | ||
| 56 | //# define TAPPING_TERM 185 | ||
| 57 | #if defined(KEYBOARD_crkbd) | ||
| 58 | # define TAPPING_TERM 185 | ||
| 59 | #else | ||
| 60 | # define TAPPING_TERM 200 | ||
| 61 | #endif | ||
| 62 | |||
| 63 | /* Disable unused and unneeded features to reduce on firmware size */ | ||
| 64 | #ifdef LOCKING_SUPPORT_ENABLE | ||
| 65 | # undef LOCKING_SUPPORT_ENABLE | ||
| 66 | #endif | ||
| 67 | #ifdef LOCKING_RESYNC_ENABLE | ||
| 68 | # undef LOCKING_RESYNC_ENABLE | ||
| 8 | #endif | 69 | #endif |
diff --git a/users/sethBarberee/rgb_light.c b/users/sethBarberee/rgb_light.c new file mode 100644 index 000000000..51cc938c5 --- /dev/null +++ b/users/sethBarberee/rgb_light.c | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | /* Copyright 2021 SethBarberee <seth.barberee@gmail.com> | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | #include "rgb_light.h" | ||
| 17 | |||
| 18 | #if defined(RGBLIGHT_ENABLE) | ||
| 19 | layer_state_t layer_state_set_rgb_light(layer_state_t state){ | ||
| 20 | switch(get_highest_layer(state)) { | ||
| 21 | case _QWERTY: | ||
| 22 | rgblight_set_hsv_and_mode(HSV_RED, RGBLIGHT_MODE_BREATHING + 3); | ||
| 23 | break; | ||
| 24 | case _LOWER: | ||
| 25 | rgblight_set_hsv_and_mode(HSV_GREEN, RGBLIGHT_MODE_BREATHING + 3); | ||
| 26 | break; | ||
| 27 | case _RAISE: | ||
| 28 | rgblight_set_hsv_and_mode(HSV_BLUE, RGBLIGHT_MODE_BREATHING + 3); | ||
| 29 | break; | ||
| 30 | case _ADJUST: | ||
| 31 | rgblight_set_hsv_and_mode(HSV_GOLDENROD, RGBLIGHT_MODE_BREATHING + 3); | ||
| 32 | break; | ||
| 33 | default: | ||
| 34 | rgblight_set_hsv_and_mode(HSV_PINK, RGBLIGHT_MODE_TWINKLE + 3); | ||
| 35 | break; | ||
| 36 | |||
| 37 | } | ||
| 38 | return state; | ||
| 39 | } | ||
| 40 | |||
| 41 | void rgblight_set_hsv_and_mode(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode) { | ||
| 42 | rgblight_sethsv_noeeprom(hue, sat, val); | ||
| 43 | // wait_us(175); // Add a slight delay between color and mode to ensure it's processed correctly | ||
| 44 | rgblight_mode_noeeprom(mode); | ||
| 45 | } | ||
| 46 | |||
| 47 | void keyboard_post_init_rgb_light(void) | ||
| 48 | { | ||
| 49 | layer_state_set_rgb_light(layer_state); | ||
| 50 | } | ||
| 51 | #endif | ||
| 52 | |||
diff --git a/users/sethBarberee/rgb_light.h b/users/sethBarberee/rgb_light.h new file mode 100644 index 000000000..2e0477ce5 --- /dev/null +++ b/users/sethBarberee/rgb_light.h | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | /* Copyright 2021 SethBarberee <seth.barberee@gmail.com> | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | #pragma once | ||
| 17 | #include "sethBarberee.h" | ||
| 18 | |||
| 19 | layer_state_t layer_state_set_rgb_light(layer_state_t state); | ||
| 20 | void keyboard_post_init_rgb_light(void); | ||
| 21 | void rgblight_set_hsv_and_mode(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode); | ||
diff --git a/users/sethBarberee/rules.mk b/users/sethBarberee/rules.mk index d8aef6052..f1bc3325f 100644 --- a/users/sethBarberee/rules.mk +++ b/users/sethBarberee/rules.mk | |||
| @@ -1 +1,10 @@ | |||
| 1 | SRC += sethBarberee.c | 1 | SRC += sethBarberee.c |
| 2 | |||
| 3 | # Add in custom tap dances when tap dance is enabled | ||
| 4 | ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) | ||
| 5 | SRC += tap_dance.c | ||
| 6 | endif | ||
| 7 | |||
| 8 | ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) | ||
| 9 | SRC += rgb_light.c | ||
| 10 | endif | ||
diff --git a/users/sethBarberee/sethBarberee.c b/users/sethBarberee/sethBarberee.c index 10f78f63b..536f3f921 100644 --- a/users/sethBarberee/sethBarberee.c +++ b/users/sethBarberee/sethBarberee.c | |||
| @@ -1,45 +1,85 @@ | |||
| 1 | /* Copyright 2021 SethBarberee <seth.barberee@gmail.com> | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 1 | #include "sethBarberee.h" | 16 | #include "sethBarberee.h" |
| 2 | #ifdef RGBLIGHT_ENABLE | 17 | #include "version.h" |
| 3 | #ifdef TAP_DANCE_ENABLE | 18 | |
| 4 | 19 | __attribute__ ((weak)) void keyboard_pre_init_keymap(void) {} | |
| 5 | // Initialize it now | 20 | |
| 6 | tap caps_status = { | 21 | void keyboard_pre_init_user(void){ |
| 7 | .toggled = false, | 22 | #if defined(BOOTLOADER_CATERINA) |
| 8 | .toggle_mode = CAPS_LOCK_MODE, | 23 | // Make sure the red LEDs don't light |
| 9 | .normal_mode = NORMAL_MODE | 24 | setPinOutput(D5); |
| 10 | }; | 25 | writePinHigh(D5); |
| 11 | 26 | ||
| 12 | void dance_ecap_finished (qk_tap_dance_state_t *state, void *user_data){ | 27 | setPinOutput(B0); |
| 13 | if(state->count == 1){ | 28 | writePinHigh(B0); |
| 14 | register_code(KC_ESC); | 29 | #endif |
| 15 | } else { | 30 | keyboard_pre_init_keymap(); |
| 16 | register_code(KC_CAPS); | ||
| 17 | if(!caps_status.toggled){ | ||
| 18 | // Toggling caps so indicate | ||
| 19 | caps_status.toggled = true; | ||
| 20 | rgblight_mode_noeeprom(caps_status.toggle_mode); | ||
| 21 | } else { | ||
| 22 | // Turning off so return to normal mode | ||
| 23 | caps_status.toggled = false; | ||
| 24 | rgblight_mode_noeeprom(caps_status.normal_mode); | ||
| 25 | } | ||
| 26 | } | ||
| 27 | } | 31 | } |
| 28 | 32 | ||
| 29 | void dance_ecap_reset (qk_tap_dance_state_t *state, void *user_data){ | 33 | __attribute__ ((weak)) layer_state_t layer_state_set_keymap (layer_state_t state) { return state; } |
| 30 | if(state->count == 1){ | 34 | |
| 31 | unregister_code(KC_ESC); | 35 | layer_state_t layer_state_set_user(layer_state_t state){ |
| 32 | } else { | 36 | |
| 33 | unregister_code(KC_CAPS); | 37 | if (!is_keyboard_master()) { |
| 38 | return state; | ||
| 34 | } | 39 | } |
| 40 | |||
| 41 | state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST); | ||
| 42 | #if defined(RGBLIGHT_ENABLE) | ||
| 43 | state = layer_state_set_rgb_light(state); | ||
| 44 | #endif | ||
| 45 | return layer_state_set_keymap(state); | ||
| 35 | } | 46 | } |
| 36 | 47 | ||
| 37 | //Tap Dance Definitions | 48 | __attribute__ ((weak)) void keyboard_post_init_keymap(void) {} |
| 38 | qk_tap_dance_action_t tap_dance_actions[] = { | ||
| 39 | //Tap once for Esc, twice for Caps Lock | ||
| 40 | [TD_ECAP] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_ecap_finished, dance_ecap_reset), | ||
| 41 | // Other declarations would go here, separated by commas, if you have them | ||
| 42 | }; | ||
| 43 | 49 | ||
| 50 | void keyboard_post_init_user(void) | ||
| 51 | { | ||
| 52 | #if defined(RGBLIGHT_ENABLE) | ||
| 53 | keyboard_post_init_rgb_light(); | ||
| 44 | #endif | 54 | #endif |
| 55 | keyboard_post_init_keymap(); | ||
| 56 | } | ||
| 57 | |||
| 58 | __attribute__((weak)) void suspend_power_down_keymap(void) {} | ||
| 59 | |||
| 60 | void suspend_power_down_user(void) { | ||
| 61 | #ifdef OLED_DRIVER_ENABLE | ||
| 62 | oled_off(); | ||
| 45 | #endif | 63 | #endif |
| 64 | suspend_power_down_keymap(); | ||
| 65 | } | ||
| 66 | |||
| 67 | __attribute__((weak)) void suspend_wakeup_init_keymap(void) {} | ||
| 68 | |||
| 69 | void suspend_wakeup_init_user(void) { suspend_wakeup_init_keymap(); } | ||
| 70 | |||
| 71 | __attribute__ ((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true;} | ||
| 72 | |||
| 73 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 74 | if (process_record_keymap(keycode, record)) | ||
| 75 | { | ||
| 76 | switch (keycode) { | ||
| 77 | case KC_VRSN: // Prints firmware version | ||
| 78 | if (record->event.pressed) { | ||
| 79 | SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE); | ||
| 80 | } | ||
| 81 | break; | ||
| 82 | } | ||
| 83 | } | ||
| 84 | return true; | ||
| 85 | } | ||
diff --git a/users/sethBarberee/sethBarberee.h b/users/sethBarberee/sethBarberee.h index 23774ba4e..1da79e1a6 100644 --- a/users/sethBarberee/sethBarberee.h +++ b/users/sethBarberee/sethBarberee.h | |||
| @@ -1,20 +1,50 @@ | |||
| 1 | #ifndef USERSPACE | 1 | /* Copyright 2021 SethBarberee <seth.barberee@gmail.com> |
| 2 | #define USERSPACE | 2 | * |
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | #pragma once | ||
| 3 | 17 | ||
| 4 | #include "quantum.h" | 18 | #include QMK_KEYBOARD_H |
| 5 | 19 | ||
| 6 | #ifdef TAP_DANCE_ENABLE // only enable for tap dances | 20 | #include "wrappers.h" |
| 7 | enum { | ||
| 8 | TD_ECAP = 0, | ||
| 9 | }; | ||
| 10 | 21 | ||
| 11 | #define KC_ECAP TD(TD_ECAP) | 22 | enum layers { |
| 23 | _QWERTY, | ||
| 24 | _LOWER, | ||
| 25 | _RAISE, | ||
| 26 | _ADJUST | ||
| 27 | }; | ||
| 12 | 28 | ||
| 13 | typedef struct { | 29 | enum userspace_keycodes { |
| 14 | bool toggled; // store whether we have toggled caps lock | 30 | KC_VRSN = SAFE_RANGE, |
| 15 | int toggle_mode; // idk why but maybe do something with this.. | 31 | NEW_SAFE_RANGE |
| 16 | int normal_mode; | 32 | }; |
| 17 | } tap; | 33 | |
| 34 | #define KC_LOWR MO(_LOWER) | ||
| 35 | #define KC_RASE MO(_RAISE) | ||
| 36 | |||
| 37 | #ifdef TAP_DANCE_ENABLE | ||
| 38 | # include "tap_dance.h" | ||
| 18 | #endif | 39 | #endif |
| 19 | 40 | ||
| 41 | #ifdef RGBLIGHT_ENABLE | ||
| 42 | # include "rgb_light.h" | ||
| 20 | #endif | 43 | #endif |
| 44 | |||
| 45 | void keyboard_pre_init_keymap(void); | ||
| 46 | void keyboard_post_init_keymap(void); | ||
| 47 | void suspend_power_down_keymap(void); | ||
| 48 | void suspend_wakeup_init_keymap(void); | ||
| 49 | layer_state_t layer_state_set_keymap (layer_state_t state); | ||
| 50 | bool process_record_keymap(uint16_t keycode, keyrecord_t *record); | ||
diff --git a/users/sethBarberee/tap_dance.c b/users/sethBarberee/tap_dance.c new file mode 100644 index 000000000..588ac9be6 --- /dev/null +++ b/users/sethBarberee/tap_dance.c | |||
| @@ -0,0 +1,89 @@ | |||
| 1 | /* Copyright 2021 SethBarberee <seth.barberee@gmail.com> | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | #include "tap_dance.h" | ||
| 17 | |||
| 18 | // Shamelessly stolen from QMK Docs | ||
| 19 | int cur_dance (qk_tap_dance_state_t *state) { | ||
| 20 | if (state->count == 1) { | ||
| 21 | if (state->interrupted || !state->pressed) { | ||
| 22 | return SINGLE_TAP; | ||
| 23 | } else { | ||
| 24 | return SINGLE_HOLD; | ||
| 25 | } | ||
| 26 | } | ||
| 27 | else if (state->count == 2) { | ||
| 28 | if (state->interrupted) return DOUBLE_SINGLE_TAP; | ||
| 29 | else if (state->pressed) return DOUBLE_HOLD; | ||
| 30 | else return DOUBLE_TAP; | ||
| 31 | } | ||
| 32 | if (state->count == 3) { | ||
| 33 | if (state->interrupted || !state->pressed) return TRIPLE_TAP; | ||
| 34 | else return TRIPLE_HOLD; | ||
| 35 | } | ||
| 36 | else return 8; | ||
| 37 | } | ||
| 38 | |||
| 39 | |||
| 40 | // Initialize it now | ||
| 41 | tap caps_status = { | ||
| 42 | .toggled = false, | ||
| 43 | .state = 0 | ||
| 44 | }; | ||
| 45 | |||
| 46 | |||
| 47 | void dance_ecap_finished (qk_tap_dance_state_t *state, void *user_data){ | ||
| 48 | caps_status.state = cur_dance(state); | ||
| 49 | switch(caps_status.state){ | ||
| 50 | case SINGLE_TAP: | ||
| 51 | tap_code(KC_ESC); | ||
| 52 | break; | ||
| 53 | case SINGLE_HOLD: | ||
| 54 | register_code(KC_LCTRL); | ||
| 55 | break; | ||
| 56 | case DOUBLE_TAP: | ||
| 57 | tap_code(KC_CAPS); | ||
| 58 | if(!caps_status.toggled){ | ||
| 59 | // Toggling caps so indicate | ||
| 60 | caps_status.toggled = true; | ||
| 61 | #ifdef RGBLIGHT_ENABLE | ||
| 62 | // Save mode we can from | ||
| 63 | caps_status.normal_mode = rgblight_get_mode(); | ||
| 64 | rgblight_mode_noeeprom(CAPS_LOCK_MODE); | ||
| 65 | #endif | ||
| 66 | } else { | ||
| 67 | // Turning off so return to normal mode | ||
| 68 | caps_status.toggled = false; | ||
| 69 | #ifdef RGBLIGHT_ENABLE | ||
| 70 | rgblight_mode_noeeprom(caps_status.normal_mode); | ||
| 71 | #endif | ||
| 72 | } | ||
| 73 | break; | ||
| 74 | } | ||
| 75 | } | ||
| 76 | |||
| 77 | void dance_ecap_reset (qk_tap_dance_state_t *state, void *user_data){ | ||
| 78 | if(caps_status.state == SINGLE_HOLD){ | ||
| 79 | unregister_code(KC_LCTRL); | ||
| 80 | } | ||
| 81 | caps_status.state = 0; | ||
| 82 | } | ||
| 83 | |||
| 84 | //Tap Dance Definitions | ||
| 85 | qk_tap_dance_action_t tap_dance_actions[] = { | ||
| 86 | //Tap once for Esc, twice for Caps Lock | ||
| 87 | [TD_ECAP] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_ecap_finished, dance_ecap_reset), | ||
| 88 | // Other declarations would go here, separated by commas, if you have them | ||
| 89 | }; | ||
diff --git a/users/sethBarberee/tap_dance.h b/users/sethBarberee/tap_dance.h new file mode 100644 index 000000000..709185b39 --- /dev/null +++ b/users/sethBarberee/tap_dance.h | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | /* Copyright 2021 SethBarberee <seth.barberee@gmail.com> | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | #pragma once | ||
| 17 | #include "sethBarberee.h" | ||
| 18 | |||
| 19 | //Define a type for as many tap dance states as you need | ||
| 20 | enum { | ||
| 21 | SINGLE_TAP = 1, | ||
| 22 | SINGLE_HOLD = 2, | ||
| 23 | DOUBLE_TAP = 3, | ||
| 24 | DOUBLE_HOLD = 4, | ||
| 25 | DOUBLE_SINGLE_TAP = 5, //send two single taps | ||
| 26 | TRIPLE_TAP = 6, | ||
| 27 | TRIPLE_HOLD = 7 | ||
| 28 | }; | ||
| 29 | |||
| 30 | |||
| 31 | enum { | ||
| 32 | TD_ECAP = 0, | ||
| 33 | }; | ||
| 34 | |||
| 35 | #define KC_ECAP TD(TD_ECAP) | ||
| 36 | |||
| 37 | typedef struct { | ||
| 38 | bool toggled; // store whether we have toggled caps lock | ||
| 39 | #ifdef RGBLIGHT_ENABLE | ||
| 40 | int normal_mode; | ||
| 41 | #endif // RGBLIGHT_ENABLE | ||
| 42 | int state; | ||
| 43 | } tap; | ||
diff --git a/users/sethBarberee/wrappers.h b/users/sethBarberee/wrappers.h new file mode 100644 index 000000000..b24f52b33 --- /dev/null +++ b/users/sethBarberee/wrappers.h | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | /* Copyright 2021 SethBarberee <seth.barberee@gmail.com> | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | #pragma once | ||
| 17 | |||
| 18 | #include "sethBarberee.h" | ||
| 19 | |||
| 20 | /* | ||
| 21 | Since our quirky block definitions are basically a list of comma separated | ||
| 22 | arguments, we need a wrapper in order for these definitions to be | ||
| 23 | expanded before being used as arguments to the LAYOUT_xxx macro. | ||
| 24 | */ | ||
| 25 | |||
| 26 | /* | ||
| 27 | Blocks for each of the four major keyboard layouts | ||
| 28 | Organized so we can quickly adapt and modify all of them | ||
| 29 | at once, rather than for each keyboard, one at a time. | ||
| 30 | And this allows for much cleaner blocks in the keymaps. | ||
| 31 | For instance Tap/Hold for Control on all of the layouts | ||
| 32 | |||
| 33 | NOTE: These are all the same length. If you do a search/replace | ||
| 34 | then you need to add/remove underscores to keep the | ||
| 35 | lengths consistent. | ||
| 36 | */ | ||
| 37 | |||
| 38 | // clang-format off | ||
| 39 | #define _________________QWERTY_L1_________________ KC_Q, KC_W, KC_E, KC_R, KC_T | ||
| 40 | #define _________________QWERTY_L2_________________ KC_A, KC_S, KC_D, KC_F, KC_G | ||
| 41 | #define _________________QWERTY_L3_________________ KC_Z, KC_X, KC_C, KC_V, KC_B | ||
| 42 | |||
| 43 | #define _________________QWERTY_R1_________________ KC_Y, KC_U, KC_I, KC_O, KC_P | ||
| 44 | #define _________________QWERTY_R2_________________ KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT | ||
| 45 | #define _________________QWERTY_R3_________________ KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH | ||
| 46 | |||
| 47 | #define ________________NUMBER_LEFT________________ KC_1, KC_2, KC_3, KC_4, KC_5 | ||
| 48 | #define ________________NUMBER_RIGHT_______________ KC_6, KC_7, KC_8, KC_9, KC_0 | ||
| 49 | #define _________________FUNC_LEFT_________________ KC_F1, KC_F2, KC_F3, KC_F4, KC_F5 | ||
| 50 | #define _________________FUNC_RIGHT________________ KC_F6, KC_F7, KC_F8, KC_F9, KC_F10 | ||
| 51 | |||
| 52 | #define ___________________BLANK___________________ _______, _______, _______, _______, _______ | ||
| 53 | |||
| 54 | // clang-format on | ||
| 55 | |||
