[Keymap] add brandonschlack userspace and keymaps (#10411)
This commit is contained in:
parent
262a607334
commit
f12dcb0659
80 changed files with 5712 additions and 0 deletions
214
users/brandonschlack/brandonschlack.c
Normal file
214
users/brandonschlack/brandonschlack.c
Normal file
|
@ -0,0 +1,214 @@
|
|||
/* Copyright 2020 Brandon Schlack
|
||||
*
|
||||
* 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 "brandonschlack.h"
|
||||
|
||||
user_config_t user_config;
|
||||
#ifdef STOPLIGHT_LED
|
||||
static stoplight_led_t stoplight_led;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Resets user config in EEPROM
|
||||
*
|
||||
* Default is use rgb for layer indication
|
||||
*/
|
||||
void eeconfig_init_user(void) {
|
||||
user_config.raw = 0;
|
||||
user_config.rgb_layer_change = true;
|
||||
user_config.rgb_theme = 0;
|
||||
eeconfig_update_user(user_config.raw);
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
void matrix_init_keymap(void){ }
|
||||
|
||||
void matrix_init_user(void) {
|
||||
matrix_init_keymap();
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
void keyboard_post_init_keymap(void){ }
|
||||
|
||||
/**
|
||||
* Reads user config from EEPROM,
|
||||
* calls RGB init if RGBs enabled
|
||||
*/
|
||||
void keyboard_post_init_user(void){
|
||||
// Read the user config from EEPROM
|
||||
user_config.raw = eeconfig_read_user();
|
||||
// Do Stoplight Animation if enabled
|
||||
#ifdef STOPLIGHT_LED
|
||||
led_stoplight_start();
|
||||
#endif
|
||||
// Do RGB things if RGBs enabled
|
||||
#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
|
||||
keyboard_post_init_rgb();
|
||||
#endif
|
||||
keyboard_post_init_keymap();
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
void shutdown_keymap(void) {}
|
||||
|
||||
/**
|
||||
* On shutdown,
|
||||
* If RGBs enabled,
|
||||
* then set RGB color to Red
|
||||
*/
|
||||
void shutdown_user (void) {
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
rgblight_enable_noeeprom();
|
||||
rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
|
||||
rgblight_sethsv_noeeprom(0, 255, 127);
|
||||
#endif // RGBLIGHT_ENABLE
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
rgb_matrix_set_color_all( 0xFF, 0x00, 0x00 );
|
||||
#endif //RGB_MATRIX_ENABLE
|
||||
shutdown_keymap();
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
void suspend_power_down_keymap(void) {}
|
||||
|
||||
/**
|
||||
* Set rgb_matrix suspend state to true if not already
|
||||
*/
|
||||
void suspend_power_down_user(void) {
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
if (!g_suspend_state) {
|
||||
rgb_matrix_set_suspend_state(true);
|
||||
}
|
||||
#endif //RGB_MATRIX_ENABLE
|
||||
suspend_power_down_keymap();
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
void suspend_wakeup_init_keymap(void) {}
|
||||
|
||||
/**
|
||||
* Set rgb_matrix suspend state to false if not already
|
||||
*/
|
||||
void suspend_wakeup_init_user(void) {
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
if (g_suspend_state) {
|
||||
rgb_matrix_set_suspend_state(false);
|
||||
}
|
||||
#endif //RGB_MATRIX_ENABLE
|
||||
suspend_wakeup_init_keymap();
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
void matrix_scan_keymap(void) {}
|
||||
|
||||
/**
|
||||
* Checks for Super CMD↯TAB
|
||||
*/
|
||||
void matrix_scan_user(void) {
|
||||
matrix_scan_cmd_tab();
|
||||
#ifdef STOPLIGHT_LED
|
||||
matrix_scan_led_stoplight();
|
||||
#endif
|
||||
matrix_scan_keymap();
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
layer_state_t default_layer_state_set_keymap(layer_state_t state) {
|
||||
return state;
|
||||
}
|
||||
|
||||
/**
|
||||
* For macropads, if a new default layer is set from DF()
|
||||
* then automatically set that layer with layer_move()
|
||||
*/
|
||||
layer_state_t default_layer_state_set_user(layer_state_t state) {
|
||||
#if defined(IS_MACROPAD)
|
||||
layer_move(get_highest_layer(state));
|
||||
#endif
|
||||
return default_layer_state_set_keymap(state);
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
layer_state_t layer_state_set_keymap(layer_state_t state) {
|
||||
return state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Do RGB things (like layer indication) on layer change
|
||||
*/
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
|
||||
state = layer_state_set_rgb(state);
|
||||
#endif // RGBLIGHT_ENABLE
|
||||
return layer_state_set_keymap(state);
|
||||
}
|
||||
|
||||
__attribute__((weak)) bool led_update_keymap(led_t led_state) { return true; }
|
||||
|
||||
bool led_update_user(led_t led_state) {
|
||||
#ifdef STOPLIGHT_LED
|
||||
if (stoplight_led.is_active) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
return led_update_keymap(led_state);
|
||||
}
|
||||
|
||||
#ifdef STOPLIGHT_LED
|
||||
void led_stoplight_start(void) {
|
||||
writePin(TOP_LED, LED_ON(false));
|
||||
writePin(MIDDLE_LED, LED_ON(false));
|
||||
writePin(BOTTOM_LED, LED_ON(false));
|
||||
|
||||
stoplight_led.is_active = true;
|
||||
stoplight_led.timer = timer_read();
|
||||
};
|
||||
|
||||
void led_stoplight_set(pin_t pin) {
|
||||
writePin(pin, LED_ON(true));
|
||||
};
|
||||
|
||||
void led_stoplight_end(void) {
|
||||
// Reset timer and status variables
|
||||
stoplight_led.is_active = false;
|
||||
stoplight_led.index = 0;
|
||||
stoplight_led.timer = 0;
|
||||
led_update_kb(host_keyboard_led_state());
|
||||
};
|
||||
|
||||
void matrix_scan_led_stoplight(void) {
|
||||
if (stoplight_led.is_active) {
|
||||
if (timer_elapsed(stoplight_led.timer) > (1000 * (stoplight_led.index + 1))) {
|
||||
switch (stoplight_led.index){
|
||||
case 0:
|
||||
led_stoplight_set(TOP_LED);
|
||||
stoplight_led.index++;
|
||||
break;
|
||||
case 1:
|
||||
led_stoplight_set(MIDDLE_LED);
|
||||
stoplight_led.index++;
|
||||
break;
|
||||
case 2:
|
||||
led_stoplight_set(BOTTOM_LED);
|
||||
stoplight_led.index++;
|
||||
break;
|
||||
default:
|
||||
led_stoplight_end();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif
|
83
users/brandonschlack/brandonschlack.h
Normal file
83
users/brandonschlack/brandonschlack.h
Normal file
|
@ -0,0 +1,83 @@
|
|||
/* Copyright 2020 Brandon Schlack
|
||||
*
|
||||
* 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 "version.h"
|
||||
#include "eeprom.h"
|
||||
#include "process_records.h"
|
||||
#ifdef TAP_DANCE_ENABLE
|
||||
# include "tap_dances.h"
|
||||
#endif // TAP_DANCE_ENABLE
|
||||
#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
|
||||
# include "rgb_bs.h"
|
||||
#endif
|
||||
|
||||
/* TODO Layer Names */
|
||||
enum bs_layers {
|
||||
_BASE = 0,
|
||||
_M1 = 1,
|
||||
_M2 = 2,
|
||||
_M3 = 3,
|
||||
_M4 = 4,
|
||||
_FN1 = 5,
|
||||
_M1_FN1 = 6,
|
||||
_M2_FN1 = 7,
|
||||
_M3_FN1 = 8,
|
||||
_M4_FN1 = 9,
|
||||
_FN2 = 10,
|
||||
_M1_FN2 = 11,
|
||||
_M2_FN2 = 12,
|
||||
_M3_FN2 = 13,
|
||||
_M4_FN2 = 14,
|
||||
_ADJUST = 15 // 15: Change keyboard settings
|
||||
};
|
||||
|
||||
#define _LOWER _FN1
|
||||
#define _RAISE _FN2
|
||||
|
||||
/* TODO User EECONFIG */
|
||||
typedef union {
|
||||
uint32_t raw;
|
||||
struct {
|
||||
bool rgb_layer_change :1;
|
||||
uint8_t rgb_theme :4;
|
||||
};
|
||||
} user_config_t;
|
||||
extern user_config_t user_config;
|
||||
|
||||
void matrix_init_keymap(void);
|
||||
void keyboard_post_init_keymap(void);
|
||||
void shutdown_keymap(void);
|
||||
void suspend_power_down_keymap(void);
|
||||
void suspend_wakeup_init_keymap(void);
|
||||
void matrix_scan_keymap(void);
|
||||
layer_state_t default_layer_state_set_keymap(layer_state_t state);
|
||||
layer_state_t layer_state_set_keymap(layer_state_t state);
|
||||
bool led_update_keymap(led_t led_state);
|
||||
|
||||
#ifdef STOPLIGHT_LED
|
||||
typedef struct {
|
||||
bool is_active :1;
|
||||
uint8_t index :7;
|
||||
uint16_t timer :16;
|
||||
} stoplight_led_t;
|
||||
|
||||
void led_stoplight_start(void);
|
||||
void led_stoplight_set(pin_t pin);
|
||||
void led_stoplight_end(void);
|
||||
void matrix_scan_led_stoplight(void);
|
||||
#endif
|
55
users/brandonschlack/config.h
Normal file
55
users/brandonschlack/config.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
/* Copyright 2020 Brandon Schlack
|
||||
*
|
||||
* 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
|
||||
|
||||
#define TAPPING_TOGGLE 2
|
||||
#define TAPPING_TERM 200
|
||||
#define PERMISSIVE_HOLD
|
||||
#define TAP_HOLD_CAPS_DELAY 200
|
||||
|
||||
#ifdef RGBLIGHT_ENABLE
|
||||
# define RGBLIGHT_SLEEP
|
||||
#endif
|
||||
|
||||
#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) && !defined(RGBLIGHT_LAYERS)
|
||||
# define RGB_THEME_ENABLE
|
||||
#endif
|
||||
|
||||
#ifdef RGB_THEME_ENABLE
|
||||
# define DISABLE_RGB_THEME_JAMON
|
||||
# define DISABLE_RGB_THEME_OBLIQUE
|
||||
#endif
|
||||
|
||||
#ifdef ENCODER_ENABLE
|
||||
# define TAP_CODE_DELAY 10
|
||||
#else
|
||||
# define TAP_CODE_DELAY 5
|
||||
#endif
|
||||
|
||||
/* Disable unused and unneeded features to reduce on firmware size */
|
||||
#ifndef NO_ACTION_MACRO
|
||||
# define NO_ACTION_MACRO
|
||||
#endif
|
||||
#ifndef NO_ACTION_FUNCTION
|
||||
# define NO_ACTION_FUNCTION
|
||||
#endif
|
||||
|
||||
#ifdef LOCKING_SUPPORT_ENABLE
|
||||
# undef LOCKING_SUPPORT_ENABLE
|
||||
#endif
|
||||
#ifdef LOCKING_RESYNC_ENABLE
|
||||
# undef LOCKING_RESYNC_ENABLE
|
||||
#endif
|
172
users/brandonschlack/process_records.c
Normal file
172
users/brandonschlack/process_records.c
Normal file
|
@ -0,0 +1,172 @@
|
|||
/* Copyright 2020 Brandon Schlack
|
||||
*
|
||||
* 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 "brandonschlack.h"
|
||||
|
||||
// Super CMD↯TAB
|
||||
bool is_cmd_tab_active = false;
|
||||
uint16_t cmd_tab_timer = 0;
|
||||
|
||||
__attribute__ ((weak))
|
||||
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Consolidated Macros
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case QM_MAKE: // Sends 'qmk compile' or 'qmk flash'
|
||||
if (record->event.pressed) {
|
||||
bool flash = false;
|
||||
// If is a keyboard and auto-flash is not set in rules.mk,
|
||||
// then Shift will trigger the flash command
|
||||
#if !defined(FLASH_BOOTLOADER) && !defined(IS_MACROPAD)
|
||||
uint8_t temp_mod = get_mods();
|
||||
uint8_t temp_osm = get_oneshot_mods();
|
||||
clear_mods();
|
||||
clear_oneshot_mods();
|
||||
if ( (temp_mod | temp_osm) & MOD_MASK_SHIFT )
|
||||
#endif
|
||||
{
|
||||
flash = true;
|
||||
}
|
||||
send_make_command(flash);
|
||||
}
|
||||
break;
|
||||
case QM_FLSH: // Sends flash command instead of compile
|
||||
if (record->event.pressed) {
|
||||
clear_mods();
|
||||
clear_oneshot_mods();
|
||||
send_make_command(true);
|
||||
}
|
||||
break;
|
||||
case QM_VRSN: // Prints firmware version
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE);
|
||||
}
|
||||
break;
|
||||
case QM_KYBD: // Prints keyboard path
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING("keyboards/" QMK_KEYBOARD "/");
|
||||
}
|
||||
break;
|
||||
case QM_KYMP: // Prints keymap path
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING("keyboards/" QMK_KEYBOARD "/keymaps/" QMK_KEYMAP "/keymap.c");
|
||||
}
|
||||
break;
|
||||
case CMD_TAB: // Super CMD↯TAB
|
||||
if (record->event.pressed) {
|
||||
if (!is_cmd_tab_active) {
|
||||
is_cmd_tab_active = true;
|
||||
register_code(KC_LGUI);
|
||||
}
|
||||
cmd_tab_timer = timer_read();
|
||||
register_code(KC_TAB);
|
||||
} else {
|
||||
unregister_code(KC_TAB);
|
||||
}
|
||||
break;
|
||||
#if defined(RGB_THEME_ENABLE)
|
||||
case RGB_LYR:
|
||||
if (record->event.pressed) {
|
||||
user_config.rgb_layer_change ^= 1;
|
||||
dprintf("rgb layer change [EEPROM]: %u\n", user_config.rgb_layer_change);
|
||||
eeconfig_update_user(user_config.raw);
|
||||
if (user_config.rgb_layer_change) {
|
||||
layer_state_set(layer_state);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RGB_HUI ... RGB_SAD:
|
||||
if (record->event.pressed) {
|
||||
if (user_config.rgb_layer_change) {
|
||||
user_config.rgb_layer_change = false;
|
||||
dprintf("rgb layer change [EEPROM]: %u\n", user_config.rgb_layer_change);
|
||||
eeconfig_update_user(user_config.raw);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RGB_THEME_FORWARD:
|
||||
if (record->event.pressed) {
|
||||
uint8_t shifted = get_mods() & (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT));
|
||||
if(shifted) {
|
||||
rgb_theme_step_reverse();
|
||||
} else {
|
||||
rgb_theme_step();
|
||||
}
|
||||
layer_state_set(layer_state);
|
||||
}
|
||||
break;
|
||||
case RGB_THEME_REVERSE:
|
||||
if (record->event.pressed) {
|
||||
uint8_t shifted = get_mods() & (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT));
|
||||
if(shifted) {
|
||||
rgb_theme_step();
|
||||
} else {
|
||||
rgb_theme_step_reverse();
|
||||
}
|
||||
layer_state_set(layer_state);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
return process_record_keymap(keycode, record);
|
||||
}
|
||||
|
||||
// Super CMD↯TAB
|
||||
void matrix_scan_cmd_tab(void) {
|
||||
if (is_cmd_tab_active) {
|
||||
if (timer_elapsed(cmd_tab_timer) > 500) {
|
||||
unregister_code(KC_LGUI);
|
||||
is_cmd_tab_active = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Make Command
|
||||
*
|
||||
* Sends 'qmk compile -kb keyboard -km keymap' command to compile firmware
|
||||
* Uses 'qmk flash' and resets keyboard, if flash_bootloader set to true
|
||||
* Sends CTPC and/or FORCE_LAYOUT parameters if built with those options
|
||||
*/
|
||||
void send_make_command(bool flash_bootloader) {
|
||||
#ifdef FORCE_LAYOUT // Add layout string if built with FORCE_LAYOUT
|
||||
SEND_STRING("FORCE_LAYOUT=" FORCE_LAYOUT " ");
|
||||
#endif
|
||||
#ifdef CONVERT_TO_PROTON_C // Add CTPC if built with CONVERT_TO_PROTON_C
|
||||
SEND_STRING("CTPC=yes ");
|
||||
#endif
|
||||
SEND_STRING("qmk ");
|
||||
if (flash_bootloader) {
|
||||
#ifndef KEYBOARD_massdrop // Don't run flash for Massdrop boards
|
||||
SEND_STRING("flash ");
|
||||
} else {
|
||||
#endif
|
||||
SEND_STRING("compile ");
|
||||
}
|
||||
SEND_STRING("-kb " QMK_KEYBOARD " ");
|
||||
SEND_STRING("-km " QMK_KEYMAP);
|
||||
if (flash_bootloader) {
|
||||
#if defined(KEYBOARD_massdrop) // only run for Massdrop boards
|
||||
SEND_STRING(" && mdlflash " QMK_KEYBOARD " " QMK_KEYMAP);
|
||||
#endif
|
||||
}
|
||||
SEND_STRING(SS_TAP(X_ENTER));
|
||||
if (flash_bootloader) {
|
||||
reset_keyboard();
|
||||
}
|
||||
}
|
152
users/brandonschlack/process_records.h
Normal file
152
users/brandonschlack/process_records.h
Normal file
|
@ -0,0 +1,152 @@
|
|||
/* Copyright 2020 Brandon Schlack
|
||||
*
|
||||
* 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 "brandonschlack.h"
|
||||
|
||||
// Macros
|
||||
enum custom_keycodes {
|
||||
QM_MAKE = SAFE_RANGE,
|
||||
QM_FLSH,
|
||||
QM_VRSN,
|
||||
QM_KYBD,
|
||||
QM_KYMP,
|
||||
CMD_TAB,
|
||||
RGB_LYR,
|
||||
RGB_THEME_FORWARD,
|
||||
RGB_THEME_REVERSE,
|
||||
KEYMAP_SAFE_RANGE
|
||||
};
|
||||
|
||||
bool process_record_keymap(uint16_t keycode, keyrecord_t *record);
|
||||
void matrix_scan_cmd_tab(void);
|
||||
|
||||
/**
|
||||
* QMK Defines
|
||||
* Some meta aliases for QMK features such as Mod-Taps
|
||||
* and for cleaner looking Layer Toggles
|
||||
*/
|
||||
/* Control Mod-Tap */
|
||||
#define CTL_ESC CTL_T(KC_ESC) // Hold Escape for Control
|
||||
#define CTL_TAB CTL_T(KC_TAB) // Hold Tab for Control
|
||||
#define CTL_CAP CTL_T(KC_CAPS) // Hold Caps Lock for Control
|
||||
/* Command Mod-Tap */
|
||||
#define CMD_ESC CMD_T(KC_ESC) // Hold Escape for Command
|
||||
#define CMD_CAP CMD_T(KC_CAPS) // Hold Caps Lock for Command
|
||||
#define CMD_SPC CMD_T(KC_SPC) // Hold Space for Command
|
||||
/* Hyper Mod-Tap */
|
||||
#define HY_ESC ALL_T(KC_ESC) // Hold Escape for Hyper (Shift-Control-Option-Command)
|
||||
#define HY_TAB ALL_T(KC_TAB) // Hold Tab for Hyper (Shift-Control-Option-Command)
|
||||
#define HY_CAPS ALL_T(KC_CAPS) // Hold Caps Lock for Hyper (Shift-Control-Option-Command)
|
||||
/* Shift Mod-Tap */
|
||||
#define SF_CAPS LSFT_T(KC_CAPS) // Hold Caps Lock for Left Shift
|
||||
#define SFT_ENT RSFT_T(KC_ENT) // Hold Enter for Right Shift
|
||||
#define SF_SLSH RSFT_T(KC_SLSH) // Tap Right Shift for Slash (/)
|
||||
#define SF_BSLS RSFT_T(KC_BSLS) // Tap Right Shift for Back Slash (\)
|
||||
/* Layer Aliases */
|
||||
#define FN_LYR MO(_FN1) // Hold for FN Layer
|
||||
#define FN2_LYR MO(_FN2) // Hold for FN2 Layer
|
||||
#define LOWER MO(_LOWER) // Hold for LOWER Layer
|
||||
#define RAISE MO(_RAISE) // Hold for RAISE Layer
|
||||
#define TT_FN TT(_FN1) // Hold for FN Layer, or Double-Tap to Toggle
|
||||
#define TT_FN2 TT(_FN2) // Hold for FN2 Layer, or Double-Tap to Toggle
|
||||
#define TT_LWR TT(_LOWER) // Hold for LOWER Layer, or Double-Tap to Toggle
|
||||
#define TT_RAI TT(_RAISE) // Hold for RAISE Layer, or Double-Tap to Toggle
|
||||
#define SPC_LWR LT(_LOWER, KC_SPC) // Tap for Space, Hold for LOWER Layer
|
||||
#define SPC_RAI LT(_RAISE, KC_SPC) // Tap for Space, Hold for RAISE Layer
|
||||
#define SLH_LWR LT(_LOWER, KC_SLSH) // Tap for /, Hold for LOWER Layer
|
||||
#define BSL_LWR LT(_LOWER, KC_BSLS) // Tap for \, Hold for LOWER Layer
|
||||
#define MCO_LYR MO(_MACRO) // Hold for MACRO Layer
|
||||
#define TG_ADJT TG(_ADJUST) // Toggle ADJUST Layer
|
||||
#define TG_LGHT TG(_LIGHT) // Toggle LIGHT Layer
|
||||
/**
|
||||
* Media Mod-Tap
|
||||
* Use the Mod-Tap feature for easy media controls
|
||||
* Used with >=65% layouts
|
||||
*/
|
||||
#define RWD_CMD RCMD_T(KC_MPRV) // Tap Right Command for Prev Track
|
||||
#define PLY_CMD RCMD_T(KC_MPLY) // Tap Right Command for Play/Pause
|
||||
#define FFD_OPT ROPT_T(KC_MNXT) // Tap Right Option for Next Track
|
||||
#define PLY_FN1 LT(_FN1, KC_MPLY) // Tap Fn for Play/Pause
|
||||
#define PLY_FN2 LT(_FN2, KC_MPLY) // Tap Fn2 for Play/Pause
|
||||
#define MUT_SFT RSFT_T(KC_MUTE) // Tap Right Shift for Mute
|
||||
/**
|
||||
* Arrow Mod-Tap
|
||||
* Use the Mod-Tap feature for arrow keys
|
||||
* Mostly used for 40-60% layouts
|
||||
*/
|
||||
#define UP_RSFT RSFT_T(KC_UP) // Tap Right Shift for Up
|
||||
#define LFT_OPT ROPT_T(KC_LEFT) // Tap Right Option for Left
|
||||
#define LFT_CMD RCMD_T(KC_LEFT) // Tap Right Command for Left
|
||||
#define DWN_FN1 LT(1, KC_DOWN) // Tap Fn for Down
|
||||
#define DWN_LWR DWN_FN1 // Tap Lower for Down
|
||||
#define DWN_FN2 LT(2, KC_DOWN) // Tap Fn2 for Down
|
||||
#define DWN_RAI DWN_FN2 // Tap Raise for Down
|
||||
#define DWN_OPT ROPT_T(KC_DOWN) // Tap Right Option for Down
|
||||
#define RGT_SFT RSFT_T(KC_RGHT) // Tap Right Shift for Right
|
||||
#define RGT_OPT ROPT_T(KC_RGHT) // Tap Right Option for Right
|
||||
#define RGT_CTL RCTL_T(KC_RGHT) // Tap Right Ctrl for Right
|
||||
/**
|
||||
* Nav Mod-Tap
|
||||
* Use the Mod-Tap feature for nav keys (Home/End, Page Up/Down)
|
||||
* Mostly used for 40-60% layouts, on a function layer
|
||||
*/
|
||||
#define PGU_SFT RSFT_T(KC_PGUP) // Tap Right Shift for Page Up
|
||||
#define HOM_OPT ROPT_T(KC_HOME) // Tap Right Option for Home
|
||||
#define HOM_CMD RCMD_T(KC_HOME) // Tap Right Command for Home
|
||||
#define PGD_OPT ROPT_T(KC_PGDN) // Tap Right Option for Page Down
|
||||
#define PGD_FN1 LT(1, KC_PGDN) // Tap Fn for Page Down
|
||||
#define PGD_LWR PGD_FN1 // Tap Lower for Page Down
|
||||
#define PGD_FN2 LT(2, KC_PGDN) // Tap Fn2 for Page Down
|
||||
#define PGD_RAI PGD_FN2 // Tap Raise for Page Down
|
||||
#define END_OPT ROPT_T(KC_END) // Tap Right Option for End
|
||||
#define END_CTL RCTL_T(KC_END) // Tap Right Control for End
|
||||
|
||||
/**
|
||||
* MacOS
|
||||
* Common shortcuts used in macOS
|
||||
* Reference: https://support.apple.com/en-us/HT201236
|
||||
*/
|
||||
#define MC_POWR KC_POWER // Power (KC_POWER)
|
||||
#define MC_SLEP LOPT(LCMD(KC_POWER)) // Sleep (Option-Command-Power)
|
||||
#define MC_SLPD LCTL(LSFT(KC_POWER)) // Sleep Display (Control-Shift-Power)
|
||||
#define MC_LOCK LCTL(LCMD(KC_Q)) // Lock Screen (Control-Command-Q)
|
||||
#define MC_MSSN KC_FIND // Mission Control: Configure karabiner for find -> mission_control
|
||||
#define MC_LHPD KC_MENU // Launchpad: Configure karabiner for menu -> launchpad
|
||||
#define MC_CMTB LCMD(KC_TAB) // Command-Tab
|
||||
#define MC_BACK LCMD(KC_LBRC) // Back (Command–Left Bracket)
|
||||
#define MC_FWRD LCMD(KC_RBRC) // Forward (Command–Right Bracket)
|
||||
#define CLS_TAB LCMD(KC_W) // Close Tab (Command–W)
|
||||
#define REO_TAB LSFT(LCMD(KC_T)) // Reopen Last Tab (Shift-Command-T)
|
||||
#define NXT_TAB LCTL(KC_TAB) // Next Tab (Control-Tab)
|
||||
#define PRV_TAB LSFT(LCTL(KC_TAB)) // Previous Tab (Shift-Control-Tab)
|
||||
#define NXT_WIN LCMD(KC_GRV) // Next Window (Control-Grave)
|
||||
#define PRV_WIN LCMD(KC_TILD) // Previous Window (Shift-Control-Grave)
|
||||
#define MC_PLYR LCMD(KC_F8) // Focuses current Media Player
|
||||
#define MC_UNDO LCMD(KC_Z) // Undo (Command-Z)
|
||||
#define MC_REDO LSFT(LCMD(KC_Z)) // Redo (Shift-Command-Z)
|
||||
#define OP_AFLL HYPR(KC_BSLS) // 1Password Autofill (Shift-Control-Option-Command-\)
|
||||
#define PX_AFLL LSFT(LOPT(KC_X)) // 1PasswordX Autofill (Shift-Option-X)
|
||||
// Reverse scrolling for using with macOS Natural Scrolling.
|
||||
#define MC_WH_U KC_WH_D // Mouse Wheel Up
|
||||
#define MC_WH_D KC_WH_U // Mouse Wheel Down
|
||||
#define MC_WH_L KC_WH_R // Mouse Wheel Left
|
||||
#define MC_WH_R KC_WH_L // Mouse Wheel Right
|
||||
|
||||
// RGB Theme
|
||||
#define RGB_THM RGB_THEME_FORWARD // Cycle next RGB_THEME
|
||||
#define RGB_RTHM RGB_THEME_REVERSE // Cycle previous RGB_THEME
|
||||
|
||||
void send_make_command(bool flash_bootloader);
|
48
users/brandonschlack/readme.md
Normal file
48
users/brandonschlack/readme.md
Normal file
|
@ -0,0 +1,48 @@
|
|||
# Overview
|
||||
|
||||
My QMK home. I feel as though I stand on the shoulders of giants, for a lot of my code here is borrowed and adapted from so many contributors here, and that I hope my code here can help or inspire others.
|
||||
|
||||
## Layers, Handlers, and Macros
|
||||
### Layers
|
||||
|
||||
I have some predefined layer names for keyboards:
|
||||
* **_BASE**: Default Layer, QWERTY layout.
|
||||
* **_FN1**: Function Layer for 60% and above, and additional macros and shortcuts on 50% and below.
|
||||
* **_LOWER** and **_RAISE**: Function layers for 40%
|
||||
|
||||
and macropads:
|
||||
* **_REEDER**: Shortcuts for [Reeder.app](https://reederapp.com/), my RSS feed reader
|
||||
* **_MEDIA**: Media controls
|
||||
* **_NAVI**: Navigation macros, for changing tabs and scrolling
|
||||
* **_KARABINER**: Generic macro keys, meant to be customized per app with [Karabiner](https://pqrs.org/osx/karabiner/)
|
||||
|
||||
#### Protected Layers
|
||||
I have some named "protected" layers, meant to be at the end of the layer list for changing keyboard settings and features.
|
||||
|
||||
* **KEYMAP_LAYERS**: Add additional layers in keymap.
|
||||
* **_AUDIO**: Audio feature controls.
|
||||
* **_LIGHT**: RGB Light/Matrix feature controls.
|
||||
* **_ADJUST**: General keyboard settings and toggles. Can also contain RGB and Audio controls on larger boards that don't need and extra layer for those controls.
|
||||
|
||||
### EEPROM User Config
|
||||
|
||||
I have a custom userspace config implemented to save settings on the board to persist across shutdowns. I currently store:
|
||||
|
||||
* rgb_layer_change - a toggle for using RGB themes for layer indication
|
||||
* rgb_theme - a pointer to the currently set RGB Theme
|
||||
|
||||
### Process Handlers
|
||||
|
||||
### Keycode Aliases
|
||||
|
||||
I am a macOS user and so a lot of my aliases are
|
||||
|
||||
### Macros
|
||||
|
||||
|
||||
## Tap Dances
|
||||
|
||||
### Tap Dance Trigger Layer
|
||||
|
||||
## RGB
|
||||
### RGB Theme
|
146
users/brandonschlack/rgb_bs.c
Normal file
146
users/brandonschlack/rgb_bs.c
Normal file
|
@ -0,0 +1,146 @@
|
|||
/* Copyright 2020 Brandon Schlack
|
||||
*
|
||||
* 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 "brandonschlack.h"
|
||||
#include "rgb_theme.h"
|
||||
#include "rgb_bs.h"
|
||||
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
extern rgblight_config_t rgblight_config;
|
||||
#elif defined(RGB_MATRIX_ENABLE)
|
||||
extern rgb_config_t rgb_matrix_config;
|
||||
extern bool g_suspend_state;
|
||||
extern led_config_t g_led_config;
|
||||
#endif
|
||||
|
||||
#if defined(RGB_THEME_ENABLE)
|
||||
// Should be rgb_theme.c
|
||||
#define RGB_THEME(name) const rgb_theme_t RGB_##name
|
||||
#define RGB_THEME_IMPLS
|
||||
#include "rgb_theme_user.inc"
|
||||
#undef RGB_THEME_IMPLS
|
||||
#undef RGB_THEME
|
||||
|
||||
#define RGB_THEME(name) [RGB_THEME_##name] = &RGB_##name,
|
||||
const rgb_theme_t *themes[] = {
|
||||
#include "rgb_theme_user.inc"
|
||||
};
|
||||
#undef RGB_THEME
|
||||
|
||||
// Userspace loose colors
|
||||
rgb_theme_color_t default_adjust = { HSV_SPRINGGREEN };
|
||||
#endif
|
||||
|
||||
void keyboard_post_init_rgb(void) {
|
||||
layer_state_set_user(layer_state);
|
||||
}
|
||||
|
||||
#if defined(RGB_THEME_ENABLE)
|
||||
void set_rgb_theme(uint8_t index) {
|
||||
if (!user_config.rgb_layer_change) {
|
||||
user_config.rgb_layer_change = true;
|
||||
}
|
||||
user_config.rgb_theme = index;
|
||||
dprintf("rgb theme [EEPROM]: %u\n", user_config.rgb_theme);
|
||||
eeconfig_update_user(user_config.raw);
|
||||
}
|
||||
|
||||
rgb_theme_t get_rgb_theme(void) {
|
||||
return *themes[user_config.rgb_theme];
|
||||
}
|
||||
|
||||
void rgb_theme_step(void) {
|
||||
uint8_t current = user_config.rgb_theme;
|
||||
current = (current + 1) % RGB_THEME_MAX;
|
||||
set_rgb_theme(current);
|
||||
}
|
||||
|
||||
void rgb_theme_step_reverse(void) {
|
||||
uint8_t current = user_config.rgb_theme;
|
||||
current = (current - 1) % RGB_THEME_MAX;
|
||||
set_rgb_theme(current);
|
||||
}
|
||||
|
||||
rgb_theme_color_t get_rgb_theme_color(uint8_t index) {
|
||||
rgb_theme_t theme = get_rgb_theme();
|
||||
size_t rgb_theme_color_max = sizeof theme.colors / sizeof *theme.colors;
|
||||
|
||||
if (index == _ADJUST) {
|
||||
return default_adjust;
|
||||
} else {
|
||||
return **(theme.colors + (index % rgb_theme_color_max));
|
||||
}
|
||||
};
|
||||
|
||||
void rgb_theme_layer(layer_state_t state) {
|
||||
uint8_t rgb_color_index = get_highest_layer(state);
|
||||
HSV color = get_rgb_theme_color(rgb_color_index);
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
color.v = rgblight_config.val;
|
||||
#elif defined(RGB_MATRIX_ENABLE)
|
||||
color.v = rgb_matrix_config.hsv.v;
|
||||
#endif
|
||||
rgb_layer_helper( color.h, color.s, color.v );
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, uint8_t led_type) {
|
||||
for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
|
||||
if (!HAS_ANY_FLAGS(g_led_config.flags[i], led_type)) {
|
||||
rgb_matrix_set_color( i, red, green, blue );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void rgb_matrix_cycle_flag (void) {
|
||||
switch (rgb_matrix_get_flags()) {
|
||||
case LED_FLAG_ALL:
|
||||
rgb_matrix_set_flags(LED_FLAG_KEYS);
|
||||
rgb_matrix_set_color_all(0, 0, 0);
|
||||
break;
|
||||
case LED_FLAG_KEYS:
|
||||
rgb_matrix_set_flags(LED_FLAG_UNDERGLOW);
|
||||
rgb_matrix_set_color_all(0, 0, 0);
|
||||
break;
|
||||
case LED_FLAG_UNDERGLOW:
|
||||
rgb_matrix_set_flags(LED_FLAG_NONE);
|
||||
rgb_matrix_set_color_all(0, 0, 0);
|
||||
break;
|
||||
default:
|
||||
rgb_matrix_set_flags(LED_FLAG_ALL);
|
||||
rgb_matrix_enable();
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void rgb_layer_helper(uint8_t hue, uint8_t sat, uint8_t val) {
|
||||
#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
|
||||
rgblight_sethsv_noeeprom(hue, sat, val);
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
rgb_matrix_layer_helper(0, 0, 0, rgb_matrix_get_flags());
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
layer_state_t layer_state_set_rgb(layer_state_t state) {
|
||||
#if defined(RGB_THEME_ENABLE)
|
||||
if (user_config.rgb_layer_change) {
|
||||
rgb_theme_layer(state);
|
||||
}
|
||||
#endif // RGBLIGHT_ENABLE
|
||||
return state;
|
||||
}
|
35
users/brandonschlack/rgb_bs.h
Normal file
35
users/brandonschlack/rgb_bs.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
/* Copyright 2020 Brandon Schlack
|
||||
*
|
||||
* 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"
|
||||
#ifdef RGB_THEME_ENABLE
|
||||
# include "rgb_theme.h"
|
||||
#endif
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
# include "rgb_matrix.h"
|
||||
#endif
|
||||
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
#define LED_FLAG_KEYS (LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER)
|
||||
|
||||
void rgb_matrix_layer_helper(uint8_t red, uint8_t green, uint8_t blue, uint8_t led_type);
|
||||
void rgb_matrix_cycle_flag(void);
|
||||
#endif
|
||||
|
||||
void keyboard_post_init_rgb(void);
|
||||
void rgb_layer_helper(uint8_t hue, uint8_t sat, uint8_t val);
|
||||
|
||||
layer_state_t layer_state_set_rgb(layer_state_t state);
|
51
users/brandonschlack/rgb_theme.h
Normal file
51
users/brandonschlack/rgb_theme.h
Normal file
|
@ -0,0 +1,51 @@
|
|||
/* Copyright 2020 Brandon Schlack
|
||||
*
|
||||
* 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 "brandonschlack.h"
|
||||
#include "color.h"
|
||||
#include "rgblight_list.h"
|
||||
|
||||
/*TODO Update as RGBLIGHT Mode */
|
||||
#ifndef RGB_THEME_COLORS_MAX
|
||||
#define RGB_THEME_COLORS_MAX 5
|
||||
#endif
|
||||
|
||||
enum rgb_themes {
|
||||
#define RGB_THEME(name) RGB_THEME_##name,
|
||||
#include "rgb_theme_user.inc"
|
||||
#undef RGB_THEME
|
||||
RGB_THEME_MAX
|
||||
};
|
||||
|
||||
// RGB Theme Color
|
||||
typedef const HSV rgb_theme_color_t;
|
||||
#define RGB_THEME_COLOR(tname, tcolor,...) rgb_theme_color_t tname ## _ ## tcolor = { __VA_ARGS__ }
|
||||
|
||||
// RGB Theme
|
||||
typedef struct {
|
||||
const HSV *colors[RGB_THEME_COLORS_MAX];
|
||||
} rgb_theme_t;
|
||||
extern const rgb_theme_t *themes[];
|
||||
|
||||
void set_rgb_theme(uint8_t index);
|
||||
rgb_theme_t get_rgb_theme(void);
|
||||
|
||||
void rgb_theme_step(void);
|
||||
void rgb_theme_step_reverse(void);
|
||||
|
||||
rgb_theme_color_t get_rgb_theme_color(uint8_t index);
|
||||
void rgb_theme_layer(layer_state_t state);
|
95
users/brandonschlack/rgb_theme_user.inc
Normal file
95
users/brandonschlack/rgb_theme_user.inc
Normal file
|
@ -0,0 +1,95 @@
|
|||
// Basic Theme
|
||||
#ifndef DISABLE_RGB_THEME_BASIC
|
||||
#ifndef RGB_THEME_IMPLS
|
||||
RGB_THEME(BASIC)
|
||||
#else
|
||||
RGB_THEME_COLOR(BASIC, WHITE, HSV_WHITE);
|
||||
RGB_THEME_COLOR(BASIC, BLUE, HSV_BLUE);
|
||||
RGB_THEME_COLOR(BASIC, RED, HSV_RED);
|
||||
RGB_THEME_COLOR(BASIC, GREEN, HSV_GREEN);
|
||||
RGB_THEME_COLOR(BASIC, YELLOW, HSV_YELLOW);
|
||||
RGB_THEME(BASIC) = { { &BASIC_WHITE, &BASIC_BLUE, &BASIC_RED, &BASIC_GREEN, &BASIC_YELLOW } };
|
||||
#endif // RGB_THEME_IMPLS
|
||||
#endif // DISABLE_RGB_THEME_BASIC
|
||||
|
||||
// Laser Theme
|
||||
#ifndef DISABLE_RGB_THEME_LASER
|
||||
#ifndef RGB_THEME_IMPLS
|
||||
RGB_THEME(LASER)
|
||||
#else
|
||||
RGB_THEME_COLOR(LASER, PURPLE, 191, 255, 255);
|
||||
RGB_THEME_COLOR(LASER, PINK, 237, 255, 255);
|
||||
RGB_THEME_COLOR(LASER, BLUE, 165, 255, 255);
|
||||
RGB_THEME_COLOR(LASER, CYAN, 133, 255, 255);
|
||||
RGB_THEME_COLOR(LASER, MAGENTA, 213, 255, 255);
|
||||
RGB_THEME(LASER) = { { &LASER_PURPLE, &LASER_PINK, &LASER_BLUE, &LASER_CYAN, &LASER_MAGENTA } };
|
||||
#endif // RGB_THEME_IMPLS
|
||||
#endif // DISABLE_RGB_THEME_LASER
|
||||
|
||||
// Metropolis Theme
|
||||
#ifndef DISABLE_RGB_THEME_METROPOLIS
|
||||
#ifndef RGB_THEME_IMPLS
|
||||
RGB_THEME(METROPOLIS)
|
||||
#else
|
||||
RGB_THEME_COLOR(METROPOLIS, TEAL, 96, 207, 255);
|
||||
RGB_THEME_COLOR(METROPOLIS, RED, HSV_RED);
|
||||
RGB_THEME_COLOR(METROPOLIS, YELLOW, 24, 255, 255);
|
||||
RGB_THEME_COLOR(METROPOLIS, BLUE, 168, 255, 255);
|
||||
RGB_THEME_COLOR(METROPOLIS, WHITE, HSV_WHITE);
|
||||
RGB_THEME(METROPOLIS) = { { &METROPOLIS_TEAL, &METROPOLIS_RED, &METROPOLIS_YELLOW, &METROPOLIS_BLUE, &METROPOLIS_WHITE } };
|
||||
#endif // RGB_THEME_IMPLS
|
||||
#endif // DISABLE_RGB_THEME_METROPOLIS
|
||||
|
||||
// Canvas Theme
|
||||
#ifndef DISABLE_RGB_THEME_CANVAS
|
||||
#ifndef RGB_THEME_IMPLS
|
||||
RGB_THEME(CANVAS)
|
||||
#else
|
||||
RGB_THEME_COLOR(CANVAS, WHITE, HSV_WHITE);
|
||||
RGB_THEME_COLOR(CANVAS, ORANGE, 10, 255, 255);
|
||||
RGB_THEME_COLOR(CANVAS, RED, 0, 231, 255);
|
||||
RGB_THEME_COLOR(CANVAS, GREEN, 74, 207, 255);
|
||||
RGB_THEME_COLOR(CANVAS, BLUE, 170, 135, 255);
|
||||
RGB_THEME(CANVAS) = { { &CANVAS_WHITE, &CANVAS_ORANGE, &CANVAS_RED, &CANVAS_GREEN, &CANVAS_BLUE } };
|
||||
#endif // RGB_THEME_IMPLS
|
||||
#endif // DISABLE_RGB_THEME_CANVAS
|
||||
|
||||
// Jamon Theme
|
||||
#ifndef DISABLE_RGB_THEME_JAMON
|
||||
#ifndef RGB_THEME_IMPLS
|
||||
RGB_THEME(JAMON)
|
||||
#else
|
||||
RGB_THEME_COLOR(JAMON, RED, HSV_RED);
|
||||
RGB_THEME_COLOR(JAMON, LIGHTRED, 4, 255, 255);
|
||||
RGB_THEME_COLOR(JAMON, WHITE, HSV_WHITE);
|
||||
RGB_THEME_COLOR(JAMON, YELLOW, HSV_GOLD);
|
||||
RGB_THEME(JAMON) = { { &JAMON_RED, &JAMON_LIGHTRED, &JAMON_WHITE, &JAMON_YELLOW } };
|
||||
#endif // RGB_THEME_IMPLS
|
||||
#endif // DISABLE_RGB_THEME_JAMON
|
||||
|
||||
// Striker Theme
|
||||
#ifndef DISABLE_RGB_THEME_STRIKER
|
||||
#ifndef RGB_THEME_IMPLS
|
||||
RGB_THEME(STRIKER)
|
||||
#else
|
||||
RGB_THEME_COLOR(STRIKER, BLUE, HSV_BLUE);
|
||||
RGB_THEME_COLOR(STRIKER, AZURE, HSV_AZURE);
|
||||
RGB_THEME_COLOR(STRIKER, WHITE, HSV_WHITE);
|
||||
RGB_THEME_COLOR(STRIKER, RED, HSV_RED);
|
||||
RGB_THEME(STRIKER) = { { &STRIKER_BLUE, &STRIKER_AZURE, &STRIKER_WHITE, &STRIKER_RED } };
|
||||
#endif // RGB_THEME_IMPLS
|
||||
#endif // DISABLE_RGB_THEME_STRIKER
|
||||
|
||||
// Oblique Theme
|
||||
#ifndef DISABLE_RGB_THEME_OBLIQUE
|
||||
#ifndef RGB_THEME_IMPLS
|
||||
RGB_THEME(OBLIQUE)
|
||||
#else
|
||||
RGB_THEME_COLOR(OBLIQUE, WHITE, HSV_WHITE);
|
||||
RGB_THEME_COLOR(OBLIQUE, PURPLE, 186, 143, 255);
|
||||
RGB_THEME_COLOR(OBLIQUE, RED, 10, 200, 255);
|
||||
RGB_THEME_COLOR(OBLIQUE, ORANGE, 26, 215, 255);
|
||||
RGB_THEME_COLOR(OBLIQUE, GREEN, 58, 199, 255);
|
||||
RGB_THEME(OBLIQUE) = { { &OBLIQUE_WHITE, &OBLIQUE_PURPLE, &OBLIQUE_RED, &OBLIQUE_ORANGE, &OBLIQUE_GREEN } };
|
||||
#endif // RGB_THEME_IMPLS
|
||||
#endif // DISABLE_RGB_THEME_OBLIQUE
|
34
users/brandonschlack/rules.mk
Normal file
34
users/brandonschlack/rules.mk
Normal file
|
@ -0,0 +1,34 @@
|
|||
SRC += brandonschlack.c \
|
||||
process_records.c
|
||||
|
||||
SPACE_CADET_ENABLE = no
|
||||
|
||||
# Use LTO except for ChibiOS
|
||||
ifneq ($(PLATFORM),CHIBIOS)
|
||||
LTO_ENABLE = yes
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(IS_MACROPAD)), yes)
|
||||
OPT_DEFS += -DIS_MACROPAD
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
|
||||
SRC += rgb_bs.c
|
||||
endif
|
||||
|
||||
RGB_MATRIX_ENABLE ?= no
|
||||
ifneq ($(strip $(RGB_MATRIX_ENABLE)), no)
|
||||
SRC += rgb_bs.c
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
|
||||
SRC += tap_dances.c
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(FLASH_BOOTLOADER)), yes)
|
||||
OPT_DEFS += -DFLASH_BOOTLOADER
|
||||
endif
|
||||
|
||||
ifneq ($(FORCE_LAYOUT),)
|
||||
OPT_DEFS += -DFORCE_LAYOUT=\"$(FORCE_LAYOUT)\"
|
||||
endif
|
91
users/brandonschlack/tap_dances.c
Normal file
91
users/brandonschlack/tap_dances.c
Normal file
|
@ -0,0 +1,91 @@
|
|||
/* Copyright 2020 Brandon Schlack
|
||||
*
|
||||
* 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_dances.h"
|
||||
#include "process_keycode/process_tap_dance.h"
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
void process_tap_dance_keycode (bool reset, uint8_t toggle_layer) { };
|
||||
|
||||
void td_trigger_layer_finished (qk_tap_dance_state_t *state, void *user_data) {
|
||||
qk_tap_dance_trigger_layer_t *data = (qk_tap_dance_trigger_layer_t *)user_data;
|
||||
data->state = cur_dance(state);
|
||||
|
||||
if (data->state == data->trigger) {
|
||||
layer_on(data->layer);
|
||||
} else {
|
||||
process_tap_dance_keycode(false, data->layer);
|
||||
}
|
||||
|
||||
}
|
||||
void td_trigger_layer_reset (qk_tap_dance_state_t *state, void *user_data) {
|
||||
qk_tap_dance_trigger_layer_t *data = (qk_tap_dance_trigger_layer_t *)user_data;
|
||||
if (data->state == data->trigger) {
|
||||
switch (data->trigger) {
|
||||
case SINGLE_HOLD:
|
||||
case DOUBLE_HOLD:
|
||||
case TRIPLE_HOLD:
|
||||
layer_off(data->layer);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
process_tap_dance_keycode(true, data->layer);
|
||||
}
|
||||
data->state = 0;
|
||||
}
|
||||
|
||||
/* Tap Dance: Layer Mod. Toggles Layer when tapped, Mod when held. */
|
||||
void td_layer_mod_each(qk_tap_dance_state_t *state, void *user_data) {
|
||||
qk_tap_dance_dual_role_t *data = (qk_tap_dance_dual_role_t *)user_data;
|
||||
|
||||
// Single tap → toggle layer, Single hold → mod
|
||||
if (state->pressed) {
|
||||
register_code(data->kc);
|
||||
} else if (state->count == 1) {
|
||||
state->finished = true;
|
||||
}
|
||||
}
|
||||
|
||||
void td_layer_mod_finished(qk_tap_dance_state_t *state, void *user_data) {
|
||||
qk_tap_dance_dual_role_t *data = (qk_tap_dance_dual_role_t *)user_data;
|
||||
|
||||
if (state->count == 1 && !state->pressed) {
|
||||
layer_invert(data->layer);
|
||||
}
|
||||
}
|
||||
|
||||
void td_layer_mod_reset(qk_tap_dance_state_t *state, void *user_data) {
|
||||
qk_tap_dance_dual_role_t *data = (qk_tap_dance_dual_role_t *)user_data;
|
||||
|
||||
if (state->count == 1) {
|
||||
unregister_code(data->kc);
|
||||
}
|
||||
}
|
52
users/brandonschlack/tap_dances.h
Normal file
52
users/brandonschlack/tap_dances.h
Normal file
|
@ -0,0 +1,52 @@
|
|||
/* Copyright 2020 Brandon Schlack
|
||||
*
|
||||
* 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 "brandonschlack.h"
|
||||
#ifdef TAP_DANCE_ENABLE
|
||||
# include "process_keycode/process_tap_dance.h"
|
||||
#endif
|
||||
|
||||
enum tap_dance_states {
|
||||
SINGLE_TAP = 1,
|
||||
SINGLE_HOLD = 2,
|
||||
DOUBLE_TAP = 3,
|
||||
DOUBLE_HOLD = 4,
|
||||
DOUBLE_SINGLE_TAP = 5,
|
||||
TRIPLE_TAP = 6,
|
||||
TRIPLE_HOLD = 7
|
||||
};
|
||||
|
||||
int cur_dance (qk_tap_dance_state_t *state);
|
||||
void process_tap_dance_keycode (bool reset, uint8_t toggle_layer);
|
||||
|
||||
/* Tap Dance: Trigger Layer
|
||||
*
|
||||
* Toggles Layer based on given trigger (Single Hold, Double Tap, Double Hold, etc).
|
||||
* Uses process_tap_dance_keycode() to allow keycode defines based on layer
|
||||
*/
|
||||
typedef struct {
|
||||
uint8_t trigger;
|
||||
uint8_t layer;
|
||||
uint8_t state;
|
||||
} qk_tap_dance_trigger_layer_t;
|
||||
|
||||
#define ACTION_TAP_DANCE_TRIGGER_LAYER(trigger, layer) { \
|
||||
.fn = { NULL, td_trigger_layer_finished, td_trigger_layer_reset }, \
|
||||
.user_data = (void *)&((qk_tap_dance_trigger_layer_t) { trigger, layer, 0 }), \
|
||||
}
|
||||
|
||||
void td_trigger_layer_finished (qk_tap_dance_state_t *state, void *user_data);
|
||||
void td_trigger_layer_reset (qk_tap_dance_state_t *state, void *user_data);
|
Loading…
Add table
Add a link
Reference in a new issue