summaryrefslogtreecommitdiff
path: root/users/drashna
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2018-05-31 22:11:06 -0700
committerJack Humbert <jack.humb@gmail.com>2018-06-01 01:11:06 -0400
commit3d1349b280d9c0a57e37b5347a405426de6dba10 (patch)
tree0b8c989d0c902115e2ce51c8bb9dc201b0e2eb0c /users/drashna
parent8eaf23ae8146766615cc1cec3fc8e04111e8ef49 (diff)
downloadqmk_firmware-3d1349b280d9c0a57e37b5347a405426de6dba10.tar.gz
qmk_firmware-3d1349b280d9c0a57e37b5347a405426de6dba10.zip
Big overhaul to Drashna keymaps and userspace (#3097)
* Optimize secrets code * Orthodox tweaks * rules.mk features * Minor cleanup * Revert mod bits * Force Hold breaks One Shot Tap Toggle * Cleanup * Moke keymaps more consistent * minor ergodox tweak * More OSM for the Orthodox * Cleanup of userspace * Toggle Secrets * Add hidden process record for super secret macros * Make sure secret macros always compiles * finish up making them super secret * Add ColinTA's rgb twinkle as WIP * Optimize RGB Twinkling for typing Also, tweak RGB indicators. AND WTF, I HAVE NO IDEA WHY THE INDICATORS ONLY WORK AS IS. The logical method for getting them working doesn't ... and it's beyond bizarre * Make console logging more configurable * Indicator travisty * Clean up userspace rgb code * Optimize RGB Twinking to work on default layer only, and to base it's color on the curent hue * Eff it... rgblight_sethsv_at runs at every matrix scan * RGB Twinkle cleanup * Update Iris code for new board * Move RGB Indicator and RGB Twinkle into userspace * Move RGB Indicator code to rgb_stuff.c * Major cleanup of RGB Code in userspace * Additional cleanup of RGB code in userspace * Use noeeprom functions to save my boards! * Enable RGB Sleep on all boards now * Add old iris board * tapping tweak * Use byte 19 for eeprom to prepare for possible merge of eeconfig function pr * Add code to fix default layer after eeprom reset
Diffstat (limited to 'users/drashna')
-rw-r--r--users/drashna/config.h11
-rw-r--r--users/drashna/drashna.c340
-rw-r--r--users/drashna/drashna.h30
-rw-r--r--users/drashna/readme.md4
-rw-r--r--users/drashna/rgb_stuff.c261
-rw-r--r--users/drashna/rgb_stuff.h16
-rw-r--r--users/drashna/rules.mk29
-rw-r--r--users/drashna/tap_dances.c65
-rw-r--r--users/drashna/tap_dances.h7
9 files changed, 462 insertions, 301 deletions
diff --git a/users/drashna/config.h b/users/drashna/config.h
index ef1860778e..26c989d7f5 100644
--- a/users/drashna/config.h
+++ b/users/drashna/config.h
@@ -11,12 +11,13 @@
SONG(DVORAK_SOUND), \
SONG(OVERWATCH_THEME) \
}
+
+#define AUDIO_CLICKY_FREQ_RANDOMNESS 1.0f
+
#endif
#ifdef RGBLIGHT_ENABLE
- #ifndef KEYBOARD_ergodox_ez
- #define RGBLIGHT_SLEEP
- #endif // !KEYBOARD_ergodox_ez
+#define RGBLIGHT_SLEEP
#endif // RGBLIGHT_ENABLE
@@ -42,7 +43,7 @@
#define IGNORE_MOD_TAP_INTERRUPT
#undef PERMISSIVE_HOLD
#undef PREVENT_STUCK_MODIFIERS
-#define TAPPING_FORCE_HOLD
+// #define TAPPING_FORCE_HOLD
//#define RETRO_TAPPING
#define FORCE_NKRO
@@ -54,7 +55,7 @@
#ifdef TAPPING_TERM
#undef TAPPING_TERM
#endif // TAPPING_TERM
-#define TAPPING_TERM 200
+#define TAPPING_TERM 175
// Disable action_get_macro and fn_actions, since we don't use these
diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c
index 6ce541bfbc..8efd99f805 100644
--- a/users/drashna/drashna.c
+++ b/users/drashna/drashna.c
@@ -17,119 +17,36 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "drashna.h"
#include "version.h"
-
-#if (__has_include("secrets.h") && !defined(NO_SECRETS))
-#include "secrets.h"
-#else
-// `PROGMEM const char secret[][x]` may work better, but it takes up more space in the firmware
-// And I'm not familiar enough to know which is better or why...
-PROGMEM const char secret[][64] = {
- "test1",
- "test2",
- "test3",
- "test4",
- "test5"
-};
-#endif
+#include "eeprom.h"
+#include "tap_dances.h"
+#include "rgb_stuff.h"
float tone_copy[][2] = SONG(SCROLL_LOCK_ON_SOUND);
float tone_paste[][2] = SONG(SCROLL_LOCK_OFF_SOUND);
-
static uint16_t copy_paste_timer;
userspace_config_t userspace_config;
// Helper Functions
-void tap(uint16_t keycode){ register_code(keycode); unregister_code(keycode); };
-
-#ifdef RGBLIGHT_ENABLE
-void rgblight_sethsv_default_helper(uint8_t index) {
- uint8_t default_layer = eeconfig_read_default_layer();
- if (default_layer & (1UL << _COLEMAK)) {
- rgblight_sethsv_at(300, 255, 255, index);
- rgblight_sethsv_at(300, 255, 255, index);
- }
- else if (default_layer & (1UL << _DVORAK)) {
- rgblight_sethsv_at(120, 255, 255, index);
- rgblight_sethsv_at(120, 255, 255, index);
- }
- else if (default_layer & (1UL << _WORKMAN)) {
- rgblight_sethsv_at(43, 255, 255, index);
- rgblight_sethsv_at(43, 255, 255, index);
- }
- else {
- rgblight_sethsv_at(180, 255, 255, index);
- rgblight_sethsv_at(180, 255, 255, index);
- }
-}
-#endif // RGBLIGHT_ENABLE
-
-// ========================================= TAP DANCE =========================================
-#ifdef TAP_DANCE_ENABLE
-//define diablo macro timer variables
-static uint16_t diablo_timer[4];
-static uint8_t diablo_times[] = { 0, 1, 3, 5, 10, 30 };
-static uint8_t diablo_key_time[4];
-
-// has the correct number of seconds elapsed (as defined by diablo_times)
-bool check_dtimer(uint8_t dtimer) { return (timer_elapsed(diablo_timer[dtimer]) < (diablo_key_time[dtimer] * 1000)) ? false : true; };
-
-// Cycle through the times for the macro, starting at 0, for disabled.
-// Max of six values, so don't exceed
-void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data, uint8_t diablo_key) {
- if (state->count >= 7) {
- diablo_key_time[diablo_key] = diablo_times[0];
- reset_tap_dance(state);
- } else {
- diablo_key_time[diablo_key] = diablo_times[state->count - 1];
- }
-}
-// Would rather have one function for all of this, but no idea how to do that...
-void diablo_tapdance1(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 0); }
-void diablo_tapdance2(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 1); }
-void diablo_tapdance3(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 2); }
-void diablo_tapdance4(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 3); }
-
-//Tap Dance Definitions
-qk_tap_dance_action_t tap_dance_actions[] = {
- // tap once to disable, and more to enable timed micros
- [TD_D3_1] = ACTION_TAP_DANCE_FN(diablo_tapdance1),
- [TD_D3_2] = ACTION_TAP_DANCE_FN(diablo_tapdance2),
- [TD_D3_3] = ACTION_TAP_DANCE_FN(diablo_tapdance3),
- [TD_D3_4] = ACTION_TAP_DANCE_FN(diablo_tapdance4),
-};
-
-// Sends the key press to system, but only if on the Diablo layer
-void send_diablo_keystroke(uint8_t diablo_key) {
- if (biton32(layer_state) == _DIABLO) {
- switch (diablo_key) {
- case 0:
- tap(KC_1); break;
- case 1:
- tap(KC_2); break;
- case 2:
- tap(KC_3); break;
- case 3:
- tap(KC_4); break;
- }
+// This block is for all of the gaming macros, as they were all doing
+// the same thing, but with differring text sent.
+bool send_game_macro(const char *str, keyrecord_t *record, bool override) {
+ if (!record->event.pressed || override) {
+ clear_keyboard();
+ tap(userspace_config.is_overwatch ? KC_BSPC : KC_ENTER);
+ wait_ms(50);
+ send_string(str);
+ wait_ms(50);
+ tap(KC_ENTER);
}
+ if (override) wait_ms(3000);
+ return false;
}
-// Checks each of the 4 timers/keys to see if enough time has elapsed
-// Runs the "send string" command if enough time has passed, and resets the timer.
-void run_diablo_macro_check(void) {
- uint8_t dtime;
- for (dtime = 0; dtime < 4; dtime++) {
- if (check_dtimer(dtime) && diablo_key_time[dtime]) {
- diablo_timer[dtime] = timer_read();
- send_diablo_keystroke(dtime);
- }
- }
-}
-#endif // TAP_DANCE_ENABLE
+void tap(uint16_t keycode){ register_code(keycode); unregister_code(keycode); };
// Add reconfigurable functions here, for keymap customization
@@ -148,6 +65,11 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
}
__attribute__ ((weak))
+bool process_record_secrets(uint16_t keycode, keyrecord_t *record) {
+ return true;
+}
+
+__attribute__ ((weak))
uint32_t layer_state_set_keymap (uint32_t state) {
return state;
}
@@ -159,9 +81,12 @@ void led_set_keymap(uint8_t usb_led) {}
// Call user matrix init, set default RGB colors and then
// call the keymap's init function
void matrix_init_user(void) {
- uint8_t default_layer = eeconfig_read_default_layer();
userspace_config.raw = eeprom_read_byte(EECONFIG_USERSPACE);
+#ifdef AUDIO_CLICKY
+ clicky_enable = userspace_config.clicky_enable;
+#endif
+
#ifdef BOOTLOADER_CATERINA
DDRD &= ~(1<<5);
PORTD &= ~(1<<5);
@@ -170,39 +95,15 @@ void matrix_init_user(void) {
PORTB &= ~(1<<0);
#endif
- if (userspace_config.rgb_layer_change) {
-#ifdef RGBLIGHT_ENABLE
- rgblight_enable();
-#endif // RGBLIGHT_ENABLE
- if (default_layer & (1UL << _COLEMAK)) {
- #ifdef RGBLIGHT_ENABLE
- rgblight_sethsv_magenta();
- #endif // RGBLIGHT_ENABLE
- } else if (default_layer & (1UL << _DVORAK)) {
- #ifdef RGBLIGHT_ENABLE
- rgblight_sethsv_green();
- #endif // RGBLIGHT_ENABLE
- } else if (default_layer & (1UL << _WORKMAN)) {
- #ifdef RGBLIGHT_ENABLE
- rgblight_sethsv_goldenrod();
- #endif // RGBLIGHT_ENABLE
- } else {
- #ifdef RGBLIGHT_ENABLE
- rgblight_sethsv_teal();
- #endif // RGBLIGHT_ENABLE
- }
- }
-#ifdef AUDIO_CLICKY
- clicky_enable = userspace_config.clicky_enable;
-#endif
-
-#if ( defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE) )
+#if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE))
set_unicode_input_mode(UC_WINC);
#endif //UNICODE_ENABLE
-
+ matrix_init_rgb();
matrix_init_keymap();
}
+
+
// No global matrix scan code, so just run keymap's matrix
// scan function
void matrix_scan_user(void) {
@@ -211,24 +112,14 @@ void matrix_scan_user(void) {
run_diablo_macro_check();
#endif // TAP_DANCE_ENABLE
+#ifdef RGBLIGHT_ENABLE
+ matrix_scan_rgb();
+#endif // RGBLIGHT_ENABLE
+
matrix_scan_keymap();
}
-// This block is for all of the gaming macros, as they were all doing
-// the same thing, but with differring text sent.
-bool send_game_macro(const char *str, keyrecord_t *record, bool override) {
- if (!record->event.pressed || override) {
- clear_keyboard();
- tap(userspace_config.is_overwatch ? KC_BSPC : KC_ENTER);
- wait_ms(50);
- send_string(str);
- wait_ms(50);
- tap(KC_ENTER);
- }
- if (override) wait_ms(3000);
- return false;
-}
// Defines actions tor my global custom keycodes. Defined in drashna.h file
@@ -236,10 +127,9 @@ bool send_game_macro(const char *str, keyrecord_t *record, bool override) {
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
// If console is enabled, it will print the matrix position and status of each key pressed
-#ifdef CONSOLE_ENABLE
+#ifdef KEYLOGGER_ENABLE
xprintf("KL: row: %u, column: %u, pressed: %u\n", record->event.key.col, record->event.key.row, record->event.pressed);
-#endif //CONSOLE_ENABLE
-
+#endif //KEYLOGGER_ENABLE
switch (keycode) {
case KC_QWERTY:
@@ -287,8 +177,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case KC_RESET: // Custom RESET code that sets RGBLights to RED
if (!record->event.pressed) {
#ifdef RGBLIGHT_ENABLE
- rgblight_enable();
- rgblight_mode(1);
+ rgblight_enable_noeeprom();
+ rgblight_mode_noeeprom(1);
rgblight_setrgb_red();
#endif // RGBLIGHT_ENABLE
reset_keyboard();
@@ -300,6 +190,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case EPRM: // Resets EEPROM
if (record->event.pressed) {
eeconfig_init();
+ default_layer_set(1UL<<eeconfig_read_default_layer());
+ layer_state_set(layer_state);
}
return false;
break;
@@ -310,24 +202,24 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return false;
break;
-
- case KC_SECRET_1 ... KC_SECRET_5: // Secrets! Externally defined strings, not stored in repo
- if (!record->event.pressed) {
- clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED);
- send_string_P(secret[keycode - KC_SECRET_1]);
- }
- return false;
- break;
-
+/* Code has been depreciated
+ case KC_SECRET_1 ... KC_SECRET_5: // Secrets! Externally defined strings, not stored in repo
+ if (!record->event.pressed) {
+ clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED);
+ send_string(decoy_secret[keycode - KC_SECRET_1]);
+ }
+ return false;
+ break;
+*/
// These are a serious of gaming macros.
// Only enables for the viterbi, basically,
// to save on firmware space, since it's limited.
-#if !(defined(KEYBOARD_orthodox_rev1) || defined(KEYBOARD_orthodox_rev3) || defined(KEYBOARD_ergodox_ez) || defined(KEYBOARD_iris_rev2))
+#ifdef MACROS_ENABLED
case KC_OVERWATCH: // Toggle's if we hit "ENTER" or "BACKSPACE" to input macros
if (record->event.pressed) { userspace_config.is_overwatch ^= 1; eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw); }
#ifdef RGBLIGHT_ENABLE
- userspace_config.is_overwatch ? rgblight_mode(17) : rgblight_mode(18);
+ userspace_config.is_overwatch ? rgblight_mode_noeeprom(17) : rgblight_mode_noeeprom(18);
#endif //RGBLIGHT_ENABLE
return false; break;
case KC_SALT:
@@ -353,40 +245,19 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return send_game_macro("OMG!!! C9!!!", record, false);
case KC_GGEZ:
return send_game_macro("That was a fantastic game, though it was a bit easy. Try harder next time!", record, false);
-#endif // !(defined(KEYBOARD_orthodox_rev1) || defined(KEYBOARD_orthodox_rev3) || defined(KEYBOARD_ergodox_ez))
+#endif // MACROS_ENABLED
-#ifdef TAP_DANCE_ENABLE
case KC_DIABLO_CLEAR: // reset all Diablo timers, disabling them
+#ifdef TAP_DANCE_ENABLE
if (record->event.pressed) {
uint8_t dtime;
for (dtime = 0; dtime < 4; dtime++) {
diablo_key_time[dtime] = diablo_times[0];
}
}
+#endif // TAP_DANCE_ENABLE#endif
return false; break;
-#endif // TAP_DANCE_ENABLE
-
-
- case KC_RGB_T: // This allows me to use underglow as layer indication, or as normal
-#ifdef RGBLIGHT_ENABLE
- if (record->event.pressed) {
- userspace_config.rgb_layer_change ^= 1;
- eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw);
- if (userspace_config.rgb_layer_change) {
- layer_state_set(layer_state); // This is needed to immediately set the layer color (looks better)
- }
- }
-#endif // RGBLIGHT_ENABLE
- return false; break;
-#ifdef RGBLIGHT_ENABLE
- case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions
- if (record->event.pressed) { //This disables layer indication, as it's assumed that if you're changing this ... you want that disabled
- userspace_config.rgb_layer_change = false;
- eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw);
- }
- return true; break;
-#endif // RGBLIGHT_ENABLE
case KC_CCCV: // One key copy/paste
@@ -443,7 +314,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif // UNICODE_ENABLE
}
- return process_record_keymap(keycode, record);
+ return process_record_keymap(keycode, record) && process_record_secrets(keycode, record) && process_record_user_rgb(keycode, record);
}
@@ -452,111 +323,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
// on layer change, no matter where the change was initiated
// Then runs keymap's layer change check
uint32_t layer_state_set_user(uint32_t state) {
- uint8_t default_layer = eeconfig_read_default_layer();
state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST);
-
- switch (biton32(state)) {
- case _MACROS:
-#ifdef RGBLIGHT_ENABLE
- if (userspace_config.rgb_layer_change) {
- rgblight_sethsv_orange();
- userspace_config.is_overwatch ? rgblight_mode(17) : rgblight_mode(18);
- }
-#endif // RGBLIGHT_ENABLE
-
- break;
- case _MEDIA:
-#ifdef RGBLIGHT_ENABLE
- if (userspace_config.rgb_layer_change) {
- rgblight_sethsv_chartreuse();
- rgblight_mode(22);
- }
-#endif // RGBLIGHT_ENABLE
-
- break;
- case _GAMEPAD:
-#ifdef RGBLIGHT_ENABLE
- if (userspace_config.rgb_layer_change) {
- rgblight_sethsv_orange();
- rgblight_mode(17);
- }
-#endif // RGBLIGHT_ENABLE
-
- break;
- case _DIABLO:
-#ifdef RGBLIGHT_ENABLE
- if (userspace_config.rgb_layer_change) {
- rgblight_sethsv_red();
- rgblight_mode(5);
- }
-#endif // RGBLIGHT_ENABLE
-
- break;
- case _RAISE:
#ifdef RGBLIGHT_ENABLE
- if (userspace_config.rgb_layer_change) {
- rgblight_sethsv_yellow();
- rgblight_mode(5);
- }
-#endif // RGBLIGHT_ENABLE
-
- break;
- case _LOWER:
-#ifdef RGBLIGHT_ENABLE
- if (userspace_config.rgb_layer_change) {
- rgblight_sethsv_orange();
- rgblight_mode(5);
- }
-#endif // RGBLIGHT_ENABLE
-
- break;
- case _ADJUST:
-#ifdef RGBLIGHT_ENABLE
- if (userspace_config.rgb_layer_change) {
- rgblight_sethsv_red();
- rgblight_mode(23);
- }
-#endif // RGBLIGHT_ENABLE
-
- break;
- default: // for any other layers, or the default layer
- if (default_layer & (1UL << _COLEMAK)) {
-#ifdef RGBLIGHT_ENABLE
- if (userspace_config.rgb_layer_change) { rgblight_sethsv_magenta(); }
-#endif // RGBLIGHT_ENABLE
-
- }
- else if (default_layer & (1UL << _DVORAK)) {
-#ifdef RGBLIGHT_ENABLE
- if (userspace_config.rgb_layer_change) { rgblight_sethsv_green(); }
+ state = layer_state_set_rgb(state);
#endif // RGBLIGHT_ENABLE
-
- }
- else if (default_layer & (1UL << _WORKMAN)) {
-#ifdef RGBLIGHT_ENABLE
- if (userspace_config.rgb_layer_change) { rgblight_sethsv_goldenrod(); }
-#endif // RGBLIGHT_ENABLE
-
- }
- else {
-#ifdef RGBLIGHT_ENABLE
- if (userspace_config.rgb_layer_change) { rgblight_sethsv_teal(); }
-#endif // RGBLIGHT_ENABLE
-
- }
- if (biton32(state) == _MODS) { // If the non-OSM layer is enabled, then breathe
-#ifdef RGBLIGHT_ENABLE
- if (userspace_config.rgb_layer_change) { rgblight_mode(2); }
-#endif // RGBLIGHT_ENABLE
-
- } else { // otherwise, stay solid
-#ifdef RGBLIGHT_ENABLE
- if (userspace_config.rgb_layer_change) { rgblight_mode(1); }
-#endif // RGBLIGHT_ENABLE
-
- }
- break;
- }
return layer_state_set_keymap (state);
}
diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h
index 87a72f5280..e035b86fbf 100644
--- a/users/drashna/drashna.h
+++ b/users/drashna/drashna.h
@@ -42,6 +42,7 @@ enum userspace_layers {
#define MODS_ALT_MASK (MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT))
#define MODS_GUI_MASK (MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI))
+
// RGB color codes are no longer located here anymore. Instead, you will want to
// head to https://github.com/qmk/qmk_firmware/blob/master/quantum/rgblight_list.h
@@ -51,7 +52,11 @@ extern bool clicky_enable;
void rgblight_sethsv_default_helper(uint8_t index);
#endif // RGBLIGHT_ENABLE
-#define EECONFIG_USERSPACE (uint8_t *)20
+void tap(uint16_t keycode);
+bool process_record_secrets(uint16_t keycode, keyrecord_t *record);
+
+
+#define EECONFIG_USERSPACE (uint8_t *)19
typedef union {
uint8_t raw;
@@ -59,6 +64,7 @@ typedef union {
bool clicky_enable :1;
bool rgb_layer_change :1;
bool is_overwatch :1;
+ bool nuke_switch :1;
};
} userspace_config_t;
@@ -91,6 +97,8 @@ enum userspace_custom_keycodes {
KC_SECRET_4,
KC_SECRET_5,
KC_CCCV,
+ KC_NUKE,
+
#ifdef UNICODE_ENABLE
UC_FLIP,
#endif //UNICODE_ENABLE
@@ -112,8 +120,8 @@ enum userspace_custom_keycodes {
#define DVORAK KC_DVORAK
#define COLEMAK KC_COLEMAK
#define WORKMAN KC_WORKMAN
-#define KC_RST KC_RESET
+#define KC_RST KC_RESET
#ifdef SWAP_HANDS_ENABLE
#define KC_C1R3 SH_TT
@@ -125,6 +133,16 @@ enum userspace_custom_keycodes {
#define KC_MLSF OSM(MOD_LSFT)
#define KC_MRSF OSM(MOD_RSFT)
+#define OS_LGUI OSM(MOD_LGUI)
+#define OS_RGUI OSM(MOD_RGUI)
+#define OS_LSFT OSM(MOD_LSFT)
+#define OS_RSFT OSM(MOD_RSFT)
+#define OS_LCTL OSM(MOD_LCTL)
+#define OS_RCTL OSM(MOD_RCTL)
+#define OS_LALT OSM(MOD_LALT)
+#define OS_RALT OSM(MOD_RALT)
+#define ALT_APP ALT_T(KC_APP)
+
#define MG_NKRO MAGIC_TOGGLE_NKRO
@@ -200,8 +218,8 @@ enum {
#define ______________COLEMAK_MOD_DH_L3____________ CTL_T(KC_Z), KC_X, KC_C, KC_D, KC_V
#define ______________COLEMAK_MOD_DH_R1____________ KC_J, KC_L, KC_U, KC_Y, KC_SCLN
-#define ______________COLEMAK_MOD_DH_R2____________ KC_K, KC_N, KC_E, KC_I, KC_O
-#define ______________COLEMAK_MOD_DH_R3____________ KC_M, KC_H, KC_COMM, KC_DOT, CTL_T(KC_SLASH)
+#define ______________COLEMAK_MOD_DH_R2____________ KC_M, KC_N, KC_E, KC_I, KC_O
+#define ______________COLEMAK_MOD_DH_R3____________ KC_K, KC_H, KC_COMM, KC_DOT, CTL_T(KC_SLASH)
#define _________________DVORAK_L1_________________ KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y
@@ -227,7 +245,7 @@ enum {
#define _________________NORMAN_L3_________________ CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B
#define _________________NORMAN_R1_________________ KC_J, KC_U, KC_R, KC_L, KC_SCLN
-#define _________________NORMAN_R2_________________ KC_J, KC_N, KC_I, KC_O, KC_U
+#define _________________NORMAN_R2_________________ KC_Y, KC_N, KC_I, KC_O, KC_U
#define _________________NORMAN_R3_________________ KC_P, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLASH)
#define ________________NUMBER_LEFT________________ KC_1, KC_2, KC_3, KC_4, KC_5
@@ -243,7 +261,7 @@ enum {
#define ___________ERGODOX_BOTTOM_RIGHT____________ KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
-#define __________________ERGODOX_THUMB_CLUSTER_____________________ ALT_T(KC_APP), KC_LGUI, KC_RGUI, CTL_T(KC_ESCAPE), \
+#define __________________ERGODOX_THUMB_CLUSTER_____________________ ALT_T(KC_APP), OSM(MOD_LGUI), OSM(MOD_RGUI), CTL_T(KC_ESCAPE), \
KC_HOME, KC_PGUP, \
LT(_LOWER, KC_SPACE),KC_BSPC, KC_END, KC_PGDN, KC_DEL, LT(_RAISE, KC_ENTER)
diff --git a/users/drashna/readme.md b/users/drashna/readme.md
index ddf24b24f7..0aa73ece90 100644
--- a/users/drashna/readme.md
+++ b/users/drashna/readme.md
@@ -96,7 +96,7 @@ Then you can create this file and add your macro strings to it:
###### secrets.h
```c
-PROGMEM const char secret[][64] = {
+static const char * const secrets[] = {
"secret1",
"secret2",
"secret3",
@@ -116,7 +116,7 @@ In the `<name>.c` file, you will want to add this to the top:
#else
// `PROGMEM const char secret[][x]` may work better, but it takes up more space in the firmware
// And I'm not familiar enough to know which is better or why...
-PROGMEM const char secret[][64] = {
+static const char * const secrets[] = {
"test1",
"test2",
"test3",
diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c
new file mode 100644
index 0000000000..af7190cc3e
--- /dev/null
+++ b/users/drashna/rgb_stuff.c
@@ -0,0 +1,261 @@
+#include "drashna.h"
+#include "rgb_stuff.h"
+
+extern rgblight_config_t rgblight_config;
+extern userspace_config_t userspace_config;
+
+#ifdef RGBLIGHT_ENABLE
+void rgblight_sethsv_default_helper(uint8_t index) {
+ rgblight_sethsv_at(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, index);
+}
+#endif // RGBLIGHT_ENABLE
+
+#ifdef INDICATOR_LIGHTS
+uint8_t last_mod;
+uint8_t last_led;
+uint8_t last_osm;
+uint8_t current_mod;
+uint8_t current_led;
+uint8_t current_osm;
+
+
+void set_rgb_indicators(uint8_t this_mod, uint8_t this_led, uint8_t this_osm) {
+ if (userspace_config.rgb_layer_change && biton32(layer_state) == 0) {
+ if (this_mod & MODS_SHIFT_MASK || this_led & (1<<USB_LED_CAPS_LOCK) || this_osm & MODS_SHIFT_MASK) {
+ rgblight_sethsv_at(0, 255, 255, SHFT_LED1);
+ rgblight_sethsv_at(0, 255, 255, SHFT_LED2);
+ } else {
+ rgblight_sethsv_default_helper(SHFT_LED1);
+ rgblight_sethsv_default_helper(SHFT_LED2);
+ }
+ if (this_mod & MODS_CTRL_MASK || this_osm & MODS_CTRL_MASK) {
+ rgblight_sethsv_at(51, 255, 255, CTRL_LED1);
+ rgblight_sethsv_at(51, 255, 255, CTRL_LED2);
+ } else {
+ rgblight_sethsv_default_helper(CTRL_LED1);
+ rgblight_sethsv_default_helper(CTRL_LED2);
+ }
+ if (this_mod & MODS_GUI_MASK || this_osm & MODS_GUI_MASK) {
+ rgblight_sethsv_at(120, 255, 255, GUI_LED1);
+ rgblight_sethsv_at(120, 255, 255, GUI_LED2);
+ } else {
+ rgblight_sethsv_default_helper(GUI_LED1);
+ rgblight_sethsv_default_helper(GUI_LED2);
+ }
+ }
+}
+
+void matrix_scan_indicator(void) {
+ current_mod = get_mods();
+ current_led = host_keyboard_leds();
+ current_osm = get_oneshot_mods();
+
+ set_rgb_indicators(current_mod, current_led, current_osm);
+
+ last_mod = current_mod;
+ last_led = current_led;
+ last_osm = current_osm;
+
+}
+#endif //INDICATOR_LIGHTS
+
+#ifdef RGBLIGHT_TWINKLE
+static rgblight_fadeout lights[RGBLED_NUM];
+
+__attribute__ ((weak))
+bool indicator_is_this_led_used(uint8_t index) { return false; }
+
+void scan_rgblight_fadeout(void) { // Don't effing change this function .... rgblight_sethsv is supppppper intensive
+ bool litup = false;
+ for (uint8_t light_index = 0 ; light_index < RGBLED_NUM ; ++light_index ) {
+ if (lights[light_index].enabled && timer_elapsed(lights[light_index].timer) > 10) {
+ rgblight_fadeout *light = &lights[light_index];
+ litup = true;
+
+ if (light->life) {
+ light->life -= 1;
+ if (biton32(layer_state) == 0) {
+ sethsv(light->hue + rand() % 0xF, 255, light->life, (LED_TYPE *)&led[light_index]);
+ }
+ light->timer = timer_read();
+ }
+ else {
+ if (light->enabled && biton32(layer_state) == 0) { rgblight_sethsv_default_helper(light_index); }
+ litup = light->enabled = false;
+ }
+ }
+ }
+ if (litup && biton32(layer_state) == 0) {
+ rgblight_set();
+ }
+}
+
+void start_rgb_light(void) {
+
+ uint8_t indices[RGBLED_NUM];
+ uint8_t indices_count = 0;
+ uint8_t min_life = 0xFF;
+ uint8_t min_life_index = -1;
+ for (uint8_t index = 0 ; index < RGBLED_NUM ; ++index ) {
+ if (indicator_is_this_led_used(index)) { continue; }
+ if (lights[index].enabled) {
+ if (min_life_index == -1 ||
+ lights[index].life < min_life)
+ {
+ min_life = lights[index].life;
+ min_life_index = index;
+ }
+ continue;
+ }
+
+ indices[indices_count] = index;
+ ++indices_count;
+ }
+
+ uint8_t light_index;
+ if (!indices_count) {
+ light_index = min_life_index;
+ }
+ else {
+ light_index = indices[rand() % indices_count];
+ }
+
+ rgblight_fadeout *light = &lights[light_index];
+ light->enabled = true;
+ light->timer = timer_read();
+ light->life = 0xC0 + rand() % 0x40;
+
+ light->hue = rgblight_config.hue + (rand() % 0xB4) - 0x54;
+
+ rgblight_sethsv_at(light->hue, 255, light->life, light_index);
+}
+#endif
+
+
+bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) {
+ switch (keycode) {
+#ifdef RGBLIGHT_TWINKLE
+ case KC_A ... KC_SLASH:
+ case KC_F1 ... KC_F12:
+ case KC_INSERT ... KC_UP:
+ case KC_KP_SLASH ... KC_KP_DOT:
+ case KC_F13 ... KC_F24:
+ case KC_AUDIO_MUTE ... KC_MEDIA_REWIND:
+ if (record->event.pressed) { start_rgb_light(); }
+ return true; break;
+#endif // RGBLIGHT_TWINKLE
+ case KC_RGB_T: // This allows me to use underglow as layer indication, or as normal
+#ifdef RGBLIGHT_ENABLE
+ if (record->event.pressed) {
+ userspace_config.rgb_layer_change ^= 1;
+ xprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change);
+ eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw);
+ if (userspace_config.rgb_layer_change) {
+ layer_state_set(layer_state); // This is needed to immediately set the layer color (looks better)
+ }
+ }
+#endif // RGBLIGHT_ENABLE
+ return false; break;
+#ifdef RGBLIGHT_ENABLE
+ case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions
+ if (record->event.pressed) { //This disables layer indication, as it's assumed that if you're changing this ... you want that disabled
+ if (userspace_config.rgb_layer_change) {
+ userspace_config.rgb_layer_change = false;
+ xprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change);
+ eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw);
+ }
+ }
+ return true; break;
+#endif // RGBLIGHT_ENABLE
+ }
+ return true;
+}
+
+
+
+void matrix_init_rgb(void) {
+#ifdef INDICATOR_LIGHTS
+ current_mod = last_mod = get_mods();
+ current_led = last_led = host_keyboard_leds();
+ current_osm = last_osm = get_oneshot_mods();
+#endif
+
+ if (userspace_config.rgb_layer_change) {
+ uint8_t default_layer = eeconfig_read_default_layer();
+ rgblight_enable_noeeprom();
+ if (default_layer & (1UL << _COLEMAK)) {
+ rgblight_sethsv_magenta();
+ } else if (default_layer & (1UL << _DVORAK)) {
+ rgblight_sethsv_green();
+ } else if (default_layer & (1UL << _WORKMAN)) {
+ rgblight_sethsv_goldenrod();
+ } else {
+ rgblight_sethsv_cyan();
+ }
+ }
+}
+
+void matrix_scan_rgb(void) {
+#ifdef RGBLIGHT_TWINKLE
+ scan_rgblight_fadeout();
+#endif // RGBLIGHT_ENABLE
+
+#ifdef INDICATOR_LIGHTS
+ matrix_scan_indicator();
+#endif
+
+}
+
+
+uint32_t layer_state_set_rgb(uint32_t state) {
+#ifdef RGBLIGHT_ENABLE
+ uint8_t default_layer = eeconfig_read_default_layer();
+ if (userspace_config.rgb_layer_change) {
+ switch (biton32(state)) {
+ case _MACROS:
+ rgblight_sethsv_noeeprom_orange();
+ userspace_config.is_overwatch ? rgblight_mode_noeeprom(17) : rgblight_mode_noeeprom(18);
+ break;
+ case _MEDIA:
+ rgblight_sethsv_noeeprom_chartreuse();
+ rgblight_mode_noeeprom(22);
+ break;
+ case _GAMEPAD:
+ rgblight_sethsv_noeeprom_orange();
+ rgblight_mode_noeeprom(17);
+ break;
+ case _DIABLO:
+ rgblight_sethsv_noeeprom_red();
+ rgblight_mode_noeeprom(5);
+ break;
+ case _RAISE:
+ rgblight_sethsv_noeeprom_yellow();
+ rgblight_mode_noeeprom(5);
+ break;
+ case _LOWER:
+ rgblight_sethsv_noeeprom_orange();
+ rgblight_mode_noeeprom(5);
+ break;
+ case _ADJUST:
+ rgblight_sethsv_noeeprom_red();
+ rgblight_mode_noeeprom(23);
+ break;
+ default: // for any other layers, or the default layer
+ if (default_layer & (1UL << _COLEMAK)) {
+ rgblight_sethsv_noeeprom_magenta();
+ } else if (default_layer & (1UL << _DVORAK)) {
+ rgblight_sethsv_noeeprom_green();
+ } else if (default_layer & (1UL << _WORKMAN)) {
+ rgblight_sethsv_noeeprom_goldenrod();
+ } else {
+ rgblight_sethsv_noeeprom_cyan();
+ }
+ biton32(state) == _MODS ? rgblight_mode_noeeprom(2) : rgblight_mode_noeeprom(1); // if _MODS layer is on, then breath to denote it
+ break;
+ }
+// layer_state_set_indicator(); // Runs every scan, so need to call this here .... since I can't get it working "right" anyhow
+ }
+#endif // RGBLIGHT_ENABLE
+
+ return state;
+}
diff --git a/users/drashna/rgb_stuff.h b/users/drashna/rgb_stuff.h
new file mode 100644
index 0000000000..6426ea266f
--- /dev/null
+++ b/users/drashna/rgb_stuff.h
@@ -0,0 +1,16 @@
+#include "quantum.h"
+
+typedef struct {
+ bool enabled;
+ uint8_t hue;
+ uint16_t timer;
+ uint8_t life;
+} rgblight_fadeout;
+
+bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record);
+void scan_rgblight_fadeout(void);
+void matrix_init_rgb(void);
+void matrix_scan_rgb(void);
+uint32_t layer_state_set_rgb(uint32_t state);
+
+
diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk
index e2c5a2995b..18df665c0d 100644
--- a/users/drashna/rules.mk
+++ b/users/drashna/rules.mk
@@ -1,11 +1,34 @@
-SRC += drashna.c
+SRC += drashna.c secrets.c rgb_stuff.c
+
+ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
+ SRC += tap_dances.c
+endif
+
EXTRAFLAGS += -flto
ifeq ($(strip $(NO_SECRETS)), yes)
OPT_DEFS += -DNO_SECRETS
endif
-ifeq ($(strip $(INDICATOR_LIGHTS)), yes)
- OPT_DEFS += -DINDICATOR_LIGHTS
+ifdef RGBLIGHT_ENABLE
+ ifeq ($(strip $(INDICATOR_LIGHTS)), yes)
+ OPT_DEFS += -DINDICATOR_LIGHTS
+ endif
+ ifeq ($(strip $(RGBLIGHT_TWINKLE)), yes)
+ OPT_DEFS += -DRGBLIGHT_TWINKLE
+ endif
+ ifeq ($(strip $(RGBLIGHT_NOEEPROM)), yes)
+ OPT_DEFS += -DRGBLIGHT_NOEEPROM
+ endif
+endif
+
+ifeq ($(strip $(MACROS_ENABLED)), yes)
+ OPT_DEFS += -DMACROS_ENABLED
+endif
+
+ifdef CONSOLE_ENABLE
+ ifeq ($(strip $(KEYLOGGER_ENABLE)), yes)
+ OPT_DEFS += -DKEYLOGGER_ENABLE
+ endif
endif
diff --git a/users/drashna/tap_dances.c b/users/drashna/tap_dances.c
new file mode 100644
index 0000000000..c9e4b1d0ff
--- /dev/null
+++ b/users/drashna/tap_dances.c
@@ -0,0 +1,65 @@
+#include "drashna.h"
+#include "tap_dances.h"
+
+
+//define diablo macro timer variables
+uint16_t diablo_timer[4];
+uint8_t diablo_times[] = { 0, 1, 3, 5, 10, 30 };
+uint8_t diablo_key_time[4];
+
+// has the correct number of seconds elapsed (as defined by diablo_times)
+bool check_dtimer(uint8_t dtimer) { return (timer_elapsed(diablo_timer[dtimer]) < (diablo_key_time[dtimer] * 1000)) ? false : true; };
+
+// Cycle through the times for the macro, starting at 0, for disabled.
+// Max of six values, so don't exceed
+void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data, uint8_t diablo_key) {
+ if (state->count >= 7) {
+ diablo_key_time[diablo_key] = diablo_times[0];
+ reset_tap_dance(state);
+ } else {
+ diablo_key_time[diablo_key] = diablo_times[state->count - 1];
+ }
+}
+
+// Would rather have one function for all of this, but no idea how to do that...
+void diablo_tapdance1(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 0); }
+void diablo_tapdance2(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 1); }
+void diablo_tapdance3(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 2); }
+void diablo_tapdance4(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 3); }
+
+//Tap Dance Definitions
+qk_tap_dance_action_t tap_dance_actions[] = {
+ // tap once to disable, and more to enable timed micros
+ [TD_D3_1] = ACTION_TAP_DANCE_FN(diablo_tapdance1),
+ [TD_D3_2] = ACTION_TAP_DANCE_FN(diablo_tapdance2),
+ [TD_D3_3] = ACTION_TAP_DANCE_FN(diablo_tapdance3),
+ [TD_D3_4] = ACTION_TAP_DANCE_FN(diablo_tapdance4),
+};
+
+// Sends the key press to system, but only if on the Diablo layer
+void send_diablo_keystroke(uint8_t diablo_key) {
+ if (biton32(layer_state) == _DIABLO) {
+ switch (diablo_key) {
+ case 0:
+ tap(KC_1); break;
+ case 1:
+ tap(KC_2); break;
+ case 2:
+ tap(KC_3); break;
+ case 3:
+ tap(KC_4); break;
+ }
+ }
+}
+
+// Checks each of the 4 timers/keys to see if enough time has elapsed
+// Runs the "send string" command if enough time has passed, and resets the timer.
+void run_diablo_macro_check(void) {
+ uint8_t dtime;
+ for (dtime = 0; dtime < 4; dtime++) {
+ if (check_dtimer(dtime) && diablo_key_time[dtime]) {
+ diablo_timer[dtime] = timer_read();
+ send_diablo_keystroke(dtime);
+ }
+ }
+}
diff --git a/users/drashna/tap_dances.h b/users/drashna/tap_dances.h
new file mode 100644
index 0000000000..8935753f6c
--- /dev/null
+++ b/users/drashna/tap_dances.h
@@ -0,0 +1,7 @@
+//define diablo macro timer variables
+extern uint16_t diablo_timer[4];
+extern uint8_t diablo_times[];
+extern uint8_t diablo_key_time[4];
+
+
+void run_diablo_macro_check(void);