aboutsummaryrefslogtreecommitdiffstats
path: root/users
diff options
context:
space:
mode:
authorGravatar Jonas Avellana <14019120+ninjonas@users.noreply.github.com>2019-09-25 22:28:06 -0600
committerGravatar Drashna Jaelre <drashna@live.com>2019-09-25 21:28:06 -0700
commitff854565ce012a325ad04b09a7bcb7c8bb9d43c5 (patch)
tree69d4970d4ea40d49483f232bf404d16f383957ba /users
parent2a948e77715f0bd11d4b80315cf84c68890014d4 (diff)
downloadqmk_firmware-ff854565ce012a325ad04b09a7bcb7c8bb9d43c5.tar.gz
[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 82bd5f09a..fb14bfe6c 100644
--- a/users/ninjonas/README.md
+++ b/users/ninjonas/README.md
@@ -6,27 +6,35 @@ See: https://docs.qmk.fm/#/feature_userspace
- ninjonas [QMK user configuration](https://github.com/qmk/qmk_firmware/blob/master/docs/feature_userspace.md)
- On `keymap.c` include `ninjonas.h`
```c
- #include "ninjonas.h"
+ #include "ninjonas.h"
```
+## Supported Keyboards
+- [Crkbd ](../../keyboards/crkbd/keymaps/ninjonas)
+- [Hotdox](../../keyboards/hotdox/keymaps/ninjonas)
+- [Pinky3](../../keyboards/pinky/3/keymaps/ninjonas)
+- [Lily58](../../keyboards/lily58/keymaps/ninjonas)
+
## Features
-### [Keys](ninjonas.h#L44)
+### [Keys](ninjonas.h#L40)
|Code | Description |
|---|---|
|K_LOCK | MacOS shortcut to execute lock command  + ctrl + Q |
|K_CSCN | MacOS shortcut to copy a portion of the screen to the clipboard |
+|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 |
-### [Layers](ninjonas.h#L48)
+### [Layers](ninjonas.h#L47)
|Code | Description |
|---|---|
|LT_LOW | Tap for ENTER, hold for RAISE |
-|LT_FUNC | Tap for ENTER, hold for FUNCTIONS |
|LT_RAI | Tap for SPACE, hold for LOWER |
-|LT_NUM | Tap for SPACE, hold for NUMBERS |
|LT_LOW + LT_RAI | Hold for ADJUST |
-|L_LOWER | Dedicated key to momentarily toggle to use LOWER layer |
+|LM_LOW | Dedicated key to momentarily toggle to use LOWER layer |
+|LM_RAI | Dedicated key to momentarily toggle to use RAISE layer |
-### [Layout Blocks](ninjonas.h#L57)
+### [Layout Blocks](ninjonas.h#L53)
Predefined keyboard layout templates to speed up configuring split keyboards
|Code | Description |
@@ -69,7 +77,7 @@ There's times where you have macros you don't want to share like emails, passwor
```c
// secrets.c
-#include "ninjonas.h"
+#include "ninjonas.h"
bool process_record_secrets(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
diff --git a/users/ninjonas/ninjonas.c b/users/ninjonas/ninjonas.c
index 6a77ecf8b..49e12e482 100644
--- a/users/ninjonas/ninjonas.c
+++ b/users/ninjonas/ninjonas.c
@@ -17,52 +17,4 @@
layer_state_t layer_state_set_user (layer_state_t state) {
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST);
-}
-
-// BEGIN: SSD1306OLED
-// SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h
-#if defined(KEYBOARD_lily58_rev1) & defined(PROTOCOL_LUFA)
-extern uint8_t is_master;
-
-void matrix_init_user(void) {
- //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h
- iota_gfx_init(!has_usb()); // turns on the display
-}
-
-// When add source files to SRC in rules.mk, you can use functions.
-const char *read_layer_state(void);
-const char *read_logo(void);
-//void set_keylog(uint16_t keycode, keyrecord_t *record); // Moved to process_records.h
-const char *read_keylog(void);
-const char *read_keylogs(void);
-
-void matrix_scan_user(void) {
- iota_gfx_task();
-}
-
-void matrix_render_user(struct CharacterMatrix *matrix) {
- if (is_master) {
- // If you want to change the display of OLED, you need to change here
- matrix_write_ln(matrix, read_layer_state());
- matrix_write_ln(matrix, read_keylog());
- matrix_write_ln(matrix, read_keylogs());
- } else {
- matrix_write(matrix, read_logo());
- }
-}
-
-void matrix_update(struct CharacterMatrix *dest, const struct CharacterMatrix *source) {
- if (memcmp(dest->display, source->display, sizeof(dest->display))) {
- memcpy(dest->display, source->display, sizeof(dest->display));
- dest->dirty = true;
- }
-}
-
-void iota_gfx_task_user(void) {
- struct CharacterMatrix matrix;
- matrix_clear(&matrix);
- matrix_render_user(&matrix);
- matrix_update(&display, &matrix);
-}
-#endif
-// END: SSD1306OLED \ No newline at end of file
+} \ No newline at end of file
diff --git a/users/ninjonas/ninjonas.h b/users/ninjonas/ninjonas.h
index 50d7c3680..227534c25 100644
--- a/users/ninjonas/ninjonas.h
+++ b/users/ninjonas/ninjonas.h
@@ -36,23 +36,19 @@
#define _LOWER 3
#define _RAISE 4
#define _ADJUST 5
-#ifdef KEYBOARD_pinky_3
- #define _NUMBERS 6
- #define _FUNCTIONS 7
-#endif
// 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_MDSH LSFT(LALT(KC_MINS))
+#define K_LAPP SGUI(KC_TAB) //  + Shift + Tab
+#define K_RAPP LGUI(KC_TAB) //  + Tab
// Layer Keys
-#define L_LOWER MO(_LOWER)
+#define LM_LOW MO(_LOWER)
+#define LM_RAI MO(_RAISE)
#define LT_LOW LT(_LOWER, KC_ENT)
#define LT_RAI LT(_RAISE, KC_SPC)
-#ifdef KEYBOARD_pinky_3
- #define LT_NUM LT(_NUMBERS, KC_SPC)
- #define LT_FUNC LT(_FUNCTIONS, KC_ENT)
-#endif
// Layout blocks
#define _____________________QWERTY_L1______________________ T_TAB, T_Q, T_W, KC_E, KC_R, KC_T
@@ -105,7 +101,7 @@
#define _________MEDIA_3_________ XXXXXXX, KC_MRWD, KC__VOLDOWN
#define ________MOD_LEFT_________ KC_LALT, T_GUI, KC_LCTL
-#define ________MOD_RIGHT________ KC_BSPC, KC_DEL, L_LOWER
+#define ________MOD_RIGHT________ KC_BSPC, KC_DEL, LM_LOW
// Layout wrappers
#define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__)
diff --git a/users/ninjonas/oled.c b/users/ninjonas/oled.c
new file mode 100644
index 000000000..837d497ab
--- /dev/null
+++ b/users/ninjonas/oled.c
@@ -0,0 +1,82 @@
+#include QMK_KEYBOARD_H
+#include <stdio.h>
+#include "ninjonas.h"
+
+#ifdef OLED_DRIVER_ENABLE
+
+static uint16_t oled_timer = 0;
+extern uint8_t is_master;
+
+bool process_record_oled(uint16_t keycode, keyrecord_t *record) {
+ if (record->event.pressed) {
+ oled_timer = timer_read();
+ }
+ return true;
+}
+
+void render_default_layer_state(void) {
+ oled_write_P(PSTR("Layout: "), false);
+ switch (biton32(default_layer_state)) {
+ case _COLEMAK:
+ oled_write_P(PSTR("Colemak"), false);
+ break;
+ case _DVORAK:
+ oled_write_P(PSTR("Dvorak"), false);
+ break;
+ case _QWERTY:
+ oled_write_P(PSTR("Qwerty"), false);
+ break;
+ default:
+ oled_write_ln_P(PSTR("Undefined"), false);
+ }
+}
+
+void render_layer_state(void) {
+ oled_write_P(PSTR("\nLayer:"), false);
+ oled_write_P(PSTR(" LOW"), layer_state_is(_LOWER));
+ oled_write_P(PSTR(" RAI"), layer_state_is(_RAISE));
+ oled_write_P(PSTR(" ADJ"), layer_state_is(_ADJUST));
+}
+
+void render_mod_status(uint8_t modifiers) {
+ oled_write_P(PSTR("\nMods: "), false);
+ oled_write_P(PSTR("SHF "), (modifiers & MOD_MASK_SHIFT));
+ oled_write_P(PSTR("CTL "), (modifiers & MOD_MASK_CTRL));
+ oled_write_P(PSTR("ALT "), (modifiers & MOD_MASK_ALT));
+ oled_write_P(PSTR("GUI"), (modifiers & MOD_MASK_GUI));
+}
+
+void render_status(void){
+ render_default_layer_state();
+ render_layer_state();
+ render_mod_status(get_mods()|get_oneshot_mods());
+}
+
+static void render_logo(void) {
+ static const char PROGMEM qmk_logo[] = {
+ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94,
+ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4,
+ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4,
+ 0};
+
+ oled_write_P(qmk_logo, false);
+}
+
+void oled_task_user(void) {
+ if (timer_elapsed(oled_timer) > 30000) {
+ oled_off();
+ return;
+ }
+ #ifndef SPLIT_KEYBOARD
+ else { oled_on(); }
+ #endif
+
+ if (is_master) {
+ render_status();
+ } else {
+ render_logo();
+ oled_scroll_left();
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/users/ninjonas/process_records.c b/users/ninjonas/process_records.c
index 1b7958abc..e1960aaa3 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;
__attribute__((weak))
bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { return true; }
+#ifdef OLED_DRIVER_ENABLE
+__attribute__((weak))
+bool process_record_oled(uint16_t keycode, keyrecord_t *record) { return true; }
+#endif
+
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
- #ifdef SSD1306OLED
- set_keylog(keycode, record);
+ #ifdef OLED_DRIVER_ENABLE
+ process_record_oled(keycode, record);
#endif
}
@@ -42,6 +47,13 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
break;
+ // Sends QMK make command to compile all keyboards
+ case M_MALL:
+ if (record->event.pressed) {
+ SEND_STRING("rm -f *.hex && rm -rf .build/ && make crkbd:ninjonas lily58:ninjonas hotdox:ninjonas pinky/3:ninjonas\n");
+ }
+ break;
+
// Sends QMK make command with the correct bootloader
case M_FLSH:
if (!record->event.pressed) {
diff --git a/users/ninjonas/process_records.h b/users/ninjonas/process_records.h
index 6db1d91fb..37d88d0ca 100644
--- a/users/ninjonas/process_records.h
+++ b/users/ninjonas/process_records.h
@@ -11,6 +11,7 @@ enum custom_keycodes {
M_PYNV,
M_SHFT,
M_MAKE,
+ M_MALL,
M_FLSH,
M_VRSN,
M_CODE,
diff --git a/users/ninjonas/rules.mk b/users/ninjonas/rules.mk
index 1f2697a0e..7b77e153d 100644
--- a/users/ninjonas/rules.mk
+++ b/users/ninjonas/rules.mk
@@ -3,15 +3,10 @@ MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
TAP_DANCE_ENABLE = yes # Enable Tap Dance.
-Link_Time_Optimization = no # if firmware size over limit, try this option
-
-ifeq ($(strip $(Link_Time_Optimization)),yes)
- EXTRAFLAGS += -flto -DUSE_Link_Time_Optimization
-endif
-
SRC += ninjonas.c \
process_records.c \
- tap_dances.c
+ tap_dances.c \
+ oled.c
ifneq ("$(wildcard $(USER_PATH)/secrets.c)","")
SRC += secrets.c