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
This commit is contained in:
parent
c6f389b527
commit
50554ca270
10 changed files with 305 additions and 239 deletions
|
@ -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 |
|
||||
|
|
|
@ -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);
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue