summaryrefslogtreecommitdiff
path: root/users
diff options
context:
space:
mode:
authorJonas Avellana <14019120+ninjonas@users.noreply.github.com>2019-09-25 22:28:06 -0600
committerDrashna Jaelre <drashna@live.com>2019-09-25 21:28:06 -0700
commitff854565ce012a325ad04b09a7bcb7c8bb9d43c5 (patch)
tree69d4970d4ea40d49483f232bf404d16f383957ba /users
parent2a948e77715f0bd11d4b80315cf84c68890014d4 (diff)
[Keymap] ninjonas keymap for crkbd & ninjonas userspace updates (#6797)
* [keymap(crkbd)] introducing crkbd keymap on ninjonas profile * [keymap(crkbd)] introducing crkbd keymap on ninjonas profile * [refactor(crkbd)] reducing file size by selecting RGB animations * [refactor(crkbd)] added shiftit key * [refactor(crkbd)] added shiftit key * [chore(crkbd)] adding SLEEP_LED_ENABLE on rules.mk * [refactor(crkbd)] added keylog & removed static rainbow RGB * [feat(crkbd)] introduced em-dash '—' keymap * [feat(crkbd)] added screenshot functionality * [refactor(lily58,pinky3)] moving media keys * [refactor(lily58)] Added emdash key * [chore] removing NUMBERS & FUNCTIONS layers as they're useless * [chore] removing NUMBERS & FUNCTIONS layers as they're useless * [chore(crkbd,lily48)] Updating README.md * [feat] added K_LAPP & K_RAPP to mimic command + tab * [feat] added K_LAPP & K_RAPP to mimic command + tab * [fix(#6797)] resolving changes requested by @drashna * [fix(#6797)] first cut on using QMK OLED Driver * [fix(#6797)] cleaning up rules.mk * [fix(#6797)] making scrolling logo work * [fix(#6797)] Using OLED Driver for Lily58 * [fix(#6797)] Moved OLED driver implementation to ninjonas userspace * [fix(#6797)] Bringing back crkbd & lily58 logos * [fix(#6797)] Turning off OLED based off @drashna's workaround in #5982 * [fix(#6797)] whoops! forgot to checkin crkbd/config.h * [fix(#6797)] fixing issue with OLED randomly turning on * [fix(#6797)] using default glcdfont.c for lily58 & crkbd * [fix(#6797)] Using LINK_TIME_OPTIMIZATION_ENABLE rather than EXTRAFLAGS as per code review * [fix(#6797)] updating M_MALL macro as per code review by @fauxpark
Diffstat (limited to 'users')
-rw-r--r--users/ninjonas/README.md24
-rw-r--r--users/ninjonas/ninjonas.c50
-rw-r--r--users/ninjonas/ninjonas.h16
-rw-r--r--users/ninjonas/oled.c82
-rw-r--r--users/ninjonas/process_records.c16
-rw-r--r--users/ninjonas/process_records.h1
-rw-r--r--users/ninjonas/rules.mk9
7 files changed, 122 insertions, 76 deletions
diff --git a/users/ninjonas/README.md b/users/ninjonas/README.md
index 82bd5f09a0..fb14bfe6c2 100644
--- a/users/ninjonas/README.md
+++ b/users/ninjonas/README.md
@@ -6,27 +6,35 @@ See: https://docs.qmk.fm/#/feature_userspace
6- ninjonas [QMK user configuration](https://github.com/qmk/qmk_firmware/blob/master/docs/feature_userspace.md) 6- ninjonas [QMK user configuration](https://github.com/qmk/qmk_firmware/blob/master/docs/feature_userspace.md)
7- On `keymap.c` include `ninjonas.h` 7- On `keymap.c` include `ninjonas.h`
8 ```c 8 ```c
9 #include "ninjonas.h" 9 #include "ninjonas.h"
10 ``` 10 ```
11 11
12## Supported Keyboards
13- [Crkbd ](../../keyboards/crkbd/keymaps/ninjonas)
14- [Hotdox](../../keyboards/hotdox/keymaps/ninjonas)
15- [Pinky3](../../keyboards/pinky/3/keymaps/ninjonas)
16- [Lily58](../../keyboards/lily58/keymaps/ninjonas)
17
12## Features 18## Features
13### [Keys](ninjonas.h#L44) 19### [Keys](ninjonas.h#L40)
14|Code | Description | 20|Code | Description |
15|---|---| 21|---|---|
16|K_LOCK | MacOS shortcut to execute lock command  + ctrl + Q | 22|K_LOCK | MacOS shortcut to execute lock command  + ctrl + Q |
17|K_CSCN | MacOS shortcut to copy a portion of the screen to the clipboard | 23|K_CSCN | MacOS shortcut to copy a portion of the screen to the clipboard |
24|K_MDSH | MacOS shortcut to get em-dash `–` |
25|K_RAPP | MacOS shortcut to switch apps to the right |
26|K_LAPP | MacOS shortcut to switch apps to the left |
18 27
19### [Layers](ninjonas.h#L48) 28### [Layers](ninjonas.h#L47)
20|Code | Description | 29|Code | Description |
21|---|---| 30|---|---|
22|LT_LOW | Tap for ENTER, hold for RAISE | 31|LT_LOW | Tap for ENTER, hold for RAISE |
23|LT_FUNC | Tap for ENTER, hold for FUNCTIONS |
24|LT_RAI | Tap for SPACE, hold for LOWER | 32|LT_RAI | Tap for SPACE, hold for LOWER |
25|LT_NUM | Tap for SPACE, hold for NUMBERS |
26|LT_LOW + LT_RAI | Hold for ADJUST | 33|LT_LOW + LT_RAI | Hold for ADJUST |
27|L_LOWER | Dedicated key to momentarily toggle to use LOWER layer | 34|LM_LOW | Dedicated key to momentarily toggle to use LOWER layer |
35|LM_RAI | Dedicated key to momentarily toggle to use RAISE layer |
28 36
29### [Layout Blocks](ninjonas.h#L57) 37### [Layout Blocks](ninjonas.h#L53)
30Predefined keyboard layout templates to speed up configuring split keyboards 38Predefined keyboard layout templates to speed up configuring split keyboards
31 39
32|Code | Description | 40|Code | Description |
@@ -69,7 +77,7 @@ There's times where you have macros you don't want to share like emails, passwor
69 77
70```c 78```c
71// secrets.c 79// secrets.c
72#include "ninjonas.h" 80#include "ninjonas.h"
73 81
74bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { 82bool process_record_secrets(uint16_t keycode, keyrecord_t *record) {
75 switch (keycode) { 83 switch (keycode) {
diff --git a/users/ninjonas/ninjonas.c b/users/ninjonas/ninjonas.c
index 6a77ecf8b0..49e12e4824 100644
--- a/users/ninjonas/ninjonas.c
+++ b/users/ninjonas/ninjonas.c
@@ -17,52 +17,4 @@
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} 20} \ No newline at end of file
21
22// BEGIN: SSD1306OLED
23// SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h
24#if defined(KEYBOARD_lily58_rev1) & defined(PROTOCOL_LUFA)
25extern uint8_t is_master;
26
27void matrix_init_user(void) {
28 //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
29 iota_gfx_init(!has_usb()); // turns on the display
30}
31
32// When add source files to SRC in rules.mk, you can use functions.
33const char *read_layer_state(void);
34const char *read_logo(void);
35//void set_keylog(uint16_t keycode, keyrecord_t *record); // Moved to process_records.h
36const char *read_keylog(void);
37const char *read_keylogs(void);
38
39void matrix_scan_user(void) {
40 iota_gfx_task();
41}
42
43void matrix_render_user(struct CharacterMatrix *matrix) {
44 if (is_master) {
45 // If you want to change the display of OLED, you need to change here
46 matrix_write_ln(matrix, read_layer_state());
47 matrix_write_ln(matrix, read_keylog());
48 matrix_write_ln(matrix, read_keylogs());
49 } else {
50 matrix_write(matrix, read_logo());
51 }
52}
53
54void matrix_update(struct CharacterMatrix *dest, const struct CharacterMatrix *source) {
55 if (memcmp(dest->display, source->display, sizeof(dest->display))) {
56 memcpy(dest->display, source->display, sizeof(dest->display));
57 dest->dirty = true;
58 }
59}
60
61void iota_gfx_task_user(void) {
62 struct CharacterMatrix matrix;
63 matrix_clear(&matrix);
64 matrix_render_user(&matrix);
65 matrix_update(&display, &matrix);
66}
67#endif
68// END: SSD1306OLED \ No newline at end of file
diff --git a/users/ninjonas/ninjonas.h b/users/ninjonas/ninjonas.h
index 50d7c36802..227534c259 100644
--- a/users/ninjonas/ninjonas.h
+++ b/users/ninjonas/ninjonas.h
@@ -36,23 +36,19 @@
36#define _LOWER 3 36#define _LOWER 3
37#define _RAISE 4 37#define _RAISE 4
38#define _ADJUST 5 38#define _ADJUST 5
39#ifdef KEYBOARD_pinky_3
40 #define _NUMBERS 6
41 #define _FUNCTIONS 7
42#endif
43 39
44// Shortcut Keys 40// Shortcut Keys
45#define K_LOCK LGUI(LCTL(KC_Q)) // Locks screen on MacOS 41#define K_LOCK LGUI(LCTL(KC_Q)) // Locks screen on MacOS
46#define K_CSCN LGUI(LCTL(LSFT(KC_4))) // Copy a portion of the screen to the clipboard 42#define K_CSCN LGUI(LCTL(LSFT(KC_4))) // Copy a portion of the screen to the clipboard
43#define K_MDSH LSFT(LALT(KC_MINS))
44#define K_LAPP SGUI(KC_TAB) //  + Shift + Tab
45#define K_RAPP LGUI(KC_TAB) //  + Tab
47 46
48// Layer Keys 47// Layer Keys
49#define L_LOWER MO(_LOWER) 48#define LM_LOW MO(_LOWER)
49#define LM_RAI MO(_RAISE)
50#define LT_LOW LT(_LOWER, KC_ENT) 50#define LT_LOW LT(_LOWER, KC_ENT)
51#define LT_RAI LT(_RAISE, KC_SPC) 51#define LT_RAI LT(_RAISE, KC_SPC)
52#ifdef KEYBOARD_pinky_3
53 #define LT_NUM LT(_NUMBERS, KC_SPC)
54 #define LT_FUNC LT(_FUNCTIONS, KC_ENT)
55#endif
56 52
57// Layout blocks 53// Layout blocks
58#define _____________________QWERTY_L1______________________ T_TAB, T_Q, T_W, KC_E, KC_R, KC_T 54#define _____________________QWERTY_L1______________________ T_TAB, T_Q, T_W, KC_E, KC_R, KC_T
@@ -105,7 +101,7 @@
105#define _________MEDIA_3_________ XXXXXXX, KC_MRWD, KC__VOLDOWN 101#define _________MEDIA_3_________ XXXXXXX, KC_MRWD, KC__VOLDOWN
106 102
107#define ________MOD_LEFT_________ KC_LALT, T_GUI, KC_LCTL 103#define ________MOD_LEFT_________ KC_LALT, T_GUI, KC_LCTL
108#define ________MOD_RIGHT________ KC_BSPC, KC_DEL, L_LOWER 104#define ________MOD_RIGHT________ KC_BSPC, KC_DEL, LM_LOW
109 105
110// Layout wrappers 106// Layout wrappers
111#define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__) 107#define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__)
diff --git a/users/ninjonas/oled.c b/users/ninjonas/oled.c
new file mode 100644
index 0000000000..837d497ab3
--- /dev/null
+++ b/users/ninjonas/oled.c
@@ -0,0 +1,82 @@
1#include QMK_KEYBOARD_H
2#include <stdio.h>
3#include "ninjonas.h"
4
5#ifdef OLED_DRIVER_ENABLE
6
7static uint16_t oled_timer = 0;
8extern uint8_t is_master;
9
10bool process_record_oled(uint16_t keycode, keyrecord_t *record) {
11 if (record->event.pressed) {
12 oled_timer = timer_read();
13 }
14 return true;
15}
16
17void render_default_layer_state(void) {
18 oled_write_P(PSTR("Layout: "), false);
19 switch (biton32(default_layer_state)) {
20 case _COLEMAK:
21 oled_write_P(PSTR("Colemak"), false);
22 break;
23 case _DVORAK:
24 oled_write_P(PSTR("Dvorak"), false);
25 break;
26 case _QWERTY:
27 oled_write_P(PSTR("Qwerty"), false);
28 break;
29 default:
30 oled_write_ln_P(PSTR("Undefined"), false);
31 }
32}
33
34void render_layer_state(void) {
35 oled_write_P(PSTR("\nLayer:"), false);
36 oled_write_P(PSTR(" LOW"), layer_state_is(_LOWER));
37 oled_write_P(PSTR(" RAI"), layer_state_is(_RAISE));
38 oled_write_P(PSTR(" ADJ"), layer_state_is(_ADJUST));
39}
40
41void render_mod_status(uint8_t modifiers) {
42 oled_write_P(PSTR("\nMods: "), false);
43 oled_write_P(PSTR("SHF "), (modifiers & MOD_MASK_SHIFT));
44 oled_write_P(PSTR("CTL "), (modifiers & MOD_MASK_CTRL));
45 oled_write_P(PSTR("ALT "), (modifiers & MOD_MASK_ALT));
46 oled_write_P(PSTR("GUI"), (modifiers & MOD_MASK_GUI));
47}
48
49void render_status(void){
50 render_default_layer_state();
51 render_layer_state();
52 render_mod_status(get_mods()|get_oneshot_mods());
53}
54
55static void render_logo(void) {
56 static const char PROGMEM qmk_logo[] = {
57 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94,
58 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4,
59 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4,
60 0};
61
62 oled_write_P(qmk_logo, false);
63}
64
65void oled_task_user(void) {
66 if (timer_elapsed(oled_timer) > 30000) {
67 oled_off();
68 return;
69 }
70 #ifndef SPLIT_KEYBOARD
71 else { oled_on(); }
72 #endif
73
74 if (is_master) {
75 render_status();
76 } else {
77 render_logo();
78 oled_scroll_left();
79 }
80}
81
82#endif \ No newline at end of file
diff --git a/users/ninjonas/process_records.c b/users/ninjonas/process_records.c
index 1b7958abcd..e1960aaa3e 100644
--- a/users/ninjonas/process_records.c
+++ b/users/ninjonas/process_records.c
@@ -6,10 +6,15 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true;
6__attribute__((weak)) 6__attribute__((weak))
7bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { return true; } 7bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { return true; }
8 8
9#ifdef OLED_DRIVER_ENABLE
10__attribute__((weak))
11bool process_record_oled(uint16_t keycode, keyrecord_t *record) { return true; }
12#endif
13
9bool process_record_user(uint16_t keycode, keyrecord_t *record) { 14bool process_record_user(uint16_t keycode, keyrecord_t *record) {
10 if (record->event.pressed) { 15 if (record->event.pressed) {
11 #ifdef SSD1306OLED 16 #ifdef OLED_DRIVER_ENABLE
12 set_keylog(keycode, record); 17 process_record_oled(keycode, record);
13 #endif 18 #endif
14 } 19 }
15 20
@@ -42,6 +47,13 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
42 } 47 }
43 break; 48 break;
44 49
50 // Sends QMK make command to compile all keyboards
51 case M_MALL:
52 if (record->event.pressed) {
53 SEND_STRING("rm -f *.hex && rm -rf .build/ && make crkbd:ninjonas lily58:ninjonas hotdox:ninjonas pinky/3:ninjonas\n");
54 }
55 break;
56
45 // Sends QMK make command with the correct bootloader 57 // Sends QMK make command with the correct bootloader
46 case M_FLSH: 58 case M_FLSH:
47 if (!record->event.pressed) { 59 if (!record->event.pressed) {
diff --git a/users/ninjonas/process_records.h b/users/ninjonas/process_records.h
index 6db1d91fb6..37d88d0cad 100644
--- a/users/ninjonas/process_records.h
+++ b/users/ninjonas/process_records.h
@@ -11,6 +11,7 @@ enum custom_keycodes {
11 M_PYNV, 11 M_PYNV,
12 M_SHFT, 12 M_SHFT,
13 M_MAKE, 13 M_MAKE,
14 M_MALL,
14 M_FLSH, 15 M_FLSH,
15 M_VRSN, 16 M_VRSN,
16 M_CODE, 17 M_CODE,
diff --git a/users/ninjonas/rules.mk b/users/ninjonas/rules.mk
index 1f2697a0e4..7b77e153d3 100644
--- a/users/ninjonas/rules.mk
+++ b/users/ninjonas/rules.mk
@@ -3,15 +3,10 @@ MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
3EXTRAKEY_ENABLE = yes # Audio control and System control(+450) 3EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
4TAP_DANCE_ENABLE = yes # Enable Tap Dance. 4TAP_DANCE_ENABLE = yes # Enable Tap Dance.
5 5
6Link_Time_Optimization = no # if firmware size over limit, try this option
7
8ifeq ($(strip $(Link_Time_Optimization)),yes)
9 EXTRAFLAGS += -flto -DUSE_Link_Time_Optimization
10endif
11
12SRC += ninjonas.c \ 6SRC += ninjonas.c \
13 process_records.c \ 7 process_records.c \
14 tap_dances.c 8 tap_dances.c \
9 oled.c
15 10
16ifneq ("$(wildcard $(USER_PATH)/secrets.c)","") 11ifneq ("$(wildcard $(USER_PATH)/secrets.c)","")
17 SRC += secrets.c 12 SRC += secrets.c