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 mapspython_optimizations
parent
067a6f0174
commit
b7fe24923e
@ -1,9 +1,5 @@ |
|||||||
BOOTMAGIC_ENABLE = no
|
|
||||||
CONSOLE_ENABLE = no
|
CONSOLE_ENABLE = no
|
||||||
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
NKRO_ENABLE = yes
|
||||||
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
|
||||||
BACKLIGHT_ENABLE = yes # Enable my Red LEDS
|
|
||||||
RGBLIGHT_ENABLE = yes # Enable my RGBS
|
|
||||||
VELOCIKEY_ENABLE = yes # I like RGB
|
VELOCIKEY_ENABLE = yes # I like RGB
|
||||||
TAP_DANCE_ENABLE = yes # fancy fancy Caps
|
TAP_DANCE_ENABLE = yes # fancy fancy Caps
|
||||||
LTO_ENABLE = yes # Enable link time optimization
|
LTO_ENABLE = yes # Enable link time optimization
|
||||||
|
@ -0,0 +1,30 @@ |
|||||||
|
/*
|
||||||
|
Copyright 2017 Danny Nguyen <danny@keeb.io> |
||||||
|
|
||||||
|
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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/ |
||||||
|
|
||||||
|
#pragma once |
||||||
|
|
||||||
|
/* Use I2C or Serial, not both */ |
||||||
|
//
|
||||||
|
//#define USE_SERIAL
|
||||||
|
//#define USE_I2C
|
||||||
|
|
||||||
|
//#ifdef RGBLIGHT_ENABLE
|
||||||
|
//# ifdef NORMAL_MODE
|
||||||
|
//# undef NORMAL_MODE
|
||||||
|
//# define NORMAL_MODE RGBLIGHT_MODE_TWINKLE + 4
|
||||||
|
//# endif
|
||||||
|
//#endif
|
@ -0,0 +1,71 @@ |
|||||||
|
/* Copyright 2021 SethBarberee <seth.barberee@gmail.com>
|
||||||
|
* |
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/ |
||||||
|
#include "sethBarberee.h" |
||||||
|
|
||||||
|
#define LAYOUT_80_with_macro_wrapper(...) LAYOUT_80_with_macro(__VA_ARGS__) |
||||||
|
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
||||||
|
[_QWERTY] = LAYOUT_80_with_macro_wrapper( |
||||||
|
KC_MUTE, KC_ECAP, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, KC_F11, KC_F12, KC_DEL, KC_MUTE, |
||||||
|
KC_F1, KC_F2, KC_GRV, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________,KC_MINS, KC_EQL, _______, KC_BSPC, KC_HOME, |
||||||
|
KC_F3, KC_F4, KC_TAB, _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, KC_LBRC, KC_RBRC, KC_BSLS, KC_END, |
||||||
|
KC_F5, KC_F6, KC_LSFT, _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, KC_ENT, KC_PGUP, |
||||||
|
KC_F7, KC_F8, KC_LSFT, _________________QWERTY_L3_________________, _________________QWERTY_R3_________________, KC_RSFT, KC_UP, KC_PGDN, |
||||||
|
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 |
||||||
|
), |
||||||
|
[_LOWER] = LAYOUT_80_with_macro_wrapper( |
||||||
|
RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, |
||||||
|
RGB_HUI, RGB_HUD, KC_GESC, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, KC_F11, KC_F12, _______, _______, KC_MPRV, |
||||||
|
RGB_SAI, RGB_SAD, RGB_TOG, _______, _______, _______, _______, KC_LPRN, KC_RPRN, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, |
||||||
|
RGB_VAI, RGB_VAD, _______, _______, _______, _______, _______, KC_LCBR, KC_RCBR, _______, _______, _______, _______, _______, _______, KC_VOLU, |
||||||
|
RGB_MOD, RGB_RMOD, _______, _______, _______, _______, _______, KC_LBRC, KC_RBRC, _______, _______, _______, _______, _______, _______, KC_VOLD, |
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ |
||||||
|
), |
||||||
|
|
||||||
|
[_RAISE] = LAYOUT_80_with_macro_wrapper( |
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, |
||||||
|
RESET, KC_VRSN, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, |
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, |
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, |
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, |
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ |
||||||
|
), |
||||||
|
[_ADJUST] = LAYOUT_80_with_macro_wrapper( |
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, |
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, |
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, |
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, |
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, |
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ |
||||||
|
), |
||||||
|
}; |
||||||
|
|
||||||
|
void encoder_update_user(uint8_t index, bool clockwise) { |
||||||
|
if (index == 0) { |
||||||
|
if (clockwise) { |
||||||
|
tap_code(KC_PGDN); |
||||||
|
} else { |
||||||
|
tap_code(KC_PGUP); |
||||||
|
} |
||||||
|
} else if (index == 1) { |
||||||
|
if (clockwise) { |
||||||
|
tap_code(KC_VOLU); |
||||||
|
} else { |
||||||
|
tap_code(KC_VOLD); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,3 @@ |
|||||||
|
BACKLIGHT_ENABLE=no
|
||||||
|
CONSOLE_ENABLE=no
|
||||||
|
TAP_DANCE_ENABLE=yes
|
@ -1 +1,2 @@ |
|||||||
BOOTMAGIC_ENABLE = lite
|
BOOTMAGIC_ENABLE = lite
|
||||||
|
VIA_ENABLE = yes
|
||||||
|
@ -1,8 +1,69 @@ |
|||||||
|
/* Copyright 2021 SethBarberee <seth.barberee@gmail.com>
|
||||||
|
* |
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/ |
||||||
|
#pragma once |
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE |
#ifdef RGBLIGHT_ENABLE |
||||||
# ifndef CAPS_LOCK_MODE |
# define RGBLIGHT_SLEEP |
||||||
# define CAPS_LOCK_MODE 1 |
# ifndef RGBLIGHT_HUE_STEP |
||||||
|
# define RGBLIGHT_HUE_STEP 8 |
||||||
|
#endif |
||||||
|
# ifndef RGBLIGHT_SAT_STEPT |
||||||
|
# define RGBLIGHT_SAT_STEP 8 |
||||||
|
#endif |
||||||
|
# ifndef RGBLIGHT_VAL_STEP |
||||||
|
# define RGBLIGHT_VAL_STEP 8 |
||||||
|
#endif |
||||||
|
// Trim animations I don't use/like
|
||||||
|
# ifdef RGBLIGHT_ANIMATIONS |
||||||
|
# undef RGBLIGHT_ANIMATIONS |
||||||
# endif |
# endif |
||||||
# ifndef NORMAL_MODE |
# define RGBLIGHT_EFFECT_BREATHING |
||||||
# define NORMAL_MODE 4 |
# define RGBLIGHT_EFFECT_STATIC_GRADIENT |
||||||
|
# define RGBLIGHT_EFFECT_TWINKLE |
||||||
|
# ifndef CAPS_LOCK_MODE |
||||||
|
# define CAPS_LOCK_MODE RGBLIGHT_MODE_STATIC_LIGHT |
||||||
# endif |
# endif |
||||||
|
#endif // RGBLIGHT_ENABLE
|
||||||
|
|
||||||
|
#ifndef AUDIO_ENABLE |
||||||
|
# define NO_MUSIC_MODE |
||||||
|
#endif // AUDIO_ENABLE
|
||||||
|
|
||||||
|
#define FORCE_NKRO // Force NKRO on by default
|
||||||
|
|
||||||
|
// Totally taken from @drashna's userspace
|
||||||
|
#ifdef TAPPING_TERM |
||||||
|
# undef TAPPING_TERM |
||||||
|
#endif // TAPPING_TERM
|
||||||
|
//
|
||||||
|
// Keeping these commented for examples when I want to tweak per keyboard
|
||||||
|
// but setting a default across my boards for now
|
||||||
|
//
|
||||||
|
//#if defined(KEYBOARD_ergodox_ez)
|
||||||
|
//# define TAPPING_TERM 185
|
||||||
|
#if defined(KEYBOARD_crkbd) |
||||||
|
# define TAPPING_TERM 185 |
||||||
|
#else |
||||||
|
# define TAPPING_TERM 200 |
||||||
|
#endif |
||||||
|
|
||||||
|
/* Disable unused and unneeded features to reduce on firmware size */ |
||||||
|
#ifdef LOCKING_SUPPORT_ENABLE |
||||||
|
# undef LOCKING_SUPPORT_ENABLE |
||||||
|
#endif |
||||||
|
#ifdef LOCKING_RESYNC_ENABLE |
||||||
|
# undef LOCKING_RESYNC_ENABLE |
||||||
#endif |
#endif |
||||||
|
@ -0,0 +1,52 @@ |
|||||||
|
/* Copyright 2021 SethBarberee <seth.barberee@gmail.com>
|
||||||
|
* |
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/ |
||||||
|
#include "rgb_light.h" |
||||||
|
|
||||||
|
#if defined(RGBLIGHT_ENABLE) |
||||||
|
layer_state_t layer_state_set_rgb_light(layer_state_t state){ |
||||||
|
switch(get_highest_layer(state)) { |
||||||
|
case _QWERTY: |
||||||
|
rgblight_set_hsv_and_mode(HSV_RED, RGBLIGHT_MODE_BREATHING + 3); |
||||||
|
break; |
||||||
|
case _LOWER: |
||||||
|
rgblight_set_hsv_and_mode(HSV_GREEN, RGBLIGHT_MODE_BREATHING + 3); |
||||||
|
break; |
||||||
|
case _RAISE: |
||||||
|
rgblight_set_hsv_and_mode(HSV_BLUE, RGBLIGHT_MODE_BREATHING + 3); |
||||||
|
break; |
||||||
|
case _ADJUST: |
||||||
|
rgblight_set_hsv_and_mode(HSV_GOLDENROD, RGBLIGHT_MODE_BREATHING + 3); |
||||||
|
break; |
||||||
|
default: |
||||||
|
rgblight_set_hsv_and_mode(HSV_PINK, RGBLIGHT_MODE_TWINKLE + 3); |
||||||
|
break; |
||||||
|
|
||||||
|
} |
||||||
|
return state; |
||||||
|
} |
||||||
|
|
||||||
|
void rgblight_set_hsv_and_mode(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode) { |
||||||
|
rgblight_sethsv_noeeprom(hue, sat, val); |
||||||
|
// wait_us(175); // Add a slight delay between color and mode to ensure it's processed correctly
|
||||||
|
rgblight_mode_noeeprom(mode); |
||||||
|
} |
||||||
|
|
||||||
|
void keyboard_post_init_rgb_light(void) |
||||||
|
{ |
||||||
|
layer_state_set_rgb_light(layer_state); |
||||||
|
} |
||||||
|
#endif |
||||||
|
|
@ -0,0 +1,21 @@ |
|||||||
|
/* Copyright 2021 SethBarberee <seth.barberee@gmail.com>
|
||||||
|
* |
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/ |
||||||
|
#pragma once |
||||||
|
#include "sethBarberee.h" |
||||||
|
|
||||||
|
layer_state_t layer_state_set_rgb_light(layer_state_t state); |
||||||
|
void keyboard_post_init_rgb_light(void); |
||||||
|
void rgblight_set_hsv_and_mode(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode); |
@ -1 +1,10 @@ |
|||||||
SRC += sethBarberee.c
|
SRC += sethBarberee.c
|
||||||
|
|
||||||
|
# Add in custom tap dances when tap dance is enabled
|
||||||
|
ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) |
||||||
|
SRC += tap_dance.c
|
||||||
|
endif |
||||||
|
|
||||||
|
ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) |
||||||
|
SRC += rgb_light.c
|
||||||
|
endif |
||||||
|
@ -1,45 +1,85 @@ |
|||||||
|
/* Copyright 2021 SethBarberee <seth.barberee@gmail.com>
|
||||||
|
* |
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/ |
||||||
#include "sethBarberee.h" |
#include "sethBarberee.h" |
||||||
#ifdef RGBLIGHT_ENABLE |
#include "version.h" |
||||||
#ifdef TAP_DANCE_ENABLE |
|
||||||
|
__attribute__ ((weak)) void keyboard_pre_init_keymap(void) {} |
||||||
// Initialize it now
|
|
||||||
tap caps_status = { |
void keyboard_pre_init_user(void){ |
||||||
.toggled = false, |
#if defined(BOOTLOADER_CATERINA) |
||||||
.toggle_mode = CAPS_LOCK_MODE, |
// Make sure the red LEDs don't light
|
||||||
.normal_mode = NORMAL_MODE |
setPinOutput(D5); |
||||||
}; |
writePinHigh(D5); |
||||||
|
|
||||||
void dance_ecap_finished (qk_tap_dance_state_t *state, void *user_data){ |
setPinOutput(B0); |
||||||
if(state->count == 1){ |
writePinHigh(B0); |
||||||
register_code(KC_ESC); |
#endif |
||||||
} else { |
keyboard_pre_init_keymap(); |
||||||
register_code(KC_CAPS); |
|
||||||
if(!caps_status.toggled){ |
|
||||||
// Toggling caps so indicate
|
|
||||||
caps_status.toggled = true; |
|
||||||
rgblight_mode_noeeprom(caps_status.toggle_mode); |
|
||||||
} else { |
|
||||||
// Turning off so return to normal mode
|
|
||||||
caps_status.toggled = false; |
|
||||||
rgblight_mode_noeeprom(caps_status.normal_mode); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
} |
||||||
|
|
||||||
void dance_ecap_reset (qk_tap_dance_state_t *state, void *user_data){ |
__attribute__ ((weak)) layer_state_t layer_state_set_keymap (layer_state_t state) { return state; } |
||||||
if(state->count == 1){ |
|
||||||
unregister_code(KC_ESC); |
layer_state_t layer_state_set_user(layer_state_t state){ |
||||||
} else { |
|
||||||
unregister_code(KC_CAPS); |
if (!is_keyboard_master()) { |
||||||
|
return state; |
||||||
} |
} |
||||||
|
|
||||||
|
state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST); |
||||||
|
#if defined(RGBLIGHT_ENABLE) |
||||||
|
state = layer_state_set_rgb_light(state); |
||||||
|
#endif |
||||||
|
return layer_state_set_keymap(state); |
||||||
} |
} |
||||||
|
|
||||||
//Tap Dance Definitions
|
__attribute__ ((weak)) void keyboard_post_init_keymap(void) {} |
||||||
qk_tap_dance_action_t tap_dance_actions[] = { |
|
||||||
//Tap once for Esc, twice for Caps Lock
|
|
||||||
[TD_ECAP] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_ecap_finished, dance_ecap_reset), |
|
||||||
// Other declarations would go here, separated by commas, if you have them
|
|
||||||
}; |
|
||||||
|
|
||||||
|
void keyboard_post_init_user(void) |
||||||
|
{ |
||||||
|
#if defined(RGBLIGHT_ENABLE) |
||||||
|
keyboard_post_init_rgb_light(); |
||||||
#endif |
#endif |
||||||
|
keyboard_post_init_keymap(); |
||||||
|
} |
||||||
|
|
||||||
|
__attribute__((weak)) void suspend_power_down_keymap(void) {} |
||||||
|
|
||||||
|
void suspend_power_down_user(void) { |
||||||
|
#ifdef OLED_DRIVER_ENABLE |
||||||
|
oled_off(); |
||||||
#endif |
#endif |
||||||
|
suspend_power_down_keymap(); |
||||||
|
} |
||||||
|
|
||||||
|
__attribute__((weak)) void suspend_wakeup_init_keymap(void) {} |
||||||
|
|
||||||
|
void suspend_wakeup_init_user(void) { suspend_wakeup_init_keymap(); } |
||||||
|
|
||||||
|
__attribute__ ((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true;} |
||||||
|
|
||||||
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) { |
||||||
|
if (process_record_keymap(keycode, record)) |
||||||
|
{ |
||||||
|
switch (keycode) { |
||||||
|
case KC_VRSN: // Prints firmware version
|
||||||
|
if (record->event.pressed) { |
||||||
|
SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE); |
||||||
|
} |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
return true; |
||||||
|
} |
||||||
|
@ -1,20 +1,50 @@ |
|||||||
#ifndef USERSPACE |
/* Copyright 2021 SethBarberee <seth.barberee@gmail.com>
|
||||||
#define USERSPACE |
* |
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/ |
||||||
|
#pragma once |
||||||
|
|
||||||
#include "quantum.h" |
#include QMK_KEYBOARD_H |
||||||
|
|
||||||
#ifdef TAP_DANCE_ENABLE // only enable for tap dances
|
#include "wrappers.h" |
||||||
enum { |
|
||||||
TD_ECAP = 0, |
|
||||||
}; |
|
||||||
|
|
||||||
#define KC_ECAP TD(TD_ECAP) |
enum layers { |
||||||
|
_QWERTY, |
||||||
|
_LOWER, |
||||||
|
_RAISE, |
||||||
|
_ADJUST |
||||||
|
}; |
||||||
|
|
||||||
typedef struct { |
enum userspace_keycodes { |
||||||
bool toggled; // store whether we have toggled caps lock
|
KC_VRSN = SAFE_RANGE, |
||||||
int toggle_mode; // idk why but maybe do something with this..
|
NEW_SAFE_RANGE |
||||||
int normal_mode; |
}; |
||||||
} tap; |
|
||||||
|
#define KC_LOWR MO(_LOWER) |
||||||
|
#define KC_RASE MO(_RAISE) |
||||||
|
|
||||||
|
#ifdef TAP_DANCE_ENABLE |
||||||
|
# include "tap_dance.h" |
||||||
#endif |
#endif |
||||||
|
|
||||||
|
#ifdef RGBLIGHT_ENABLE |
||||||
|
# include "rgb_light.h" |
||||||
#endif |
#endif |
||||||
|
|
||||||
|
void keyboard_pre_init_keymap(void); |
||||||
|
void keyboard_post_init_keymap(void); |
||||||
|
void suspend_power_down_keymap(void); |
||||||
|
void suspend_wakeup_init_keymap(void); |
||||||
|
layer_state_t layer_state_set_keymap (layer_state_t state); |
||||||
|
bool process_record_keymap(uint16_t keycode, keyrecord_t *record); |
||||||
|
@ -0,0 +1,89 @@ |
|||||||
|
/* Copyright 2021 SethBarberee <seth.barberee@gmail.com>
|
||||||
|
* |
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/ |
||||||
|
#include "tap_dance.h" |
||||||
|
|
||||||
|
// Shamelessly stolen from QMK Docs
|
||||||
|
int cur_dance (qk_tap_dance_state_t *state) { |
||||||
|
if (state->count == 1) { |
||||||
|
if (state->interrupted || !state->pressed) { |
||||||
|
return SINGLE_TAP; |
||||||
|
} else { |
||||||
|
return SINGLE_HOLD; |
||||||
|
} |
||||||
|
} |
||||||
|
else if (state->count == 2) { |
||||||
|
if (state->interrupted) return DOUBLE_SINGLE_TAP; |
||||||
|
else if (state->pressed) return DOUBLE_HOLD; |
||||||
|
else return DOUBLE_TAP; |
||||||
|
} |
||||||
|
if (state->count == 3) { |
||||||
|
if (state->interrupted || !state->pressed) return TRIPLE_TAP; |
||||||
|
else return TRIPLE_HOLD; |
||||||
|
} |
||||||
|
else return 8; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
// Initialize it now
|
||||||
|
tap caps_status = { |
||||||
|
.toggled = false, |
||||||
|
.state = 0 |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
void dance_ecap_finished (qk_tap_dance_state_t *state, void *user_data){ |
||||||
|
caps_status.state = cur_dance(state); |
||||||
|
switch(caps_status.state){ |
||||||
|
case SINGLE_TAP: |
||||||
|
tap_code(KC_ESC); |
||||||
|
break; |
||||||
|
case SINGLE_HOLD: |
||||||
|
register_code(KC_LCTRL); |
||||||
|
break; |
||||||
|
case DOUBLE_TAP: |
||||||
|
tap_code(KC_CAPS); |
||||||
|
if(!caps_status.toggled){ |
||||||
|
// Toggling caps so indicate
|
||||||
|
caps_status.toggled = true; |
||||||
|
#ifdef RGBLIGHT_ENABLE |
||||||
|
// Save mode we can from
|
||||||
|
caps_status.normal_mode = rgblight_get_mode(); |
||||||
|
rgblight_mode_noeeprom(CAPS_LOCK_MODE); |
||||||
|
#endif |
||||||
|
} else { |
||||||
|
// Turning off so return to normal mode
|
||||||
|
caps_status.toggled = false; |
||||||
|
#ifdef RGBLIGHT_ENABLE |
||||||
|
rgblight_mode_noeeprom(caps_status.normal_mode); |
||||||
|
#endif |
||||||
|
} |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void dance_ecap_reset (qk_tap_dance_state_t *state, void *user_data){ |
||||||
|
if(caps_status.state == SINGLE_HOLD){ |
||||||
|
unregister_code(KC_LCTRL); |
||||||
|
} |
||||||
|
caps_status.state = 0; |
||||||
|
} |
||||||
|
|
||||||
|
//Tap Dance Definitions
|
||||||
|
qk_tap_dance_action_t tap_dance_actions[] = { |
||||||
|
//Tap once for Esc, twice for Caps Lock
|
||||||
|
[TD_ECAP] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_ecap_finished, dance_ecap_reset), |
||||||
|
// Other declarations would go here, separated by commas, if you have them
|
||||||
|
}; |
@ -0,0 +1,43 @@ |
|||||||
|
/* Copyright 2021 SethBarberee <seth.barberee@gmail.com>
|
||||||
|
* |
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/ |
||||||
|
#pragma once |
||||||
|
#include "sethBarberee.h" |
||||||
|
|
||||||
|
//Define a type for as many tap dance states as you need
|
||||||
|
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 |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
enum { |
||||||
|
TD_ECAP = 0, |
||||||
|
}; |
||||||
|
|
||||||
|
#define KC_ECAP TD(TD_ECAP) |
||||||
|
|
||||||
|
typedef struct { |
||||||
|
bool toggled; // store whether we have toggled caps lock
|
||||||
|
#ifdef RGBLIGHT_ENABLE |
||||||
|
int normal_mode; |
||||||
|
#endif // RGBLIGHT_ENABLE
|
||||||
|
int state; |
||||||
|
} tap; |
@ -0,0 +1,55 @@ |
|||||||
|
/* Copyright 2021 SethBarberee <seth.barberee@gmail.com>
|
||||||
|
* |
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/ |
||||||
|
#pragma once |
||||||
|
|
||||||
|
#include "sethBarberee.h" |
||||||
|
|
||||||
|
/*
|
||||||
|
Since our quirky block definitions are basically a list of comma separated |
||||||
|
arguments, we need a wrapper in order for these definitions to be |
||||||
|
expanded before being used as arguments to the LAYOUT_xxx macro. |
||||||
|
*/ |
||||||
|
|
||||||
|
/*
|
||||||
|
Blocks for each of the four major keyboard layouts |
||||||
|
Organized so we can quickly adapt and modify all of them |
||||||
|
at once, rather than for each keyboard, one at a time. |
||||||
|
And this allows for much cleaner blocks in the keymaps. |
||||||
|
For instance Tap/Hold for Control on all of the layouts |
||||||
|
|
||||||
|
NOTE: These are all the same length. If you do a search/replace |
||||||
|
then you need to add/remove underscores to keep the |
||||||
|
lengths consistent. |
||||||
|
*/ |
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
#define _________________QWERTY_L1_________________ KC_Q, KC_W, KC_E, KC_R, KC_T |
||||||
|
#define _________________QWERTY_L2_________________ KC_A, KC_S, KC_D, KC_F, KC_G |
||||||
|
#define _________________QWERTY_L3_________________ KC_Z, KC_X, KC_C, KC_V, KC_B |
||||||
|
|
||||||
|
#define _________________QWERTY_R1_________________ KC_Y, KC_U, KC_I, KC_O, KC_P |
||||||
|
#define _________________QWERTY_R2_________________ KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT |
||||||
|
#define _________________QWERTY_R3_________________ KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH |
||||||
|
|
||||||
|
#define ________________NUMBER_LEFT________________ KC_1, KC_2, KC_3, KC_4, KC_5 |
||||||
|
#define ________________NUMBER_RIGHT_______________ KC_6, KC_7, KC_8, KC_9, KC_0 |
||||||
|
#define _________________FUNC_LEFT_________________ KC_F1, KC_F2, KC_F3, KC_F4, KC_F5 |
||||||
|
#define _________________FUNC_RIGHT________________ KC_F6, KC_F7, KC_F8, KC_F9, KC_F10 |
||||||
|
|
||||||
|
#define ___________________BLANK___________________ _______, _______, _______, _______, _______ |
||||||
|
|
||||||
|
// clang-format on
|
||||||
|
|
Loading…
Reference in new issue