diff options
author | Drashna Jaelre <drashna@live.com> | 2019-03-15 08:57:44 -0700 |
---|---|---|
committer | MechMerlin <30334081+mechmerlin@users.noreply.github.com> | 2019-03-15 08:57:44 -0700 |
commit | 493fbb3dc1423e0d42e57a6dc7ba38b880b37eb5 (patch) | |
tree | d351bb45b24f55eb355b5724f97b0942214fd781 /users/drashna | |
parent | e0a03bfa6c148da2936b27a2285f1928c5574ac0 (diff) |
[Keymap] Update to drashna keymaps: Conform to QMK Standards Edition (#5377)
* Use correct functions for dip switch code
* Some planck cleanup
* Hopefully fix RGB Sleeping with RGB Matrix
* Add rgbmatrix extern
* Add numpad 5x6 layout
* RGB Tweaks
* Add RGB startup animation
* Minor RGB Fixes
* Turn off RBG on planck
* Enable separate storage of EEPROM
* Update Macro pad
* Add BJohnson Keymap and minor darshna tweaks
* Clean up rgb and other code for new numpad
* Remove clicky hachy thing
* Update my code to use built in MOD_MASK defines
* Fix up modifier calls
* Tweak to KC_MAKE
* Tweak to KC_MAKE
* Add Semi-colon to numpad
* Preprocess out rgb matrix stuff if not enabled
* Formatting of KC_MAKE
* Add stuff for matrix and light rgb coexistance
* Fix bad spelling
* Change where layer indication shows based on rgblight status
* Force set mods in KC_MAKE
* Optimize CRKBD
Diffstat (limited to 'users/drashna')
-rw-r--r-- | users/drashna/config.h | 8 | ||||
-rw-r--r-- | users/drashna/drashna.c | 6 | ||||
-rw-r--r-- | users/drashna/drashna.h | 5 | ||||
-rw-r--r-- | users/drashna/process_records.c | 45 | ||||
-rw-r--r-- | users/drashna/rgb_stuff.c | 37 | ||||
-rw-r--r-- | users/drashna/rules.mk | 4 |
6 files changed, 49 insertions, 56 deletions
diff --git a/users/drashna/config.h b/users/drashna/config.h index 2e125d1e4e..2abd326dac 100644 --- a/users/drashna/config.h +++ b/users/drashna/config.h @@ -15,10 +15,10 @@ // #ifdef RGBLIGHT_ENABLE // #define NO_MUSIC_MODE // #endif //RGBLIGHT_ENABLE/ - #ifndef __arm__ - #undef NOTE_REST - #define NOTE_REST 1.00f - #endif // !__arm__ + // #ifndef __arm__ + // #undef NOTE_REST + // #define NOTE_REST 1.00f + // #endif // !__arm__ #define UNICODE_SONG_OSX SONG(RICK_ROLL) #define UNICODE_SONG_LNX SONG(RICK_ROLL) diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index 8019f26676..6968a4b928 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c @@ -144,9 +144,9 @@ void shutdown_user (void) { rgblight_setrgb_red(); #endif // RGBLIGHT_ENABLE #ifdef RGB_MATRIX_ENABLE - uint16_t timer_start = timer_read(); - rgb_matrix_set_color_all( 0xFF, 0x00, 0x00 ); - while(timer_elapsed(timer_start) < 250) { wait_ms(1); } + // uint16_t timer_start = timer_read(); + // rgb_matrix_set_color_all( 0xFF, 0x00, 0x00 ); + // while(timer_elapsed(timer_start) < 250) { wait_ms(1); } #endif //RGB_MATRIX_ENABLE shutdown_keymap(); } diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h index ca55198e3e..c19b189434 100644 --- a/users/drashna/drashna.h +++ b/users/drashna/drashna.h @@ -53,11 +53,6 @@ enum userspace_layers { /* define modifiers here, since MOD_* doesn't seem to work for these */ -#define MODS_SHIFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)) -#define MODS_CTRL_MASK (MOD_BIT(KC_LCTL)|MOD_BIT(KC_RCTRL)) -#define MODS_ALT_MASK (MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT)) -#define MODS_GUI_MASK (MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) - bool mod_key_press_timer (uint16_t code, uint16_t mod_code, bool pressed); diff --git a/users/drashna/process_records.c b/users/drashna/process_records.c index 73cad92f60..2d9025b375 100644 --- a/users/drashna/process_records.c +++ b/users/drashna/process_records.c @@ -12,7 +12,6 @@ bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { return true; } - // Defines actions tor my global custom keycodes. Defined in drashna.h file // Then runs the _keymap's record handier if not processed here bool process_record_user(uint16_t keycode, keyrecord_t *record) { @@ -35,30 +34,28 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case KC_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader if (!record->event.pressed) { - #if !defined(KEYBOARD_viterbi) - uint8_t temp_mod = get_mods(); - uint8_t temp_osm = get_oneshot_mods(); - clear_mods(); clear_oneshot_mods(); - #endif + uint8_t temp_mod = get_mods(); + uint8_t temp_osm = get_oneshot_mods(); + clear_mods(); clear_oneshot_mods(); send_string_with_delay_P(PSTR("make " QMK_KEYBOARD ":" QMK_KEYMAP), MACRO_TIMER); - #if defined(KEYBOARD_viterbi) - send_string_with_delay_P(PSTR(":dfu" SS_TAP(X_ENTER)), MACRO_TIMER); - #else - if (temp_mod & MODS_SHIFT_MASK || temp_osm & MODS_SHIFT_MASK) { - #if defined(__arm__) - send_string_with_delay_P(PSTR(":dfu-util"), MACRO_TIMER); - #elif defined(BOOTLOADER_DFU) - send_string_with_delay_P(PSTR(":dfu"), MACRO_TIMER); - #elif defined(BOOTLOADER_HALFKAY) - send_string_with_delay_P(PSTR(":teensy"), MACRO_TIMER); - #elif defined(BOOTLOADER_CATERINA) - send_string_with_delay_P(PSTR(":avrdude"), MACRO_TIMER); - #endif // bootloader options - } - if (temp_mod & MODS_CTRL_MASK || temp_osm & MODS_CTRL_MASK) { send_string_with_delay_P(PSTR(" -j8 --output-sync"), MACRO_TIMER); } - send_string_with_delay_P(PSTR(SS_TAP(X_ENTER)), MACRO_TIMER); - set_mods(temp_mod); - #endif +#ifndef MAKE_BOOTLOADER + if ( ( temp_mod | temp_osm ) & MOD_MASK_SHIFT ) +#endif + { + #if defined(__arm__) + send_string_with_delay_P(PSTR(":dfu-util"), MACRO_TIMER); + #elif defined(BOOTLOADER_DFU) + send_string_with_delay_P(PSTR(":dfu"), MACRO_TIMER); + #elif defined(BOOTLOADER_HALFKAY) + send_string_with_delay_P(PSTR(":teensy"), MACRO_TIMER); + #elif defined(BOOTLOADER_CATERINA) + send_string_with_delay_P(PSTR(":avrdude"), MACRO_TIMER); + #endif // bootloader options + } + if ( ( temp_mod | temp_osm ) & MOD_MASK_CTRL) { send_string_with_delay_P(PSTR(" -j8 --output-sync"), MACRO_TIMER); } + send_string_with_delay_P(PSTR(SS_TAP(X_ENTER)), MACRO_TIMER); + set_mods(temp_mod); + set_oneshot_mods(temp_osm); } break; diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c index 7eaa7e9491..a98ad590cc 100644 --- a/users/drashna/rgb_stuff.c +++ b/users/drashna/rgb_stuff.c @@ -4,6 +4,7 @@ #if defined(RGBLIGHT_ENABLE) extern rgblight_config_t rgblight_config; +bool has_initialized; #elif defined(RGB_MATRIX_ENABLE) extern rgb_config_t rgb_matrix_config; #endif @@ -17,7 +18,7 @@ void rgblight_sethsv_default_helper(uint8_t index) { #ifdef INDICATOR_LIGHTS 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) { + if ( (this_mod | this_osm) & MOD_MASK_SHIFT || this_led & (1<<USB_LED_CAPS_LOCK) ) { #ifdef SHFT_LED1 rgblight_sethsv_at(120, 255, 255, SHFT_LED1); #endif // SHFT_LED1 @@ -32,7 +33,7 @@ void set_rgb_indicators(uint8_t this_mod, uint8_t this_led, uint8_t this_osm) { rgblight_sethsv_default_helper(SHFT_LED2); #endif // SHFT_LED2 } - if (this_mod & MODS_CTRL_MASK || this_osm & MODS_CTRL_MASK) { + if ( (this_mod | this_osm) & MOD_MASK_CTRL) { #ifdef CTRL_LED1 rgblight_sethsv_at(0, 255, 255, CTRL_LED1); #endif // CTRL_LED1 @@ -47,7 +48,7 @@ void set_rgb_indicators(uint8_t this_mod, uint8_t this_led, uint8_t this_osm) { rgblight_sethsv_default_helper(CTRL_LED2); #endif // CTRL_LED2 } - if (this_mod & MODS_GUI_MASK || this_osm & MODS_GUI_MASK) { + if ( (this_mod | this_osm) & MOD_MASK_GUI) { #ifdef GUI_LED1 rgblight_sethsv_at(51, 255, 255, GUI_LED1); #endif // GUI_LED1 @@ -62,7 +63,7 @@ void set_rgb_indicators(uint8_t this_mod, uint8_t this_led, uint8_t this_osm) { rgblight_sethsv_default_helper(GUI_LED2); #endif // GUI_LED2 } - if (this_mod & MODS_ALT_MASK || this_osm & MODS_ALT_MASK) { + if ( (this_mod | this_osm) & MOD_MASK_ALT) { #ifdef ALT_LED1 rgblight_sethsv_at(240, 255, 255, ALT_LED1); #endif // ALT_LED1 @@ -81,7 +82,9 @@ void set_rgb_indicators(uint8_t this_mod, uint8_t this_led, uint8_t this_osm) { } void matrix_scan_indicator(void) { - set_rgb_indicators(get_mods(), host_keyboard_leds(), get_oneshot_mods()); + if (has_initialized) { + set_rgb_indicators(get_mods(), host_keyboard_leds(), get_oneshot_mods()); + } } #endif //INDICATOR_LIGHTS @@ -244,22 +247,16 @@ bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) { void keyboard_post_init_rgb(void) { - #ifdef RGBLIGHT_ENABLE - if (userspace_config.rgb_layer_change) { - rgblight_enable_noeeprom(); - switch (biton32(eeconfig_read_default_layer())) { - case _COLEMAK: - rgblight_sethsv_noeeprom_magenta(); break; - case _DVORAK: - rgblight_sethsv_noeeprom_springgreen(); break; - case _WORKMAN: - rgblight_sethsv_noeeprom_goldenrod(); break; - default: - rgblight_sethsv_noeeprom_cyan(); break; - } - rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); - } + rgblight_enable_noeeprom(); + layer_state_set_user(layer_state); + uint16_t old_hue = rgblight_config.hue; + rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); + for (uint16_t i = 360; i > 0; i--) { + rgblight_sethsv_noeeprom( ( i + old_hue) % 360, 255, 255); + wait_ms(10); + } + layer_state_set_user(layer_state); #endif } diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk index 6d8612e71a..5050704a53 100644 --- a/users/drashna/rules.mk +++ b/users/drashna/rules.mk @@ -42,3 +42,7 @@ ifdef CONSOLE_ENABLE OPT_DEFS += -DKEYLOGGER_ENABLE endif endif + +ifeq ($(strip $(MAKE_BOOTLOADER)), yes) + OPT_DEFS += -DMAKE_BOOTLOADER +endif |