aboutsummaryrefslogtreecommitdiff
path: root/users
diff options
context:
space:
mode:
authorSeth Barberee <seth.barberee@gmail.com>2021-05-08 10:26:51 -0700
committerGitHub <noreply@github.com>2021-05-08 10:26:51 -0700
commitb7fe24923e29218b15233163d9fe0ac5f332d3fc (patch)
tree442ad0be96649a8031e12be9006d6e307ec2f98a /users
parent067a6f017477938f965b1c4af4dace288d906730 (diff)
downloadqmk_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
Diffstat (limited to 'users')
-rw-r--r--users/sethBarberee/config.h69
-rw-r--r--users/sethBarberee/rgb_light.c52
-rw-r--r--users/sethBarberee/rgb_light.h21
-rw-r--r--users/sethBarberee/rules.mk9
-rw-r--r--users/sethBarberee/sethBarberee.c112
-rw-r--r--users/sethBarberee/sethBarberee.h56
-rw-r--r--users/sethBarberee/tap_dance.c89
-rw-r--r--users/sethBarberee/tap_dance.h43
-rw-r--r--users/sethBarberee/wrappers.h55
9 files changed, 453 insertions, 53 deletions
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)
19layer_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
41void 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
47void 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
19layer_state_t layer_state_set_rgb_light(layer_state_t state);
20void keyboard_post_init_rgb_light(void);
21void 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 @@
1SRC += sethBarberee.c 1SRC += sethBarberee.c
2
3# Add in custom tap dances when tap dance is enabled
4ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
5 SRC += tap_dance.c
6endif
7
8ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
9 SRC += rgb_light.c
10endif
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
6tap caps_status = { 21void 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
12void 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
29void 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); 35layer_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) {}
38qk_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
50void 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
60void 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
69void 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
73bool 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) 22enum layers {
23 _QWERTY,
24 _LOWER,
25 _RAISE,
26 _ADJUST
27};
12 28
13 typedef struct { 29enum 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
45void keyboard_pre_init_keymap(void);
46void keyboard_post_init_keymap(void);
47void suspend_power_down_keymap(void);
48void suspend_wakeup_init_keymap(void);
49layer_state_t layer_state_set_keymap (layer_state_t state);
50bool 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
19int 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
41tap caps_status = {
42 .toggled = false,
43 .state = 0
44};
45
46
47void 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
77void 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
85qk_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
20enum {
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
31enum {
32 TD_ECAP = 0,
33};
34
35#define KC_ECAP TD(TD_ECAP)
36
37typedef 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