From cffe671a61e8187b39a508556c7a5b5f04835d24 Mon Sep 17 00:00:00 2001 From: Jonas Avellana <14019120+ninjonas@users.noreply.github.com> Date: Mon, 30 Sep 2019 11:50:27 -0600 Subject: [Keymap] Updating crkbd RGB keymap implementation & ninjonas userspace updates (#6834) * [keymap] Updating crkbd RGB implementation & ninjonas userspace updates * [chore] adding process_record_oled method to process_records.h --- users/ninjonas/README.md | 25 +++++++++++++++++-------- users/ninjonas/ninjonas.h | 3 --- users/ninjonas/oled.c | 14 ++++++++------ users/ninjonas/process_records.c | 10 ++++------ users/ninjonas/process_records.h | 14 +++++++++----- 5 files changed, 38 insertions(+), 28 deletions(-) (limited to 'users/ninjonas') diff --git a/users/ninjonas/README.md b/users/ninjonas/README.md index fb14bfe6c2..32ccdc699f 100644 --- a/users/ninjonas/README.md +++ b/users/ninjonas/README.md @@ -16,7 +16,7 @@ See: https://docs.qmk.fm/#/feature_userspace - [Lily58](../../keyboards/lily58/keymaps/ninjonas) ## Features -### [Keys](ninjonas.h#L40) +### [Keys](ninjonas.h#L37) |Code | Description | |---|---| |K_LOCK | MacOS shortcut to execute lock command  + ctrl + Q | @@ -25,7 +25,7 @@ See: https://docs.qmk.fm/#/feature_userspace |K_RAPP | MacOS shortcut to switch apps to the right | |K_LAPP | MacOS shortcut to switch apps to the left | -### [Layers](ninjonas.h#L47) +### [Layers](ninjonas.h#L44) |Code | Description | |---|---| |LT_LOW | Tap for ENTER, hold for RAISE | @@ -34,7 +34,7 @@ See: https://docs.qmk.fm/#/feature_userspace |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#L53) +### [Layout Blocks](ninjonas.h#L50) Predefined keyboard layout templates to speed up configuring split keyboards |Code | Description | @@ -59,6 +59,7 @@ Predefined keyboard layout templates to speed up configuring split keyboards |M_VRSN | macro to send QMK version | |M_SHFT | Sends  + alt + shift to a keycode to activate [ShiftIt](https://github.com/fikovnik/ShiftIt) | |M_CODE | Opens [Visual Studio Code](https://code.visualstudio.com/) on current directory | +|M_XXX1 to M_XXX5 | Reserved for secret macros see [Secrets](#secrets) | ### [Tap-Dance](tap_dances.h) |Code | Description | @@ -73,21 +74,29 @@ Predefined keyboard layout templates to speed up configuring split keyboards |T_Q | Tap for Q, double tap for  + Q | ### Secrets -There's times where you have macros you don't want to share like emails, passwords 😱, & and private strings. Based off [drashna's secret macros](https://github.com/qmk/qmk_firmware/blob/master/users/drashna/readme_secrets.md), it's now possible to do this. All you need to do is create a `secrets.c` file. Below is an example of how this is used. +There's times where you have macros you don't want to share like emails, an address you need but you always forget, passwords 😱, & and private strings. Based off [drashna's secret macros](https://github.com/qmk/qmk_firmware/blob/master/users/drashna/readme_secrets.md), it's now possible to do this. All you need to do is create a `secrets.c` file. Below is an example of how this is used. ```c // secrets.c -#include "ninjonas.h" +#include "ninjonas.h" + +static const char * const secret[] = { + "BLANK1", + "BLANK2", + "BLANK3", + "BLANK4", + "BLANK5" +}; bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { switch (keycode) { - // Sends zoom URL - case M_ZOOM: + case M_XXX1...M_XXX5: if (record->event.pressed) { - SEND_STRING("SECRET_STRING_HERE" SS_TAP(X_ENTER)); + send_string(secret[keycode - M_XXX1]); } break; } return true; } + ``` \ No newline at end of file diff --git a/users/ninjonas/ninjonas.h b/users/ninjonas/ninjonas.h index 227534c259..fdba683702 100644 --- a/users/ninjonas/ninjonas.h +++ b/users/ninjonas/ninjonas.h @@ -26,9 +26,6 @@ #include "lufa.h" #include "split_util.h" #endif -#ifdef SSD1306OLED - #include "ssd1306.h" -#endif #define _QWERTY 0 #define _DVORAK 1 diff --git a/users/ninjonas/oled.c b/users/ninjonas/oled.c index 837d497ab3..8a9c995936 100644 --- a/users/ninjonas/oled.c +++ b/users/ninjonas/oled.c @@ -7,10 +7,10 @@ static uint16_t oled_timer = 0; extern uint8_t is_master; -bool process_record_oled(uint16_t keycode, keyrecord_t *record) { +bool process_record_oled(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { oled_timer = timer_read(); - } + } return true; } @@ -48,6 +48,7 @@ void render_mod_status(uint8_t modifiers) { void render_status(void){ render_default_layer_state(); + oled_write_P(PSTR("\n"), false); render_layer_state(); render_mod_status(get_mods()|get_oneshot_mods()); } @@ -70,12 +71,13 @@ void oled_task_user(void) { #ifndef SPLIT_KEYBOARD else { oled_on(); } #endif - + if (is_master) { - render_status(); + render_status(); } else { - render_logo(); - oled_scroll_left(); + oled_write_P(PSTR("\n"), false); + render_logo(); + oled_scroll_left(); } } diff --git a/users/ninjonas/process_records.c b/users/ninjonas/process_records.c index e1960aaa3e..6ec5be5978 100644 --- a/users/ninjonas/process_records.c +++ b/users/ninjonas/process_records.c @@ -12,18 +12,16 @@ 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 OLED_DRIVER_ENABLE - process_record_oled(keycode, record); - #endif - } + #ifdef OLED_DRIVER_ENABLE + process_record_oled(keycode, record); + #endif switch (keycode) { // Sends pyenv to activate 'jira' environment case M_PYNV: if (record->event.pressed) { - SEND_STRING("pyenv activate jira" SS_TAP(X_ENTER)); + SEND_STRING("pyenv activate jira\n"); } break; diff --git a/users/ninjonas/process_records.h b/users/ninjonas/process_records.h index 37d88d0cad..07babdd583 100644 --- a/users/ninjonas/process_records.h +++ b/users/ninjonas/process_records.h @@ -7,7 +7,6 @@ enum custom_keycodes { DVORAK, COLEMAK, // Custom Macros - M_ZOOM, M_PYNV, M_SHFT, M_MAKE, @@ -15,11 +14,16 @@ enum custom_keycodes { M_FLSH, M_VRSN, M_CODE, + // Secret Macros + M_XXX1, + M_XXX2, + M_XXX3, + M_XXX4, + M_XXX5, }; -#ifdef SSD1306OLED -void set_keylog(uint16_t keycode, keyrecord_t *record); -#endif - bool process_record_secrets(uint16_t keycode, keyrecord_t *record); bool process_record_keymap(uint16_t keycode, keyrecord_t *record); +#ifdef OLED_DRIVER_ENABLE +bool process_record_oled(uint16_t keycode, keyrecord_t *record); +#endif -- cgit v1.2.3