From f2101cfb6a2270345fe6235d4c36e2e0d49db528 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Mon, 5 Nov 2018 21:36:26 -0800 Subject: [PATCH] Update to drashna keymaps (#4365) * Consistency fixes and more eeprom defaults * Handle setting Unicode mode on eeprom reset better * Unicode EEPROM hack * Re-enable permissive hold and ignore mod tap * Set unicode input mode * More unicode stuff * more haaaaaacks * Attempted RGB Cleanup * Fix compiler issue * Add GitLab CI config for personal compiling * Add avr gcc version to GitLab CI script * Add rgblight init to matrix init --- layouts/community/ergodox/drashna/keymap.c | 2 +- layouts/community/ortho_4x12/drashna/config.h | 2 +- layouts/community/ortho_4x12/drashna/keymap.c | 52 ++++++++++++------- users/drashna/.gitlab-ci.yml | 26 ++++++++++ users/drashna/config.h | 4 +- users/drashna/drashna.c | 40 +++++++++----- users/drashna/rgb_stuff.c | 35 ++++--------- 7 files changed, 98 insertions(+), 63 deletions(-) create mode 100644 users/drashna/.gitlab-ci.yml diff --git a/layouts/community/ergodox/drashna/keymap.c b/layouts/community/ergodox/drashna/keymap.c index 518eaf034..360a2d9c6 100644 --- a/layouts/community/ergodox/drashna/keymap.c +++ b/layouts/community/ergodox/drashna/keymap.c @@ -40,7 +40,7 @@ bool skip_leds = false; KC_TAB, K01, K02, K03, K04, K05, TG(_DIABLO), TG(_DIABLO), K06, K07, K08, K09, K0A, KC_BSLS, \ KC_C1R3, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, KC_QUOT, \ KC_MLSF, CTL_T(K21), K22, K23, K24, K25, TG(_GAMEPAD), TG(_GAMEPAD), K26, K27, K28, K29, CTL_T(K2A), KC_MRSF, \ - KC_GRV, OSM(MOD_MEH),OSM(MOD_LGUI),KC_LBRC, KC_RBRC, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, UC_IRNY, \ + KC_GRV, OSM(MOD_MEH),OSM(MOD_LGUI),KC_LBRC, KC_RBRC, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, UC_SHRG, \ OS_LALT, OS_LGUI, OS_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/layouts/community/ortho_4x12/drashna/config.h b/layouts/community/ortho_4x12/drashna/config.h index b4c780cc1..f279651b6 100644 --- a/layouts/community/ortho_4x12/drashna/config.h +++ b/layouts/community/ortho_4x12/drashna/config.h @@ -18,7 +18,7 @@ #define RGB_MATRIX_KEYPRESSES // reacts to keypresses (will slow down matrix scan by a lot) // #define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (not recommened) // #define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects -#define RGB_DISABLE_WHEN_USB_SUSPENDED false // turn off effects when suspended +// #define RGB_DISABLE_WHEN_USB_SUSPENDED false // turn off effects when suspended // #define RGB_MATRIX_SKIP_FRAMES 1 // number of frames to skip when displaying animations (0 is full effect) if not defined defaults to 1 // #define RGB_MATRIX_MAXIMUM_BRIGHTNESS 200 // limits maximum brightness of LEDs to 200 out of 255. If not defined maximum brightness is set to 255 // #define EECONFIG_RGB_MATRIX (uint32_t *)16 diff --git a/layouts/community/ortho_4x12/drashna/keymap.c b/layouts/community/ortho_4x12/drashna/keymap.c index 108df6931..2a9e32cc8 100644 --- a/layouts/community/ortho_4x12/drashna/keymap.c +++ b/layouts/community/ortho_4x12/drashna/keymap.c @@ -17,6 +17,10 @@ #include QMK_KEYBOARD_H #include "drashna.h" +#ifdef RGB_MATRIX_ENABLE +extern bool g_suspend_state; +#endif + #ifdef BACKLIGHT_ENABLE enum planck_keycodes { BACKLIT = NEW_SAFE_RANGE, @@ -135,6 +139,15 @@ bool music_mask_user(uint16_t keycode) { #ifdef RGB_MATRIX_ENABLE +void suspend_power_down_keymap(void) +{ + rgb_matrix_set_suspend_state(true); +} + +void suspend_wakeup_init_keymap(void) +{ + rgb_matrix_set_suspend_state(false); +} void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) { rgb_led led; @@ -152,25 +165,26 @@ void rgb_matrix_indicators_user(void) { uint8_t this_mod = get_mods(); uint8_t this_led = host_keyboard_leds(); uint8_t this_osm = get_oneshot_mods(); - - switch (biton32(layer_state)) { - case _RAISE: - rgb_matrix_layer_helper(0xFF, 0xFF, 0x00, false); break; - case _LOWER: - rgb_matrix_layer_helper(0x00, 0xFF, 0x00, false); break; - case _ADJUST: - rgb_matrix_layer_helper(0xFF, 0x00, 0x00, false); break; - default: - switch (biton32(default_layer_state)) { - case _QWERTY: - rgb_matrix_layer_helper(0x00, 0xFF, 0xFF, true); break; - case _COLEMAK: - rgb_matrix_layer_helper(0xFF, 0x00, 0xFF, true); break; - case _DVORAK: - rgb_matrix_layer_helper(0x00, 0xFF, 0x00, true); break; - case _WORKMAN: - rgb_matrix_layer_helper(0xD9, 0xA5, 0x21, true); break; - } + if (!g_suspend_state) { + switch (biton32(layer_state)) { + case _RAISE: + rgb_matrix_layer_helper(0xFF, 0xFF, 0x00, false); break; + case _LOWER: + rgb_matrix_layer_helper(0x00, 0xFF, 0x00, false); break; + case _ADJUST: + rgb_matrix_layer_helper(0xFF, 0x00, 0x00, false); break; + default: + switch (biton32(default_layer_state)) { + case _QWERTY: + rgb_matrix_layer_helper(0x00, 0xFF, 0xFF, true); break; + case _COLEMAK: + rgb_matrix_layer_helper(0xFF, 0x00, 0xFF, true); break; + case _DVORAK: + rgb_matrix_layer_helper(0x00, 0xFF, 0x00, true); break; + case _WORKMAN: + rgb_matrix_layer_helper(0xD9, 0xA5, 0x21, true); break; + } + } } switch (biton32(default_layer_state)) { diff --git a/users/drashna/.gitlab-ci.yml b/users/drashna/.gitlab-ci.yml new file mode 100644 index 000000000..3c95ad850 --- /dev/null +++ b/users/drashna/.gitlab-ci.yml @@ -0,0 +1,26 @@ +stages: + - build + +qmk_firmware: + stage: build + variables: + GIT_SUBMODULE_STRATEGY: recursive + tags: + - linux + image: ubuntu + before_script: + - apt-get update -qy + - apt-get install -y build-essential avr-libc binutils-arm-none-eabi binutils-avr dfu-programmer dfu-util diffutils gcc gcc-arm-none-eabi gcc-avr git libnewlib-arm-none-eabi unzip wget zip + - avr-gcc --version + script: + - make iris/rev2:drashna iris/rev2:drashna_old ergodox_ez:drashna viterbi/rev1:drashna orthodox/rev1:drashna orthodox/rev3:drashna crkbd:drashna planck/light:drashna + artifacts: + name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG" + paths: + - ./*.hex + - ./*.bin + only: + - master + - drashna_keymaps + - merge-requests + - branches diff --git a/users/drashna/config.h b/users/drashna/config.h index 9d7d20add..7e6a7d1c8 100644 --- a/users/drashna/config.h +++ b/users/drashna/config.h @@ -44,8 +44,8 @@ // and when this option isn't enabled, z rapidly followed by x // actually sends Ctrl-x. That's bad.) #define IGNORE_MOD_TAP_INTERRUPT -#undef PERMISSIVE_HOLD -// #define TAPPING_FORCE_HOLD +#define PERMISSIVE_HOLD +//#define TAPPING_FORCE_HOLD //#define RETRO_TAPPING #define FORCE_NKRO diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index b2219e9aa..4111d2931 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c @@ -20,6 +20,12 @@ along with this program. If not, see . #include "rgb_stuff.h" userspace_config_t userspace_config; +#if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE)) + #define DRASHNA_UNICODE_MODE UC_WIN +#else + // set to 2 for UC_WIN, set to 4 for UC_WINC + #define DRASHNA_UNICODE_MODE 2 +#endif uint16_t copy_paste_timer; // Helper Functions @@ -154,19 +160,18 @@ void matrix_init_user(void) { userspace_config.raw = eeconfig_read_user(); -#ifdef BOOTLOADER_CATERINA - DDRD &= ~(1<<5); - PORTD &= ~(1<<5); + #ifdef BOOTLOADER_CATERINA + DDRD &= ~(1<<5); + PORTD &= ~(1<<5); - DDRB &= ~(1<<0); - PORTB &= ~(1<<0); -#endif + DDRB &= ~(1<<0); + PORTB &= ~(1<<0); + #endif -#if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE)) - if (eeprom_read_byte(EECONFIG_UNICODEMODE) != UC_WIN) { - set_unicode_input_mode(UC_WIN); - } -#endif //UNICODE_ENABLE + #if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE)) + set_unicode_input_mode(DRASHNA_UNICODE_MODE); + get_unicode_input_mode(); + #endif //UNICODE_ENABLE matrix_init_keymap(); } @@ -266,9 +271,10 @@ 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) { uint8_t temp_mod = get_mods(); - clear_mods(); + uint8_t temp_osm = get_oneshot_mods(); + clear_mods(); clear_oneshot_mods(); send_string_with_delay_P(PSTR("make " QMK_KEYBOARD ":" QMK_KEYMAP), 10); - if (temp_mod & MODS_SHIFT_MASK) { + if (temp_mod & MODS_SHIFT_MASK || temp_osm & MODS_SHIFT_MASK) { #if defined(__ARM__) send_string_with_delay_P(PSTR(":dfu-util"), 10); #elif defined(BOOTLOADER_DFU) @@ -282,7 +288,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { #if defined(KEYBOARD_viterbi) send_string_with_delay_P(PSTR(":dfu"), 10); #endif - if (temp_mod & MODS_CTRL_MASK) { send_string_with_delay_P(PSTR(" -j8 --output-sync"), 10); } + if (temp_mod & MODS_CTRL_MASK || temp_osm & MODS_CTRL_MASK) { send_string_with_delay_P(PSTR(" -j8 --output-sync"), 10); } send_string_with_delay_P(PSTR(SS_TAP(X_ENTER)), 10); set_mods(temp_mod); } @@ -422,4 +428,10 @@ void eeconfig_init_user(void) { userspace_config.raw = 0; userspace_config.rgb_layer_change = true; eeconfig_update_user(userspace_config.raw); + #if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE)) + set_unicode_input_mode(DRASHNA_UNICODE_MODE); + get_unicode_input_mode(); + #else + eeprom_update_byte(EECONFIG_UNICODEMODE, DRASHNA_UNICODE_MODE); + #endif } diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c index 9ad94c0c3..b6de4d39e 100644 --- a/users/drashna/rgb_stuff.c +++ b/users/drashna/rgb_stuff.c @@ -12,14 +12,6 @@ void rgblight_sethsv_default_helper(uint8_t 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<