aboutsummaryrefslogtreecommitdiff
path: root/users
diff options
context:
space:
mode:
authorJonas Avellana <14019120+ninjonas@users.noreply.github.com>2020-02-03 18:50:50 -0700
committerGitHub <noreply@github.com>2020-02-04 12:50:50 +1100
commit50554ca270ae4c58dfa156ae4960e06a7ec6ef31 (patch)
tree0fded0ea9435f3cb05ae8ad5a753a1a22cd76bdb /users
parentc6f389b527e04e11e62a11e329f8f52b67a47d63 (diff)
downloadqmk_firmware-50554ca270ae4c58dfa156ae4960e06a7ec6ef31.tar.gz
qmk_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.md1
-rw-r--r--users/ninjonas/ninjonas.c19
-rw-r--r--users/ninjonas/ninjonas.h1
-rw-r--r--users/ninjonas/oled.c30
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
25|K_MDSH | MacOS shortcut to get em-dash `–` | 25|K_MDSH | MacOS shortcut to get em-dash `–` |
26|K_RAPP | MacOS shortcut to switch apps to the right | 26|K_RAPP | MacOS shortcut to switch apps to the right |
27|K_LAPP | MacOS shortcut to switch apps to the left | 27|K_LAPP | MacOS shortcut to switch apps to the left |
28|K_CPRF |  + Shift + M. Used for switching Google Chrome profiles |
28 29
29### [Layers](ninjonas.h#L44) 30### [Layers](ninjonas.h#L44)
30|Code | Description | 31|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 @@
17 17
18layer_state_t layer_state_set_user (layer_state_t state) { 18layer_state_t layer_state_set_user (layer_state_t state) {
19 return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); 19 return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
20}
21
22#ifdef RGBLIGHT_ENABLE
23extern rgblight_config_t rgblight_config;
24#endif
25void keyboard_post_init_user() {
26 #ifdef RGBLIGHT_ENABLE
27 // Cycles through the entire hue wheel and resetting to default color
28 uint16_t default_hue = rgblight_config.hue;
29 rgblight_enable_noeeprom();
30 layer_state_set_user(layer_state);
31 rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
32 for (uint16_t i = 255; i > 0; i--) {
33 rgblight_sethsv_noeeprom((i + default_hue) % 255, rgblight_config.sat, rgblight_config.val);
34 matrix_scan();
35 wait_ms(10);
36 }
37 #endif
38 layer_state_set_user(layer_state);
20} \ No newline at end of file 39} \ 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 @@
37// Shortcut Keys 37// Shortcut Keys
38#define K_LOCK LGUI(LCTL(KC_Q)) // Locks screen on MacOS 38#define K_LOCK LGUI(LCTL(KC_Q)) // Locks screen on MacOS
39#define K_CSCN LGUI(LCTL(LSFT(KC_4))) // Copy a portion of the screen to the clipboard 39#define K_CSCN LGUI(LCTL(LSFT(KC_4))) // Copy a portion of the screen to the clipboard
40#define K_CPRF LGUI(LSFT(KC_M)) //  + Shift + M. Used for switching Google Chrome profiles
40#define K_MDSH LSFT(LALT(KC_MINS)) 41#define K_MDSH LSFT(LALT(KC_MINS))
41#define K_LAPP SGUI(KC_TAB) //  + Shift + Tab 42#define K_LAPP SGUI(KC_TAB) //  + Shift + Tab
42#define K_RAPP LGUI(KC_TAB) //  + Tab 43#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) {
21 return true; 21 return true;
22} 22}
23 23
24void render_default_layer_state(void) { 24void render_layout_state(void) {
25 oled_write_P(PSTR("Layout: "), false); 25 oled_write_P(PSTR("Layout: "), false);
26 switch (biton32(default_layer_state)) { 26 switch (biton32(default_layer_state)) {
27 case _COLEMAK: 27 case _COLEMAK:
@@ -43,15 +43,23 @@ void oled_white_space(void){
43} 43}
44 44
45void render_layer_state(void) { 45void render_layer_state(void) {
46 oled_write_P(PSTR("\nLayer: "), false); 46 oled_write_P(PSTR("\nLayer:"), false);
47 oled_write_P(PSTR("LOW"), (layer_state_is(_LOWER) & !layer_state_is(_ADJUST))); 47 bool lower = layer_state_is(_LOWER) & !layer_state_is(_ADJUST);
48 oled_white_space(); 48 bool raise = layer_state_is(_RAISE) & !layer_state_is(_ADJUST);
49 oled_write_P(PSTR("RAI"), (layer_state_is(_RAISE) & !layer_state_is(_ADJUST))); 49 bool adjust = layer_state_is(_ADJUST);
50 oled_white_space(); 50
51 oled_write_P(PSTR("ADJ"), layer_state_is(_ADJUST)); 51 if(lower){
52 oled_write_P(PSTR(" Lower "), true);
53 } else if(raise){
54 oled_write_P(PSTR(" Raise "), true);
55 } else if(adjust){
56 oled_write_P(PSTR(" Adjust "), true);
57 } else {
58 oled_write_P(PSTR(" Default"), false);
59 }
52} 60}
53 61
54void render_mod_status(uint8_t modifiers) { 62void render_mod_state(uint8_t modifiers) {
55 oled_write_P(PSTR("\nMods: "), false); 63 oled_write_P(PSTR("\nMods: "), false);
56 oled_write_P(PSTR("SHF"), (modifiers & MOD_MASK_SHIFT)); 64 oled_write_P(PSTR("SHF"), (modifiers & MOD_MASK_SHIFT));
57 oled_white_space(); 65 oled_white_space();
@@ -63,10 +71,10 @@ void render_mod_status(uint8_t modifiers) {
63} 71}
64 72
65void render_status(void){ 73void render_status(void){
66 render_default_layer_state(); 74 render_layout_state();
67 oled_write_P(PSTR("\n"), false); 75 oled_write_P(PSTR("\n"), false);
68 render_layer_state(); 76 render_layer_state();
69 render_mod_status(get_mods()|get_oneshot_mods()); 77 render_mod_state(get_mods()|get_oneshot_mods());
70} 78}
71 79
72static void render_logo(void) { 80static void render_logo(void) {
@@ -80,7 +88,7 @@ static void render_logo(void) {
80} 88}
81 89
82void oled_task_user(void) { 90void oled_task_user(void) {
83 if (timer_elapsed32(oled_timer) > 30000) { 91 if (timer_elapsed32(oled_timer) > 15000) {
84 oled_off(); 92 oled_off();
85 return; 93 return;
86 } 94 }