diff options
author | Jonas Avellana <14019120+ninjonas@users.noreply.github.com> | 2020-02-03 18:50:50 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-04 12:50:50 +1100 |
commit | 50554ca270ae4c58dfa156ae4960e06a7ec6ef31 (patch) | |
tree | 0fded0ea9435f3cb05ae8ad5a753a1a22cd76bdb /users | |
parent | c6f389b527e04e11e62a11e329f8f52b67a47d63 (diff) | |
download | firmware-50554ca270ae4c58dfa156ae4960e06a7ec6ef31.tar.gz firmware-50554ca270ae4c58dfa156ae4960e06a7ec6ef31.tar.bz2 firmware-50554ca270ae4c58dfa156ae4960e06a7ec6ef31.zip |
Ninjonas userspace (#8070)
* [keymap(kyria)] moved OLED & encoder implementation to separate classes
* [feat] created logic to cycle through hue wheel when starting keyboard
* [feat] created logic to cycle through hue wheel and return to user's default color
* [refactor] updating OLED layout for crkbd & lily58
* [refactor] updating OLED layout for crkbd & lily58
* [fix(8070)] updating encoder.c logic based off drashna's code review
* [refactor(8070)] added key to send + Shift + M
Diffstat (limited to 'users')
-rw-r--r-- | users/ninjonas/README.md | 1 | ||||
-rw-r--r-- | users/ninjonas/ninjonas.c | 19 | ||||
-rw-r--r-- | users/ninjonas/ninjonas.h | 1 | ||||
-rw-r--r-- | users/ninjonas/oled.c | 30 |
4 files changed, 40 insertions, 11 deletions
diff --git a/users/ninjonas/README.md b/users/ninjonas/README.md index 301b350e7..39d92cff3 100644 --- a/users/ninjonas/README.md +++ b/users/ninjonas/README.md @@ -25,6 +25,7 @@ See: https://docs.qmk.fm/#/feature_userspace |K_MDSH | MacOS shortcut to get em-dash `–` | |K_RAPP | MacOS shortcut to switch apps to the right | |K_LAPP | MacOS shortcut to switch apps to the left | +|K_CPRF | + Shift + M. Used for switching Google Chrome profiles | ### [Layers](ninjonas.h#L44) |Code | Description | diff --git a/users/ninjonas/ninjonas.c b/users/ninjonas/ninjonas.c index 49e12e482..7e5afcec8 100644 --- a/users/ninjonas/ninjonas.c +++ b/users/ninjonas/ninjonas.c @@ -17,4 +17,23 @@ layer_state_t layer_state_set_user (layer_state_t state) { return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); +} + +#ifdef RGBLIGHT_ENABLE +extern rgblight_config_t rgblight_config; +#endif +void keyboard_post_init_user() { + #ifdef RGBLIGHT_ENABLE + // Cycles through the entire hue wheel and resetting to default color + uint16_t default_hue = rgblight_config.hue; + rgblight_enable_noeeprom(); + layer_state_set_user(layer_state); + rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); + for (uint16_t i = 255; i > 0; i--) { + rgblight_sethsv_noeeprom((i + default_hue) % 255, rgblight_config.sat, rgblight_config.val); + matrix_scan(); + wait_ms(10); + } + #endif + layer_state_set_user(layer_state); }
\ No newline at end of file diff --git a/users/ninjonas/ninjonas.h b/users/ninjonas/ninjonas.h index ba94c8ea8..6f79b262f 100644 --- a/users/ninjonas/ninjonas.h +++ b/users/ninjonas/ninjonas.h @@ -37,6 +37,7 @@ // Shortcut Keys #define K_LOCK LGUI(LCTL(KC_Q)) // Locks screen on MacOS #define K_CSCN LGUI(LCTL(LSFT(KC_4))) // Copy a portion of the screen to the clipboard +#define K_CPRF LGUI(LSFT(KC_M)) // + Shift + M. Used for switching Google Chrome profiles #define K_MDSH LSFT(LALT(KC_MINS)) #define K_LAPP SGUI(KC_TAB) // + Shift + Tab #define K_RAPP LGUI(KC_TAB) // + Tab diff --git a/users/ninjonas/oled.c b/users/ninjonas/oled.c index ac98133bc..285b0364e 100644 --- a/users/ninjonas/oled.c +++ b/users/ninjonas/oled.c @@ -21,7 +21,7 @@ bool process_record_oled(uint16_t keycode, keyrecord_t *record) { return true; } -void render_default_layer_state(void) { +void render_layout_state(void) { oled_write_P(PSTR("Layout: "), false); switch (biton32(default_layer_state)) { case _COLEMAK: @@ -43,15 +43,23 @@ void oled_white_space(void){ } void render_layer_state(void) { - oled_write_P(PSTR("\nLayer: "), false); - oled_write_P(PSTR("LOW"), (layer_state_is(_LOWER) & !layer_state_is(_ADJUST))); - oled_white_space(); - oled_write_P(PSTR("RAI"), (layer_state_is(_RAISE) & !layer_state_is(_ADJUST))); - oled_white_space(); - oled_write_P(PSTR("ADJ"), layer_state_is(_ADJUST)); + oled_write_P(PSTR("\nLayer:"), false); + bool lower = layer_state_is(_LOWER) & !layer_state_is(_ADJUST); + bool raise = layer_state_is(_RAISE) & !layer_state_is(_ADJUST); + bool adjust = layer_state_is(_ADJUST); + + if(lower){ + oled_write_P(PSTR(" Lower "), true); + } else if(raise){ + oled_write_P(PSTR(" Raise "), true); + } else if(adjust){ + oled_write_P(PSTR(" Adjust "), true); + } else { + oled_write_P(PSTR(" Default"), false); + } } -void render_mod_status(uint8_t modifiers) { +void render_mod_state(uint8_t modifiers) { oled_write_P(PSTR("\nMods: "), false); oled_write_P(PSTR("SHF"), (modifiers & MOD_MASK_SHIFT)); oled_white_space(); @@ -63,10 +71,10 @@ void render_mod_status(uint8_t modifiers) { } void render_status(void){ - render_default_layer_state(); + render_layout_state(); oled_write_P(PSTR("\n"), false); render_layer_state(); - render_mod_status(get_mods()|get_oneshot_mods()); + render_mod_state(get_mods()|get_oneshot_mods()); } static void render_logo(void) { @@ -80,7 +88,7 @@ static void render_logo(void) { } void oled_task_user(void) { - if (timer_elapsed32(oled_timer) > 30000) { + if (timer_elapsed32(oled_timer) > 15000) { oled_off(); return; } |