aboutsummaryrefslogtreecommitdiff
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
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
-rw-r--r--keyboards/crkbd/keymaps/ninjonas/config.h6
-rw-r--r--keyboards/kyria/keymaps/ninjonas/config.h6
-rw-r--r--keyboards/kyria/keymaps/ninjonas/encoder.c84
-rw-r--r--keyboards/kyria/keymaps/ninjonas/keymap.c224
-rw-r--r--keyboards/kyria/keymaps/ninjonas/oled.c168
-rw-r--r--keyboards/kyria/keymaps/ninjonas/rules.mk5
-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
10 files changed, 305 insertions, 239 deletions
diff --git a/keyboards/crkbd/keymaps/ninjonas/config.h b/keyboards/crkbd/keymaps/ninjonas/config.h
index 5d2144662..8a4ddad74 100644
--- a/keyboards/crkbd/keymaps/ninjonas/config.h
+++ b/keyboards/crkbd/keymaps/ninjonas/config.h
@@ -20,13 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
20 20
21#pragma once 21#pragma once
22 22
23//#define USE_MATRIX_I2C 23#define TAPPING_TERM 200
24
25/* Select hand configuration */
26 24
27#define MASTER_LEFT 25#define MASTER_LEFT
28// #define MASTER_RIGHT
29// #define EE_HANDS
30 26
31#define USE_SERIAL_PD2 27#define USE_SERIAL_PD2
32 28
diff --git a/keyboards/kyria/keymaps/ninjonas/config.h b/keyboards/kyria/keymaps/ninjonas/config.h
index 409058ad7..5673e6c3d 100644
--- a/keyboards/kyria/keymaps/ninjonas/config.h
+++ b/keyboards/kyria/keymaps/ninjonas/config.h
@@ -20,7 +20,7 @@
20 20
21#ifdef OLED_DRIVER_ENABLE 21#ifdef OLED_DRIVER_ENABLE
22 #define OLED_DISPLAY_128X64 22 #define OLED_DISPLAY_128X64
23 #define OLED_TIMEOUT 30000 23 #define OLED_TIMEOUT 15000
24#endif 24#endif
25 25
26#ifdef RGBLIGHT_ENABLE 26#ifdef RGBLIGHT_ENABLE
@@ -32,10 +32,6 @@
32# define RGBLIGHT_SPLIT 32# define RGBLIGHT_SPLIT
33#endif 33#endif
34 34
35// Allows to use either side as the master. Look at the documentation for info:
36// https://docs.qmk.fm/#/config_options?id=setting-handedness
37#define EE_HANDS
38
39// If you are using an Elite C rev3 on the slave side, uncomment the lines below: 35// If you are using an Elite C rev3 on the slave side, uncomment the lines below:
40#define SPLIT_USB_DETECT 36#define SPLIT_USB_DETECT
41#define SPLIT_USB_TIMEOUT 1000 37#define SPLIT_USB_TIMEOUT 1000
diff --git a/keyboards/kyria/keymaps/ninjonas/encoder.c b/keyboards/kyria/keymaps/ninjonas/encoder.c
new file mode 100644
index 000000000..e3a4f2661
--- /dev/null
+++ b/keyboards/kyria/keymaps/ninjonas/encoder.c
@@ -0,0 +1,84 @@
1/* Copyright 2020 ninjonas
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include "ninjonas.h"
17
18#ifdef ENCODER_ENABLE
19void encoder_update_user(uint8_t index, bool clockwise) {
20 if (index == 0) {
21 switch (get_highest_layer(layer_state)) {
22 case _LOWER:
23 if (clockwise) {
24 tap_code16(SGUI(KC_TAB));
25 } else {
26 tap_code16(LGUI(KC_TAB));
27 }
28 break;
29 case _RAISE:
30 if (clockwise) {
31 tap_code(KC_PGUP);
32 } else {
33 tap_code(KC_PGDN);
34 }
35 break;
36 case _ADJUST:
37 if (clockwise) {
38 rgblight_increase_hue();
39 } else {
40 rgblight_decrease_hue();
41 }
42 break;
43 default:
44 if (clockwise) {
45 tap_code(KC_BRIU);
46 } else {
47 tap_code(KC_BRID);
48 }
49 break;
50 }
51 } else if (index == 1) {
52 switch (get_highest_layer(layer_state)) {
53 case _LOWER:
54 if (clockwise) {
55 tap_code(KC_UP);
56 } else {
57 tap_code(KC_DOWN);
58 }
59 break;
60 case _RAISE:
61 if (clockwise) {
62 tap_code16(LCTL(KC_TAB));
63 } else {
64 tap_code16(LCTL(LSFT(KC_TAB)));
65 }
66 break;
67 case _ADJUST:
68 if (clockwise) {
69 rgblight_increase_val();
70 } else {
71 rgblight_decrease_val();
72 }
73 break;
74 default:
75 if (clockwise) {
76 tap_code(KC_VOLU);
77 } else {
78 tap_code(KC_VOLD);
79 }
80 break;
81 }
82 }
83}
84#endif \ No newline at end of file
diff --git a/keyboards/kyria/keymaps/ninjonas/keymap.c b/keyboards/kyria/keymaps/ninjonas/keymap.c
index 1337c4427..e6cde72d5 100644
--- a/keyboards/kyria/keymaps/ninjonas/keymap.c
+++ b/keyboards/kyria/keymaps/ninjonas/keymap.c
@@ -60,9 +60,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
60// |--------+-----——-+——------+-——-----+——------+——-----| |------—+——------+——------+——------+——------+--------| 60// |--------+-----——-+——------+-——-----+——------+——-----| |------—+——------+——------+——------+——------+--------|
61 _____________________LOWER_L2_______________________, _____________________LOWER_R2_______________________, 61 _____________________LOWER_L2_______________________, _____________________LOWER_R2_______________________,
62// |--------+-----——-+——------+-——-----+——------+——-----+———-----------. ,——————————————+------—+——------+——------+——------+——------+--------| 62// |--------+-----——-+——------+-——-----+——------+——-----+———-----------. ,——————————————+------—+——------+——------+——------+——------+--------|
63 _____________________LOWER_L3_______________________,_______,_______, _______,_______,_____________________LOWER_R3_______________________, 63 _____________________LOWER_L3_______________________,_______,_______, _______,_______,_____________________LOWER_R3_______________________,
64// `--------------------------+--------+--------+-------+-------+------| |------+-------+-------+--------+--------+--------+--------+--------' 64// `--------------------------+--------+--------+-------+-------+------| |------+-------+-------+--------+--------+--------+--------+--------'
65 _______,_______,_______,_______,_______, _______,_______,_______,_______,_______ 65 _______,_______,_______,_______,_______, _______,_______,_______,_______,_______
66// `----------------------------------------' `----------------------------------------' 66// `----------------------------------------' `----------------------------------------'
67 ), 67 ),
68 68
@@ -72,9 +72,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
72// |--------+-----——-+——------+-——-----+——------+——-----| |------—+——------+——------+——------+——------+--------| 72// |--------+-----——-+——------+-——-----+——------+——-----| |------—+——------+——------+——------+——------+--------|
73 _____________________SYM_LEFT_______________________, _____________________SYM_RIGHT______________________, 73 _____________________SYM_LEFT_______________________, _____________________SYM_RIGHT______________________,
74// |--------+-----——-+——------+-——-----+——------+——-----+———-----------. ,——————————————+------—+——------+——------+——------+——------+--------| 74// |--------+-----——-+——------+-——-----+——------+——-----+———-----------. ,——————————————+------—+——------+——------+——------+——------+--------|
75 _____________________FUNC_LEFT______________________,_______,_______, _______,_______,_____________________FUNC_RIGHT_____________________, 75 _____________________FUNC_LEFT______________________,_______,_______, K_CPRF,_______,_____________________FUNC_RIGHT_____________________,
76// `--------------------------+--------+--------+-------+-------+------| |------+-------+-------+--------+--------+--------+--------+--------' 76// `--------------------------+--------+--------+-------+-------+------| |------+-------+-------+--------+--------+--------+--------+--------'
77 _______,_______,_______,_______,_______, _______,_______,_______,_______,_______ 77 _______,_______,_______,_______,_______, _______,_______,_______,_______,_______
78// `----------------------------------------' `----------------------------------------' 78// `----------------------------------------' `----------------------------------------'
79 ), 79 ),
80 80
@@ -84,9 +84,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
84// |--------+-----——-+——------+-——-----+——------+——-----| |------—+——------+——------+——------+——------+--------| 84// |--------+-----——-+——------+-——-----+——------+——-----| |------—+——------+——------+——------+——------+--------|
85 _____________________ADJUST_L2______________________, _____________________ADJUST_R2______________________, 85 _____________________ADJUST_L2______________________, _____________________ADJUST_R2______________________,
86// |--------+-----——-+——------+-——-----+——------+——-----+———-----------. ,——————————————+------—+——------+——------+——------+——------+--------| 86// |--------+-----——-+——------+-——-----+——------+——-----+———-----------. ,——————————————+------—+——------+——------+——------+——------+--------|
87 _____________________ADJUST_L3______________________,_______,_______, _______,_______,_____________________ADJUST_R3______________________, 87 _____________________ADJUST_L3______________________,_______,_______, _______,_______,_____________________ADJUST_R3______________________,
88// `--------------------------+--------+--------+-------+-------+------| |------+-------+-------+--------+--------+--------+--------+--------' 88// `--------------------------+--------+--------+-------+-------+------| |------+-------+-------+--------+--------+--------+--------+--------'
89 _______,_______,_______,_______,_______, _______,_______,_______,_______,_______ 89 _______,_______,_______,_______,_______, _______,_______,_______,_______,_______
90// `----------------------------------------' `----------------------------------------' 90// `----------------------------------------' `----------------------------------------'
91 ), 91 ),
92/* 92/*
@@ -102,214 +102,4 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
102// `----------------------------------------' `----------------------------------------' 102// `----------------------------------------' `----------------------------------------'
103 ), 103 ),
104*/ 104*/
105}; 105}; \ No newline at end of file
106
107#ifdef OLED_DRIVER_ENABLE
108oled_rotation_t oled_init_user(oled_rotation_t rotation) {
109 return OLED_ROTATION_180;
110}
111
112static void render_logo(void) {
113 static const char PROGMEM logo[] = {
114 // Converter: https://javl.github.io/image2cpp/
115 // Image Dimensions: 128x64
116 // Code Output Format: Plain Bytes
117 // Draw Mode: Vertical, 1 bit per pixel
1180x00, 0x00, 0x80, 0xc0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xc0, 0xc0, 0x00, 0x00, 0xe0,
1190xe0, 0xe0, 0xe0, 0x00, 0x00, 0x80, 0xe0, 0xe0, 0xe0, 0xe0, 0x80, 0x00, 0x00, 0xe0, 0xe0, 0xe0,
1200xe0, 0x00, 0x60, 0xe0, 0xe0, 0xe0, 0x00, 0x00, 0x00, 0xe0, 0xe0, 0xe0, 0xe0, 0x80, 0x00, 0x00,
1210xc0, 0xe0, 0xe0, 0xe0, 0x20, 0x60, 0xe0, 0xe0, 0xe0, 0xe0, 0x00, 0x00, 0x00, 0xe0, 0xe0, 0xe0,
1220xe0, 0x00, 0x00, 0xc0, 0xc0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xc0, 0xc0, 0x00, 0x00, 0x00,
1230x80, 0xc0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xc0, 0x80, 0x00, 0xe0, 0xe0, 0xfc, 0xfe,
1240xfe, 0xfe, 0xee, 0xee, 0x0e, 0x80, 0xc0, 0xc0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xc0, 0x80,
1250x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xc0, 0x80, 0x00, 0x00,
1260x00, 0x00, 0x79, 0xfd, 0xfd, 0xfd, 0xec, 0xee, 0x76, 0x7f, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00,
1270x07, 0x3f, 0xff, 0xfc, 0xf8, 0xff, 0x7f, 0x07, 0x0f, 0x7f, 0xff, 0xf8, 0xfc, 0xff, 0x3f, 0x07,
1280x00, 0x00, 0x00, 0x03, 0x1f, 0xff, 0xfe, 0xf0, 0xff, 0x7f, 0x0f, 0x07, 0x3f, 0xff, 0xfc, 0xf8,
1290xff, 0x7f, 0x0f, 0x01, 0x00, 0x00, 0x01, 0x0f, 0x3f, 0xff, 0xfe, 0xf8, 0xff, 0xff, 0x1f, 0x03,
1300x00, 0x00, 0x1f, 0x7f, 0x7f, 0xff, 0xf6, 0xe6, 0xe6, 0xf7, 0xf7, 0x77, 0x37, 0x17, 0x00, 0x30,
1310x79, 0xfd, 0xfd, 0xfd, 0xee, 0xee, 0x76, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff,
1320xff, 0xff, 0x00, 0x00, 0x00, 0x3f, 0x7f, 0x7f, 0xff, 0xf1, 0xe0, 0xe0, 0xff, 0xff, 0x7f, 0x3f,
1330x0e, 0x00, 0x0e, 0x3f, 0x7f, 0xff, 0xff, 0xe0, 0xe0, 0xe1, 0xff, 0x7f, 0x7f, 0x3f, 0x04, 0x00,
1340x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1350x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1360x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
1370xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x0e, 0x0e, 0x0f, 0x0f, 0x07, 0x03, 0x00, 0x00, 0x00,
1380x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1390x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1400x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1410x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1420x00, 0x0c, 0x3c, 0xfc, 0xfc, 0xfc, 0xc0, 0x00, 0xe0, 0xfc, 0xfc, 0x7c, 0x1c, 0x00, 0xf0, 0xf8,
1430xf8, 0xfc, 0xdc, 0xdc, 0xdc, 0xfc, 0xfc, 0xf8, 0xf0, 0xe0, 0x00, 0x00, 0x30, 0xb8, 0xbc, 0xbc,
1440xdc, 0xdc, 0xdc, 0xfc, 0xfc, 0xf8, 0xf0, 0x00, 0x1c, 0x1c, 0xff, 0xff, 0xff, 0xff, 0x1d, 0x1d,
1450x00, 0xf0, 0xf8, 0xf8, 0xfc, 0x3c, 0x1c, 0x1c, 0xfc, 0xfc, 0xf8, 0xf0, 0xc0, 0x00, 0xe0, 0xf0,
1460xf8, 0xfc, 0x3c, 0x1c, 0x1c, 0x3c, 0xfc, 0xf8, 0xf8, 0xe0, 0x00, 0x00, 0x20, 0xb8, 0xbc, 0xbc,
1470xbc, 0xdc, 0xdc, 0xfc, 0xfc, 0xfc, 0xf8, 0xe0, 0x00, 0x0c, 0x7c, 0xfc, 0xfc, 0xc0, 0x00, 0xe0,
1480xfc, 0xfc, 0xfc, 0xfc, 0xf0, 0x80, 0x00, 0xf8, 0xfc, 0xfc, 0x3c, 0x04, 0x0c, 0x7c, 0xfc, 0xfc,
1490xf0, 0x00, 0xc0, 0xfc, 0xfc, 0x7c, 0xfc, 0xf8, 0xc0, 0x00, 0xf0, 0xfc, 0xfc, 0x7c, 0x0c, 0x00,
1500x00, 0x00, 0xc0, 0xc1, 0xc7, 0xff, 0xff, 0xff, 0x7f, 0x1f, 0x03, 0x00, 0x00, 0x00, 0x07, 0x0f,
1510x1f, 0x1f, 0x1e, 0x1c, 0x1c, 0x1e, 0x1e, 0x0e, 0x06, 0x00, 0x00, 0x06, 0x0f, 0x1f, 0x1f, 0x1f,
1520x1d, 0x1d, 0x0e, 0x1f, 0x1f, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x1f, 0x1f, 0x00, 0x00,
1530x00, 0x07, 0x0f, 0x0f, 0x1f, 0x1e, 0x1c, 0x1c, 0x1f, 0x1f, 0x0f, 0x07, 0x01, 0x00, 0x03, 0x07,
1540x0f, 0x1f, 0x1e, 0x1c, 0x1c, 0x1e, 0x1f, 0x0f, 0x0f, 0x03, 0x00, 0x00, 0x0f, 0x1f, 0x1f, 0x1f,
1550x1d, 0x1d, 0x0c, 0x0f, 0x1f, 0x1f, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x03, 0x1f, 0x1f, 0x1e, 0x1f,
1560x0f, 0x01, 0x00, 0x07, 0x1f, 0x1f, 0x1f, 0x1f, 0x0f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0f,
1570x1f, 0x1e, 0x1f, 0x1f, 0x03, 0x00, 0x03, 0x1f, 0x1f, 0x1e, 0x1f, 0x0f, 0x01, 0x00, 0x00, 0x00,
1580x00, 0x80, 0xc1, 0xf1, 0xf9, 0xf9, 0xf9, 0xb8, 0xb8, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80,
1590x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
1600x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00,
1610x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00,
1620x80, 0x80, 0x80, 0x80, 0x00, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80,
1630x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00,
1640x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00,
1650x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00,
1660x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x03, 0x7c, 0xfe, 0xff, 0xff, 0xc7, 0x83, 0x83,
1670xc7, 0xff, 0xff, 0xff, 0x7c, 0x00, 0x00, 0x7c, 0xff, 0xff, 0xff, 0xc7, 0x83, 0x83, 0xc7, 0xff,
1680xff, 0xfe, 0x7c, 0x00, 0xc0, 0xe6, 0xf7, 0xf7, 0xf7, 0xbb, 0xbb, 0xdb, 0xff, 0xff, 0xff, 0xfe,
1690x00, 0x00, 0x03, 0x1f, 0xff, 0xff, 0xf0, 0xe0, 0xfe, 0xff, 0x1f, 0x3f, 0xff, 0xfe, 0xe0, 0xf0,
1700xff, 0xff, 0x1f, 0x03, 0x00, 0x01, 0x0f, 0x7f, 0xff, 0xf8, 0xc0, 0xfc, 0xff, 0x3f, 0x1f, 0xff,
1710xfe, 0xf0, 0xe0, 0xff, 0xff, 0x3f, 0x07, 0x00, 0x01, 0x07, 0x3f, 0xff, 0xff, 0xf8, 0xe0, 0xfc,
1720xff, 0x7f, 0x0f, 0x03, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xdb, 0x9b, 0x9b, 0xdf, 0xdf, 0xdf, 0xde,
1730x1c, 0x00, 0xc0, 0xe6, 0xf7, 0xf7, 0xf7, 0xbb, 0xbb, 0xdb, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00,
1740x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, 0x03,
1750x03, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
1760x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, 0x03, 0x03, 0x01, 0x03, 0x03, 0x03, 0x03,
1770x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x01, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03,
1780x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x01, 0x00, 0x00, 0x00,
1790x03, 0x03, 0x03, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x38, 0x38, 0x38, 0x3f, 0x3f, 0x1f, 0x0f,
1800x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x01, 0x00,
1810x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, 0x03, 0x03, 0x01, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00
182 };
183 oled_write_raw_P(logo, sizeof(logo));
184}
185
186static void render_qmk_logo(void) {
187 static const char PROGMEM qmk_logo[] = {
188 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,
189 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,
190 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,0};
191
192 oled_write_P(qmk_logo, false);
193}
194
195void oled_white_space(void){
196 oled_write_P(PSTR(" "), false);
197}
198
199static void render_status(void) {
200 oled_write_P(PSTR("\nLayer: "), false);
201 oled_write_P(PSTR("LOW"), (layer_state_is(_LOWER) & !layer_state_is(_ADJUST)));
202 oled_white_space();
203 oled_write_P(PSTR("RAI"), (layer_state_is(_RAISE) & !layer_state_is(_ADJUST)));
204 oled_white_space();
205 oled_write_P(PSTR("ADJ"), layer_state_is(_ADJUST));
206}
207
208void render_default_layer_state(void) {
209 oled_write_P(PSTR("\nLayout: "), false);
210 switch (biton32(default_layer_state)) {
211 case _COLEMAK:
212 oled_write_P(PSTR("Colemak"), false);
213 break;
214 case _DVORAK:
215 oled_write_P(PSTR("Dvorak"), false);
216 break;
217 case _QWERTY:
218 oled_write_P(PSTR("Qwerty"), false);
219 break;
220 default:
221 oled_write_ln_P(PSTR("Undefined"), false);
222 }
223}
224
225void render_mod_status(uint8_t modifiers) {
226 oled_write_P(PSTR("\nMods: "), false);
227 oled_write_P(PSTR("SHF"), (modifiers & MOD_MASK_SHIFT));
228 oled_white_space();
229 oled_write_P(PSTR("CTL"), (modifiers & MOD_MASK_CTRL));
230 oled_white_space();
231 oled_write_P(PSTR("ALT"), (modifiers & MOD_MASK_ALT));
232 oled_white_space();
233 oled_write_P(PSTR("GUI"), (modifiers & MOD_MASK_GUI));
234}
235
236void oled_task_user(void) {
237 if (is_keyboard_master()) {
238 render_qmk_logo();
239 render_default_layer_state();
240 render_status();
241 render_mod_status(get_mods()|get_oneshot_mods());
242 } else {
243 render_logo();
244 oled_scroll_left();
245 }
246}
247#endif
248
249#ifdef ENCODER_ENABLE
250void encoder_update_user(uint8_t index, bool clockwise) {
251 if (index == 0) {
252 switch (biton32(layer_state)) {
253 case _LOWER:
254 if (clockwise) {
255 tap_code16(SGUI(KC_TAB));
256 } else {
257 tap_code16(LGUI(KC_TAB));
258 }
259 break;
260 case _RAISE:
261 if (clockwise) {
262 tap_code(KC_PGUP);
263 } else {
264 tap_code(KC_PGDN);
265 }
266 break;
267 case _ADJUST:
268 if (clockwise) {
269 rgblight_increase_hue();
270 } else {
271 rgblight_decrease_hue();
272 }
273 break;
274 default:
275 if (clockwise) {
276 tap_code(KC_BRIU);
277 } else {
278 tap_code(KC_BRID);
279 }
280 break;
281 }
282 } else if (index == 1) {
283 switch (biton32(layer_state)) {
284 case _LOWER:
285 if (!clockwise) {
286 tap_code(KC_UP);
287 } else {
288 tap_code(KC_DOWN);
289 }
290 break;
291 case _RAISE:
292 if (!clockwise) {
293 tap_code16(LCTL(KC_TAB));
294 } else {
295 tap_code16(LCTL(LSFT(KC_TAB)));
296 }
297 break;
298 case _ADJUST:
299 if (!clockwise) {
300 rgblight_increase_val();
301 } else {
302 rgblight_decrease_val();
303 }
304 break;
305 default:
306 if (!clockwise) {
307 tap_code(KC_VOLU);
308 } else {
309 tap_code(KC_VOLD);
310 }
311 break;
312 }
313 }
314}
315#endif \ No newline at end of file
diff --git a/keyboards/kyria/keymaps/ninjonas/oled.c b/keyboards/kyria/keymaps/ninjonas/oled.c
new file mode 100644
index 000000000..ff21b4885
--- /dev/null
+++ b/keyboards/kyria/keymaps/ninjonas/oled.c
@@ -0,0 +1,168 @@
1/* Copyright 2020 ninjonas
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include "ninjonas.h"
17
18#ifdef OLED_DRIVER_ENABLE
19oled_rotation_t oled_init_user(oled_rotation_t rotation) { return OLED_ROTATION_180; }
20
21static void render_logo(void) {
22 static const char PROGMEM logo[] = {
23 // Converter: https://javl.github.io/image2cpp/
24 // Image Dimensions: 128x64
25 // Code Output Format: Plain Bytes
26 // Draw Mode: Vertical, 1 bit per pixel
270x00, 0x00, 0x80, 0xc0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xc0, 0xc0, 0x00, 0x00, 0xe0,
280xe0, 0xe0, 0xe0, 0x00, 0x00, 0x80, 0xe0, 0xe0, 0xe0, 0xe0, 0x80, 0x00, 0x00, 0xe0, 0xe0, 0xe0,
290xe0, 0x00, 0x60, 0xe0, 0xe0, 0xe0, 0x00, 0x00, 0x00, 0xe0, 0xe0, 0xe0, 0xe0, 0x80, 0x00, 0x00,
300xc0, 0xe0, 0xe0, 0xe0, 0x20, 0x60, 0xe0, 0xe0, 0xe0, 0xe0, 0x00, 0x00, 0x00, 0xe0, 0xe0, 0xe0,
310xe0, 0x00, 0x00, 0xc0, 0xc0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xc0, 0xc0, 0x00, 0x00, 0x00,
320x80, 0xc0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xc0, 0x80, 0x00, 0xe0, 0xe0, 0xfc, 0xfe,
330xfe, 0xfe, 0xee, 0xee, 0x0e, 0x80, 0xc0, 0xc0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xc0, 0x80,
340x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xc0, 0x80, 0x00, 0x00,
350x00, 0x00, 0x79, 0xfd, 0xfd, 0xfd, 0xec, 0xee, 0x76, 0x7f, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00,
360x07, 0x3f, 0xff, 0xfc, 0xf8, 0xff, 0x7f, 0x07, 0x0f, 0x7f, 0xff, 0xf8, 0xfc, 0xff, 0x3f, 0x07,
370x00, 0x00, 0x00, 0x03, 0x1f, 0xff, 0xfe, 0xf0, 0xff, 0x7f, 0x0f, 0x07, 0x3f, 0xff, 0xfc, 0xf8,
380xff, 0x7f, 0x0f, 0x01, 0x00, 0x00, 0x01, 0x0f, 0x3f, 0xff, 0xfe, 0xf8, 0xff, 0xff, 0x1f, 0x03,
390x00, 0x00, 0x1f, 0x7f, 0x7f, 0xff, 0xf6, 0xe6, 0xe6, 0xf7, 0xf7, 0x77, 0x37, 0x17, 0x00, 0x30,
400x79, 0xfd, 0xfd, 0xfd, 0xee, 0xee, 0x76, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff,
410xff, 0xff, 0x00, 0x00, 0x00, 0x3f, 0x7f, 0x7f, 0xff, 0xf1, 0xe0, 0xe0, 0xff, 0xff, 0x7f, 0x3f,
420x0e, 0x00, 0x0e, 0x3f, 0x7f, 0xff, 0xff, 0xe0, 0xe0, 0xe1, 0xff, 0x7f, 0x7f, 0x3f, 0x04, 0x00,
430x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
440x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
450x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
460xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x0e, 0x0e, 0x0f, 0x0f, 0x07, 0x03, 0x00, 0x00, 0x00,
470x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
480x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
490x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
500x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
510x00, 0x0c, 0x3c, 0xfc, 0xfc, 0xfc, 0xc0, 0x00, 0xe0, 0xfc, 0xfc, 0x7c, 0x1c, 0x00, 0xf0, 0xf8,
520xf8, 0xfc, 0xdc, 0xdc, 0xdc, 0xfc, 0xfc, 0xf8, 0xf0, 0xe0, 0x00, 0x00, 0x30, 0xb8, 0xbc, 0xbc,
530xdc, 0xdc, 0xdc, 0xfc, 0xfc, 0xf8, 0xf0, 0x00, 0x1c, 0x1c, 0xff, 0xff, 0xff, 0xff, 0x1d, 0x1d,
540x00, 0xf0, 0xf8, 0xf8, 0xfc, 0x3c, 0x1c, 0x1c, 0xfc, 0xfc, 0xf8, 0xf0, 0xc0, 0x00, 0xe0, 0xf0,
550xf8, 0xfc, 0x3c, 0x1c, 0x1c, 0x3c, 0xfc, 0xf8, 0xf8, 0xe0, 0x00, 0x00, 0x20, 0xb8, 0xbc, 0xbc,
560xbc, 0xdc, 0xdc, 0xfc, 0xfc, 0xfc, 0xf8, 0xe0, 0x00, 0x0c, 0x7c, 0xfc, 0xfc, 0xc0, 0x00, 0xe0,
570xfc, 0xfc, 0xfc, 0xfc, 0xf0, 0x80, 0x00, 0xf8, 0xfc, 0xfc, 0x3c, 0x04, 0x0c, 0x7c, 0xfc, 0xfc,
580xf0, 0x00, 0xc0, 0xfc, 0xfc, 0x7c, 0xfc, 0xf8, 0xc0, 0x00, 0xf0, 0xfc, 0xfc, 0x7c, 0x0c, 0x00,
590x00, 0x00, 0xc0, 0xc1, 0xc7, 0xff, 0xff, 0xff, 0x7f, 0x1f, 0x03, 0x00, 0x00, 0x00, 0x07, 0x0f,
600x1f, 0x1f, 0x1e, 0x1c, 0x1c, 0x1e, 0x1e, 0x0e, 0x06, 0x00, 0x00, 0x06, 0x0f, 0x1f, 0x1f, 0x1f,
610x1d, 0x1d, 0x0e, 0x1f, 0x1f, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x1f, 0x1f, 0x00, 0x00,
620x00, 0x07, 0x0f, 0x0f, 0x1f, 0x1e, 0x1c, 0x1c, 0x1f, 0x1f, 0x0f, 0x07, 0x01, 0x00, 0x03, 0x07,
630x0f, 0x1f, 0x1e, 0x1c, 0x1c, 0x1e, 0x1f, 0x0f, 0x0f, 0x03, 0x00, 0x00, 0x0f, 0x1f, 0x1f, 0x1f,
640x1d, 0x1d, 0x0c, 0x0f, 0x1f, 0x1f, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x03, 0x1f, 0x1f, 0x1e, 0x1f,
650x0f, 0x01, 0x00, 0x07, 0x1f, 0x1f, 0x1f, 0x1f, 0x0f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0f,
660x1f, 0x1e, 0x1f, 0x1f, 0x03, 0x00, 0x03, 0x1f, 0x1f, 0x1e, 0x1f, 0x0f, 0x01, 0x00, 0x00, 0x00,
670x00, 0x80, 0xc1, 0xf1, 0xf9, 0xf9, 0xf9, 0xb8, 0xb8, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80,
680x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
690x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00,
700x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00,
710x80, 0x80, 0x80, 0x80, 0x00, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80,
720x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00,
730x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00,
740x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00,
750x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0x03, 0x7c, 0xfe, 0xff, 0xff, 0xc7, 0x83, 0x83,
760xc7, 0xff, 0xff, 0xff, 0x7c, 0x00, 0x00, 0x7c, 0xff, 0xff, 0xff, 0xc7, 0x83, 0x83, 0xc7, 0xff,
770xff, 0xfe, 0x7c, 0x00, 0xc0, 0xe6, 0xf7, 0xf7, 0xf7, 0xbb, 0xbb, 0xdb, 0xff, 0xff, 0xff, 0xfe,
780x00, 0x00, 0x03, 0x1f, 0xff, 0xff, 0xf0, 0xe0, 0xfe, 0xff, 0x1f, 0x3f, 0xff, 0xfe, 0xe0, 0xf0,
790xff, 0xff, 0x1f, 0x03, 0x00, 0x01, 0x0f, 0x7f, 0xff, 0xf8, 0xc0, 0xfc, 0xff, 0x3f, 0x1f, 0xff,
800xfe, 0xf0, 0xe0, 0xff, 0xff, 0x3f, 0x07, 0x00, 0x01, 0x07, 0x3f, 0xff, 0xff, 0xf8, 0xe0, 0xfc,
810xff, 0x7f, 0x0f, 0x03, 0x00, 0xfe, 0xff, 0xff, 0xff, 0xdb, 0x9b, 0x9b, 0xdf, 0xdf, 0xdf, 0xde,
820x1c, 0x00, 0xc0, 0xe6, 0xf7, 0xf7, 0xf7, 0xbb, 0xbb, 0xdb, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00,
830x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, 0x03,
840x03, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
850x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, 0x03, 0x03, 0x01, 0x03, 0x03, 0x03, 0x03,
860x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x01, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03,
870x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x01, 0x00, 0x00, 0x00,
880x03, 0x03, 0x03, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x38, 0x38, 0x38, 0x3f, 0x3f, 0x1f, 0x0f,
890x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x01, 0x00,
900x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, 0x03, 0x03, 0x01, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00
91 };
92 oled_write_raw_P(logo, sizeof(logo));
93}
94
95static void render_qmk_logo(void) {
96 static const char PROGMEM qmk_logo[] = {
97 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,
98 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,
99 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,0};
100
101 oled_write_P(qmk_logo, false);
102}
103
104void oled_white_space(void){
105 oled_write_P(PSTR(" "), false);
106}
107
108void render_layout_state(void) {
109 oled_write_P(PSTR("\nLayout: "), false);
110 switch (biton32(default_layer_state)) {
111 case _COLEMAK:
112 oled_write_P(PSTR("Colemak"), false);
113 break;
114 case _DVORAK:
115 oled_write_P(PSTR("Dvorak"), false);
116 break;
117 case _QWERTY:
118 oled_write_P(PSTR("Qwerty"), false);
119 break;
120 default:
121 oled_write_ln_P(PSTR("Undefined"), false);
122 }
123}
124
125static void render_layer_state(void) {
126 oled_write_P(PSTR("\nLayer:"), false);
127 bool lower = layer_state_is(_LOWER) & !layer_state_is(_ADJUST);
128 bool raise = layer_state_is(_RAISE) & !layer_state_is(_ADJUST);
129 bool adjust = layer_state_is(_ADJUST);
130
131 if(lower){
132 oled_write_P(PSTR(" Lower "), true);
133 } else if(raise){
134 oled_write_P(PSTR(" Raise "), true);
135 } else if(adjust){
136 oled_write_P(PSTR(" Adjust "), true);
137 } else {
138 oled_write_P(PSTR(" Default"), false);
139 }
140}
141
142void render_mod_state(uint8_t modifiers) {
143 oled_write_P(PSTR("\nMods: "), false);
144 oled_write_P(PSTR("SHF"), (modifiers & MOD_MASK_SHIFT));
145 oled_white_space();
146 oled_write_P(PSTR("CTL"), (modifiers & MOD_MASK_CTRL));
147 oled_white_space();
148 oled_write_P(PSTR("ALT"), (modifiers & MOD_MASK_ALT));
149 oled_white_space();
150 oled_write_P(PSTR("GUI"), (modifiers & MOD_MASK_GUI));
151}
152
153static void render_status(void) {
154 render_qmk_logo();
155 render_layout_state();
156 render_layer_state();
157 render_mod_state(get_mods()|get_oneshot_mods());
158}
159
160void oled_task_user(void) {
161 if (is_keyboard_master()) {
162 render_status();
163 } else {
164 render_logo();
165 oled_scroll_left();
166 }
167}
168#endif \ No newline at end of file
diff --git a/keyboards/kyria/keymaps/ninjonas/rules.mk b/keyboards/kyria/keymaps/ninjonas/rules.mk
index 13bc4cf97..3b2894a17 100644
--- a/keyboards/kyria/keymaps/ninjonas/rules.mk
+++ b/keyboards/kyria/keymaps/ninjonas/rules.mk
@@ -1,4 +1,7 @@
1OLED_DRIVER_ENABLE = yes # Enables the use of OLED displays 1OLED_DRIVER_ENABLE = yes # Enables the use of OLED displays
2ENCODER_ENABLE = yes # Enables the use of one or more encoders 2ENCODER_ENABLE = yes # Enables the use of one or more encoders
3RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow 3RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
4LINK_TIME_OPTIMIZATION_ENABLE = yes \ No newline at end of file 4LINK_TIME_OPTIMIZATION_ENABLE = yes
5
6SRC += encoder.c \
7 oled.c \ No newline at end of file
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 }