summaryrefslogtreecommitdiffstats
path: root/users
diff options
context:
space:
mode:
Diffstat (limited to 'users')
-rw-r--r--users/drashna/config.h3
-rw-r--r--users/drashna/drashna.c35
-rw-r--r--users/drashna/drashna.h9
-rw-r--r--users/drashna/oled_stuff.c278
-rw-r--r--users/drashna/oled_stuff.h91
-rw-r--r--users/drashna/process_records.c359
-rw-r--r--users/drashna/process_records.h18
-rw-r--r--users/drashna/rgb_matrix_stuff.c86
-rw-r--r--users/drashna/rgb_matrix_stuff.h9
-rw-r--r--users/drashna/rgb_stuff.c404
-rw-r--r--users/drashna/rgb_stuff.h26
-rw-r--r--users/drashna/rules.mk13
12 files changed, 854 insertions, 477 deletions
diff --git a/users/drashna/config.h b/users/drashna/config.h
index 106ae19c14..64b4b64ab7 100644
--- a/users/drashna/config.h
+++ b/users/drashna/config.h
@@ -1,7 +1,7 @@
#pragma once
// Use custom magic number so that when switching branches, EEPROM always gets reset
-#define EECONFIG_MAGIC_NUMBER (uint16_t)0x1337
+#define EECONFIG_MAGIC_NUMBER (uint16_t)0x1338
/* Set Polling rate to 1000Hz */
#define USB_POLLING_INTERVAL_MS 1
@@ -52,6 +52,7 @@
# if defined(__AVR__) && !defined(__AVR_AT90USB1286__)
# define DISABLE_RGB_MATRIX_ALPHAS_MODS
# define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
+# define DISABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT
# define DISABLE_RGB_MATRIX_BREATHING
# define DISABLE_RGB_MATRIX_BAND_SAT
# define DISABLE_RGB_MATRIX_BAND_VAL
diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c
index 1a4ee9b414..ba19d4803f 100644
--- a/users/drashna/drashna.c
+++ b/users/drashna/drashna.c
@@ -18,12 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "drashna.h"
userspace_config_t userspace_config;
-#if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE))
-# define DRASHNA_UNICODE_MODE UC_WIN
-#else
-// set to 2 for UC_WIN, set to 4 for UC_WINC
-# define DRASHNA_UNICODE_MODE 2
-#endif
bool mod_key_press_timer(uint16_t code, uint16_t mod_code, bool pressed) {
static uint16_t this_timer;
@@ -93,19 +87,17 @@ void matrix_init_user(void) {
DDRB &= ~(1 << 0);
PORTB &= ~(1 << 0);
#endif
-
-#if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE))
- set_unicode_input_mode(DRASHNA_UNICODE_MODE);
- get_unicode_input_mode();
-#endif // UNICODE_ENABLE
matrix_init_keymap();
}
__attribute__((weak)) void keyboard_post_init_keymap(void) {}
void keyboard_post_init_user(void) {
-#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
- keyboard_post_init_rgb();
+#if defined(RGBLIGHT_ENABLE)
+ keyboard_post_init_rgb_light();
+#endif
+#if defined(RGB_MATRIX_ENABLE)
+ keyboard_post_init_rgb_matrix();
#endif
keyboard_post_init_keymap();
}
@@ -155,9 +147,12 @@ void matrix_scan_user(void) {
run_diablo_macro_check();
#endif // TAP_DANCE_ENABLE
-#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
- matrix_scan_rgb();
+#if defined(RGBLIGHT_ENABLE)
+ matrix_scan_rgb_light();
#endif // RGBLIGHT_ENABLE
+#if defined(RGB_MATRIX_ENABLE)
+ matrix_scan_rgb_matrix();
+#endif
matrix_scan_keymap();
}
@@ -168,8 +163,8 @@ __attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state)
// Then runs keymap's layer change check
layer_state_t layer_state_set_user(layer_state_t state) {
state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST);
-#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
- state = layer_state_set_rgb(state);
+#if defined(RGBLIGHT_ENABLE)
+ state = layer_state_set_rgb_light(state);
#endif // RGBLIGHT_ENABLE
return layer_state_set_keymap(state);
}
@@ -200,12 +195,6 @@ void eeconfig_init_user(void) {
userspace_config.raw = 0;
userspace_config.rgb_layer_change = true;
eeconfig_update_user(userspace_config.raw);
-#if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE))
- set_unicode_input_mode(DRASHNA_UNICODE_MODE);
- get_unicode_input_mode();
-#else
- eeprom_update_byte(EECONFIG_UNICODEMODE, DRASHNA_UNICODE_MODE);
-#endif
eeconfig_init_keymap();
keyboard_init();
}
diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h
index 0ba1817604..c10ea5114a 100644
--- a/users/drashna/drashna.h
+++ b/users/drashna/drashna.h
@@ -25,9 +25,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifdef TAP_DANCE_ENABLE
# include "tap_dances.h"
#endif // TAP_DANCE_ENABLE
-#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
+#if defined(RGBLIGHT_ENABLE)
# include "rgb_stuff.h"
#endif
+#if defined(RGB_MATRIX_ENABLE)
+# include "rgb_matrix_stuff.h"
+#endif
+#if defined(OLED_DRIVER_ENABLE)
+# include "oled_stuff.h"
+#endif
/* Define layer names */
enum userspace_layers {
@@ -70,7 +76,6 @@ typedef union {
bool rgb_layer_change :1;
bool is_overwatch :1;
bool nuke_switch :1;
- uint8_t unicode_mod :4;
bool swapped_numbers :1;
bool rgb_matrix_idle_anim :1;
};
diff --git a/users/drashna/oled_stuff.c b/users/drashna/oled_stuff.c
new file mode 100644
index 0000000000..7580de1d33
--- /dev/null
+++ b/users/drashna/oled_stuff.c
@@ -0,0 +1,278 @@
+#include "drashna.h"
+
+extern uint8_t is_master;
+
+#ifndef KEYLOGGER_LENGTH
+// # ifdef OLED_DISPLAY_128X64
+# define KEYLOGGER_LENGTH ((int)(OLED_DISPLAY_HEIGHT / OLED_FONT_WIDTH))
+// # else
+// # define KEYLOGGER_LENGTH (uint8_t *(OLED_DISPLAY_WIDTH / OLED_FONT_HEIGHT))
+// # endif
+#endif
+
+static uint32_t oled_timer = 0;
+static char keylog_str[KEYLOGGER_LENGTH + 1] = {"\n"};
+static uint16_t log_timer = 0;
+
+// clang-format off
+static const char PROGMEM code_to_name[0xFF] = {
+// 0 1 2 3 4 5 6 7 8 9 A B c D E F
+ ' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', // 0x
+ 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', // 1x
+ '3', '4', '5', '6', '7', '8', '9', '0', 20, 19, 27, 26, 22, '-', '=', '[', // 2x
+ ']','\\', '#', ';','\'', '`', ',', '.', '/', 128, ' ', ' ', ' ', ' ', ' ', ' ', // 3x
+ ' ', ' ', ' ', ' ', ' ', ' ', 'P', 'S', ' ', ' ', ' ', ' ', 16, ' ', ' ', ' ', // 4x
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 5x
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 6x
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 7x
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 8x
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // 9x
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Ax
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Bx
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Cx
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Dx
+ 'C', 'S', 'A', 'C', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', // Ex
+ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' // Fx
+};
+// clang-format on
+
+void add_keylog(uint16_t keycode) {
+ if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX) || (keycode >= QK_MODS && keycode <= QK_MODS_MAX)) {
+ keycode = keycode & 0xFF;
+ } else if (keycode > 0xFF) {
+ keycode = 0;
+ }
+
+ for (uint8_t i = (KEYLOGGER_LENGTH - 1); i > 0; --i) {
+ keylog_str[i] = keylog_str[i - 1];
+ }
+
+ if (keycode < (sizeof(code_to_name) / sizeof(char))) {
+ keylog_str[0] = pgm_read_byte(&code_to_name[keycode]);
+ }
+
+ log_timer = timer_read();
+}
+
+bool process_record_user_oled(uint16_t keycode, keyrecord_t *record) {
+ if (record->event.pressed) {
+#ifdef OLED_DRIVER_ENABLE
+ oled_timer = timer_read32();
+ add_keylog(keycode);
+#endif
+ }
+ return true;
+}
+
+void update_log(void) {
+ if (timer_elapsed(log_timer) > 750) {
+ // add_keylog(0);
+ }
+}
+
+void render_keylogger_status(void) {
+ oled_write_P(PSTR(OLED_RENDER_KEYLOGGER), false);
+ oled_write(keylog_str, false);
+}
+
+void render_default_layer_state(void) {
+ oled_write_P(PSTR(OLED_RENDER_LAYOUT_NAME), false);
+ switch (get_highest_layer(default_layer_state)) {
+ case _QWERTY:
+ oled_write_P(PSTR(OLED_RENDER_LAYOUT_QWERTY), false);
+ break;
+ case _COLEMAK:
+ oled_write_P(PSTR(OLED_RENDER_LAYOUT_COLEMAK), false);
+ break;
+ case _DVORAK:
+ oled_write_P(PSTR(OLED_RENDER_LAYOUT_DVORAK), false);
+ break;
+ case _WORKMAN:
+ oled_write_P(PSTR(OLED_RENDER_LAYOUT_WORKMAN), false);
+ break;
+ case _NORMAN:
+ oled_write_P(PSTR(OLED_RENDER_LAYOUT_NORMAN), false);
+ break;
+ case _MALTRON:
+ oled_write_P(PSTR(OLED_RENDER_LAYOUT_MALTRON), false);
+ break;
+ case _EUCALYN:
+ oled_write_P(PSTR(OLED_RENDER_LAYOUT_EUCALYN), false);
+ break;
+ case _CARPLAX:
+ oled_write_P(PSTR(OLED_RENDER_LAYOUT_CARPLAX), false);
+ break;
+ }
+#ifdef OLED_DISPLAY_128X64
+ oled_advance_page(true);
+#endif
+}
+
+void render_layer_state(void) {
+ oled_write_P(PSTR(OLED_RENDER_LAYER_NAME), false);
+#ifdef OLED_DISPLAY_128X64
+ oled_write_P(PSTR(" "), false);
+#endif
+ oled_write_P(PSTR(OLED_RENDER_LAYER_LOWER), layer_state_is(_LOWER));
+#ifdef OLED_DISPLAY_128X64
+ oled_write_P(PSTR(" "), false);
+#endif
+ oled_write_P(PSTR(OLED_RENDER_LAYER_RAISE), layer_state_is(_RAISE));
+#if _MODS
+# ifdef OLED_DISPLAY_128X64
+ oled_write_P(PSTR(" "), false);
+# endif
+ oled_write_P(PSTR(OLED_RENDER_LAYER_MODS), layer_state_is(_MODS));
+#endif
+#ifdef OLED_DISPLAY_128X64
+ oled_advance_page(true);
+#endif
+}
+
+void render_keylock_status(uint8_t led_usb_state) {
+ oled_write_P(PSTR(OLED_RENDER_LOCK_NAME), false);
+ oled_write_P(PSTR(" "), false);
+ oled_write_P(PSTR(OLED_RENDER_LOCK_NUML), led_usb_state & (1 << USB_LED_NUM_LOCK));
+#ifdef OLED_DISPLAY_128X64
+ oled_write_P(PSTR(" "), false);
+#endif
+ oled_write_P(PSTR(OLED_RENDER_LOCK_CAPS), led_usb_state & (1 << USB_LED_CAPS_LOCK));
+#ifdef OLED_DISPLAY_128X64
+ oled_write_P(PSTR(" "), false);
+#endif
+ oled_write_P(PSTR(OLED_RENDER_LOCK_SCLK), led_usb_state & (1 << USB_LED_SCROLL_LOCK));
+#ifndef OLED_DISPLAY_128X64
+ oled_advance_page(true);
+#endif
+}
+
+void render_mod_status(uint8_t modifiers) {
+ oled_write_P(PSTR(OLED_RENDER_MODS_NAME), false);
+ oled_write_P(PSTR(OLED_RENDER_MODS_SFT), (modifiers & MOD_MASK_SHIFT));
+#ifdef OLED_DISPLAY_128X64
+ oled_write_P(PSTR(" "), false);
+#endif
+ oled_write_P(PSTR(OLED_RENDER_MODS_CTL), (modifiers & MOD_MASK_CTRL));
+#ifdef OLED_DISPLAY_128X64
+ oled_write_P(PSTR(" "), false);
+#endif
+ oled_write_P(PSTR(OLED_RENDER_MODS_ALT), (modifiers & MOD_MASK_ALT));
+#ifdef OLED_DISPLAY_128X64
+ oled_write_P(PSTR(" "), false);
+#endif
+ oled_write_P(PSTR(OLED_RENDER_MODS_GUI), (modifiers & MOD_MASK_GUI));
+}
+
+void render_bootmagic_status(void) {
+ /* Show Ctrl-Gui Swap options */
+ static const char PROGMEM logo[][2][3] = {
+ {{0x97, 0x98, 0}, {0xb7, 0xb8, 0}},
+ {{0x95, 0x96, 0}, {0xb5, 0xb6, 0}},
+ };
+
+ oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_NAME), false);
+#ifdef OLED_DISPLAY_128X64
+ if (keymap_config.swap_lctl_lgui)
+#else
+ oled_write_P(PSTR(" "), false);
+#endif
+ {
+ oled_write_P(logo[1][0], false);
+#ifdef OLED_DISPLAY_128X64
+ } else {
+#endif
+ oled_write_P(logo[0][0], false);
+ }
+ oled_write_P(PSTR(" "), false);
+#ifdef OLED_DISPLAY_128X64
+ oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_NKRO), keymap_config.nkro);
+ oled_write_P(PSTR(" "), false);
+ oled_write_ln_P(PSTR(OLED_RENDER_BOOTMAGIC_NOGUI), !keymap_config.no_gui);
+ oled_write_P(PSTR("Magic "), false);
+ if (keymap_config.swap_lctl_lgui)
+#endif
+ {
+ oled_write_P(logo[1][1], false);
+#ifdef OLED_DISPLAY_128X64
+ } else {
+#endif
+ oled_write_P(logo[0][1], false);
+ }
+ oled_write_P(PSTR(" "), false);
+#ifdef OLED_DISPLAY_128X64
+ oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_GRV), keymap_config.swap_grave_esc);
+ oled_write_P(PSTR(" "), false);
+ oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_CAPS), keymap_config.swap_control_capslock);
+ oled_advance_page(true);
+#else
+ oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_NKRO), keymap_config.nkro);
+#endif
+}
+
+void render_user_status(void) {
+ oled_write_P(PSTR(OLED_RENDER_USER_NAME), false);
+ oled_write_P(PSTR(" "), false);
+ oled_write_P(PSTR(OLED_RENDER_USER_ANIM), userspace_config.rgb_matrix_idle_anim);
+ oled_write_P(PSTR(" "), false);
+ oled_write_P(PSTR(OLED_RENDER_USER_LAYR), userspace_config.rgb_layer_change);
+ oled_write_P(PSTR(" "), false);
+ oled_write_P(PSTR(OLED_RENDER_USER_NUKE), userspace_config.nuke_switch);
+#ifdef OLED_DISPLAY_128X64
+ oled_advance_page(true);
+#endif
+}
+
+__attribute__((weak)) void oled_driver_render_logo(void) {
+ // clang-format off
+ 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};
+ // clang-format on
+ oled_write_P(qmk_logo, false);
+}
+
+void render_status_secondary(void) {
+#if !defined(SPLIT_TRANSPORT_MIRROR) || defined(OLED_DRIVER_128x64)
+ oled_driver_render_logo();
+#endif
+#ifdef SPLIT_TRANSPORT_MIRROR
+ /* Show Keyboard Layout */
+ render_default_layer_state();
+ render_layer_state();
+ render_mod_status(get_mods() | get_oneshot_mods());
+ render_keylogger_status();
+
+#endif
+}
+// clang-format on
+
+void render_status_main(void) {
+ /* Show Keyboard Layout */
+ render_default_layer_state();
+ render_keylock_status(host_keyboard_leds());
+ render_bootmagic_status();
+ render_user_status();
+
+ render_keylogger_status();
+}
+
+void oled_task_user(void) {
+ if (timer_elapsed32(oled_timer) > 30000) {
+ oled_off();
+ return;
+ }
+#ifndef SPLIT_KEYBOARD
+ else {
+ oled_on();
+ }
+#endif
+
+ update_log();
+
+ if (is_master) {
+ render_status_main(); // Renders the current keyboard state (layer, lock, caps, scroll, etc)
+ } else {
+ render_status_secondary();
+ }
+}
diff --git a/users/drashna/oled_stuff.h b/users/drashna/oled_stuff.h
new file mode 100644
index 0000000000..662e206b76
--- /dev/null
+++ b/users/drashna/oled_stuff.h
@@ -0,0 +1,91 @@
+#pragma once
+
+#include "quantum.h"
+#include "oled_driver.h"
+
+void oled_driver_render_logo(void);
+bool process_record_user_oled(uint16_t keycode, keyrecord_t *record);
+
+#ifdef OLED_DISPLAY_128X64
+# define OLED_RENDER_KEYLOGGER "Keylogger: "
+
+# define OLED_RENDER_LAYOUT_NAME "Layout: "
+# define OLED_RENDER_LAYOUT_QWERTY "Qwerty"
+# define OLED_RENDER_LAYOUT_COLEMAK "Colemak"
+# define OLED_RENDER_LAYOUT_DVORAK "Dvorak"
+# define OLED_RENDER_LAYOUT_WORKMAN "Workman"
+# define OLED_RENDER_LAYOUT_NORMAN "Norman"
+# define OLED_RENDER_LAYOUT_MALTRON "Matron"
+# define OLED_RENDER_LAYOUT_EUCALYN "Eucalyn"
+# define OLED_RENDER_LAYOUT_CARPLAX "Carplax"
+
+# define OLED_RENDER_LAYER_NAME "Layer:\n"
+# define OLED_RENDER_LAYER_LOWER "Lower"
+# define OLED_RENDER_LAYER_RAISE "Raise"
+# define OLED_RENDER_LAYER_ADJUST "Adjust"
+# define OLED_RENDER_LAYER_MODS "Mods"
+
+# define OLED_RENDER_LOCK_NAME "Lock: "
+# define OLED_RENDER_LOCK_NUML "NUML"
+# define OLED_RENDER_LOCK_CAPS "CAPS"
+# define OLED_RENDER_LOCK_SCLK "SCLK"
+
+# define OLED_RENDER_MODS_NAME "Mods: "
+# define OLED_RENDER_MODS_SFT "Sft"
+# define OLED_RENDER_MODS_CTL "Ctl"
+# define OLED_RENDER_MODS_ALT "Alt"
+# define OLED_RENDER_MODS_GUI "GUI"
+
+# define OLED_RENDER_BOOTMAGIC_NAME "Boot "
+# define OLED_RENDER_BOOTMAGIC_NKRO "NKRO"
+# define OLED_RENDER_BOOTMAGIC_NOGUI "nGUI"
+# define OLED_RENDER_BOOTMAGIC_GRV "GRV"
+# define OLED_RENDER_BOOTMAGIC_CAPS "CAPS"
+
+# define OLED_RENDER_USER_NAME "USER:"
+# define OLED_RENDER_USER_ANIM "Anim"
+# define OLED_RENDER_USER_LAYR "Layr"
+# define OLED_RENDER_USER_NUKE "Nuke"
+
+#else
+# define OLED_RENDER_KEYLOGGER "KLogr"
+
+# define OLED_RENDER_LAYOUT_NAME "Lyout"
+# define OLED_RENDER_LAYOUT_QWERTY " QRTY"
+# define OLED_RENDER_LAYOUT_COLEMAK " COLE"
+# define OLED_RENDER_LAYOUT_DVORAK " DVRK"
+# define OLED_RENDER_LAYOUT_WORKMAN " WKMN"
+# define OLED_RENDER_LAYOUT_NORMAN " NORM"
+# define OLED_RENDER_LAYOUT_MALTRON " MLTN"
+# define OLED_RENDER_LAYOUT_EUCALYN " ECLN"
+# define OLED_RENDER_LAYOUT_CARPLAX " CRPX"
+
+# define OLED_RENDER_LAYER_NAME "LAYER"
+# define OLED_RENDER_LAYER_LOWER "Lower"
+# define OLED_RENDER_LAYER_RAISE "Raise"
+# define OLED_RENDER_LAYER_ADJUST "Adjst"
+# define OLED_RENDER_LAYER_MODS " Mods"
+
+# define OLED_RENDER_LOCK_NAME "Lock:"
+# define OLED_RENDER_LOCK_NUML "N"
+# define OLED_RENDER_LOCK_CAPS "C"
+# define OLED_RENDER_LOCK_SCLK "S"
+
+# define OLED_RENDER_MODS_NAME "Mods: "
+# define OLED_RENDER_MODS_SFT "S"
+# define OLED_RENDER_MODS_CTL "C"
+# define OLED_RENDER_MODS_ALT "A"
+# define OLED_RENDER_MODS_GUI "G"
+
+# define OLED_RENDER_BOOTMAGIC_NAME "BTMGK"
+# define OLED_RENDER_BOOTMAGIC_NKRO "NKRO"
+# define OLED_RENDER_BOOTMAGIC_NOGUI "nGUI"
+# define OLED_RENDER_BOOTMAGIC_GRV "GRV"
+# define OLED_RENDER_BOOTMAGIC_CAPS "CAPS"
+
+# define OLED_RENDER_USER_NAME "USER:"
+# define OLED_RENDER_USER_ANIM "Anim"
+# define OLED_RENDER_USER_LAYR "Layr"
+# define OLED_RENDER_USER_NUKE "Nuke"
+
+#endif
diff --git a/users/drashna/process_records.c b/users/drashna/process_records.c
index af3ee9cf05..101b3d95ce 100644
--- a/users/drashna/process_records.c
+++ b/users/drashna/process_records.c
@@ -17,101 +17,308 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
xprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed);
# endif
#endif // KEYLOGGER_ENABLE
+#ifdef OLED_DRIVER_ENABLE
+ process_record_user_oled(keycode, record);
+#endif // OLED
- switch (keycode) {
- case KC_QWERTY ... KC_WORKMAN:
- if (record->event.pressed) {
- uint8_t mods = mod_config(get_mods() | get_oneshot_mods());
- if (!mods) {
- set_single_persistent_default_layer(keycode - KC_QWERTY);
- } else if (mods & MOD_MASK_SHIFT) {
- set_single_persistent_default_layer(keycode - KC_QWERTY + 4);
- } else if (mods & MOD_MASK_CTRL) {
- set_single_persistent_default_layer(keycode - KC_QWERTY + 8);
+ if (process_record_keymap(keycode, record) && process_record_secrets(keycode, record)
+#ifdef RGB_MATRIX_ENABLE
+ && process_record_user_rgb_matrix(keycode, record)
+#endif
+#ifdef RGBLIGHT_ENABLE
+ && process_record_user_rgb_light(keycode, record)
+#endif
+ ) {
+ switch (keycode) {
+ case KC_QWERTY ... KC_WORKMAN:
+ if (record->event.pressed) {
+ uint8_t mods = mod_config(get_mods() | get_oneshot_mods());
+ if (!mods) {
+ set_single_persistent_default_layer(keycode - KC_QWERTY);
+ } else if (mods & MOD_MASK_SHIFT) {
+ set_single_persistent_default_layer(keycode - KC_QWERTY + 4);
+ } else if (mods & MOD_MASK_CTRL) {
+ set_single_persistent_default_layer(keycode - KC_QWERTY + 8);
+ }
}
- }
- break;
+ break;
- case KC_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader
- if (!record->event.pressed) {
- uint8_t temp_mod = mod_config(get_mods());
- uint8_t temp_osm = mod_config(get_oneshot_mods());
- clear_mods();
- clear_oneshot_mods();
- send_string_with_delay_P(PSTR("make " QMK_KEYBOARD ":" QMK_KEYMAP), TAP_CODE_DELAY);
+ case KC_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader
+ if (!record->event.pressed) {
#ifndef MAKE_BOOTLOADER
- if ((temp_mod | temp_osm) & MOD_MASK_SHIFT)
+ uint8_t temp_mod = mod_config(get_mods());
+ uint8_t temp_osm = mod_config(get_oneshot_mods());
+ clear_mods();
+ clear_oneshot_mods();
#endif
- {
- send_string_with_delay_P(PSTR(":flash"), TAP_CODE_DELAY);
- }
- if ((temp_mod | temp_osm) & MOD_MASK_CTRL) {
- send_string_with_delay_P(PSTR(" -j8 --output-sync"), TAP_CODE_DELAY);
- }
+ send_string_with_delay_P(PSTR("bin/qmk"), TAP_CODE_DELAY);
+#ifndef MAKE_BOOTLOADER
+ if ((temp_mod | temp_osm) & MOD_MASK_SHIFT)
+#endif
+ {
+ send_string_with_delay_P(PSTR(" flash "), TAP_CODE_DELAY);
+#ifndef MAKE_BOOTLOADER
+ } else {
+ send_string_with_delay_P(PSTR(" compile "), TAP_CODE_DELAY);
+#endif
+ }
+ send_string_with_delay_P(PSTR("-kb " QMK_KEYBOARD " -km " QMK_KEYMAP), TAP_CODE_DELAY);
#ifdef RGB_MATRIX_SPLIT_RIGHT
- send_string_with_delay_P(PSTR(" RGB_MATRIX_SPLIT_RIGHT=yes"), TAP_CODE_DELAY);
+ send_string_with_delay_P(PSTR(" RGB_MATRIX_SPLIT_RIGHT=yes"), TAP_CODE_DELAY);
# ifndef OLED_DRIVER_ENABLE
- send_string_with_delay_P(PSTR(" OLED_DRIVER_ENABLE=no"), TAP_CODE_DELAY);
+ send_string_with_delay_P(PSTR(" OLED_DRIVER_ENABLE=no"), TAP_CODE_DELAY);
# endif
#endif
- send_string_with_delay_P(PSTR(SS_TAP(X_ENTER)), TAP_CODE_DELAY);
- }
+ send_string_with_delay_P(PSTR(SS_TAP(X_ENTER)), TAP_CODE_DELAY);
+ }
- break;
+ break;
- case VRSN: // Prints firmware version
- if (record->event.pressed) {
- send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE), TAP_CODE_DELAY);
- }
- break;
+ case VRSN: // Prints firmware version
+ if (record->event.pressed) {
+ send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE), TAP_CODE_DELAY);
+ }
+ break;
- case KC_DIABLO_CLEAR: // reset all Diablo timers, disabling them
+ case KC_DIABLO_CLEAR: // reset all Diablo timers, disabling them
#ifdef TAP_DANCE_ENABLE
- if (record->event.pressed) {
- for (uint8_t index = 0; index < 4; index++) {
- diablo_timer[index].key_interval = 0;
+ if (record->event.pressed) {
+ for (uint8_t index = 0; index < 4; index++) {
+ diablo_timer[index].key_interval = 0;
+ }
}
- }
#endif // TAP_DANCE_ENABLE
- break;
+ break;
- case KC_CCCV: // One key copy/paste
- if (record->event.pressed) {
- copy_paste_timer = timer_read();
- } else {
- if (timer_elapsed(copy_paste_timer) > TAPPING_TERM) { // Hold, copy
- tap_code16(LCTL(KC_C));
- } else { // Tap, paste
- tap_code16(LCTL(KC_V));
+ case KC_CCCV: // One key copy/paste
+ if (record->event.pressed) {
+ copy_paste_timer = timer_read();
+ } else {
+ if (timer_elapsed(copy_paste_timer) > TAPPING_TERM) { // Hold, copy
+ tap_code16(LCTL(KC_C));
+ } else { // Tap, paste
+ tap_code16(LCTL(KC_V));
+ }
}
- }
- break;
+ break;
#ifdef UNICODE_ENABLE
- case UC_FLIP: // (ノಠ痊ಠ)ノ彡┻━┻
- if (record->event.pressed) {
- send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B");
- }
- break;
- case UC_TABL: // ┬─┬ノ( º _ ºノ)
- if (record->event.pressed) {
- send_unicode_hex_string("252C 2500 252C 30CE 0028 0020 00BA 0020 005F 0020 00BA 30CE 0029");
- }
- break;
- case UC_SHRG: // ¯\_(ツ)_/¯
- if (record->event.pressed) {
- send_unicode_hex_string("00AF 005C 005F 0028 30C4 0029 005F 002F 00AF");
- }
- break;
- case UC_DISA: // ಠ_ಠ
- if (record->event.pressed) {
- send_unicode_hex_string("0CA0 005F 0CA0");
- }
- break;
+ case UC_FLIP: // (ノಠ痊ಠ)ノ彡┻━┻
+ if (record->event.pressed) {
+ send_unicode_string("(ノಠ痊ಠ)ノ彡┻━┻");
+ }
+ break;
+ case UC_TABL: // ┬─┬ノ( º _ ºノ)
+ if (record->event.pressed) {
+ send_unicode_string("┬─┬ノ( º _ ºノ)");
+ }
+ break;
+ case UC_SHRG: // ¯\_(ツ)_/¯
+ if (record->event.pressed) {
+ send_unicode_string("¯\\_(ツ)_/¯");
+ }
+ break;
+ case UC_DISA: // ಠ_ಠ
+ if (record->event.pressed) {
+ send_unicode_string("ಠ_ಠ");
+ }
+ break;
#endif
- }
- return process_record_keymap(keycode, record) &&
+ case KC_RGB_T: // This allows me to use underglow as layer indication, or as normal
#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
- process_record_user_rgb(keycode, record) &&
+ if (record->event.pressed) {
+ userspace_config.rgb_layer_change ^= 1;
+ dprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change);
+ eeconfig_update_user(userspace_config.raw);
+ if (userspace_config.rgb_layer_change) {
+# if defined(RGBLIGHT_ENABLE) && defined(RGB_MATRIX_ENABLE)
+ rgblight_enable_noeeprom();
+# endif
+ layer_state_set(layer_state); // This is needed to immediately set the layer color (looks better)
+# if defined(RGBLIGHT_ENABLE) && defined(RGB_MATRIX_ENABLE)
+ } else {
+ rgblight_disable_noeeprom();
+# endif
+ }
+ }
#endif // RGBLIGHT_ENABLE
- process_record_secrets(keycode, record);
+ break;
+
+#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
+ case RGB_TOG:
+ // Split keyboards need to trigger on key-up for edge-case issue
+# ifndef SPLIT_KEYBOARD
+ if (record->event.pressed) {
+# else
+ if (!record->event.pressed) {
+# endif
+# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
+ rgblight_toggle();
+# endif
+# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES)
+ rgb_matrix_toggle();
+# endif
+ }
+ return false;
+ break;
+ case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions
+ if (record->event.pressed) {
+ bool is_eeprom_updated;
+# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
+ // This disables layer indication, as it's assumed that if you're changing this ... you want that disabled
+ if (userspace_config.rgb_layer_change) {
+ userspace_config.rgb_layer_change = false;
+ dprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change);
+ is_eeprom_updated = true;
+ }
+# endif
+# if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS)
+ if (userspace_config.rgb_matrix_idle_anim) {
+ userspace_config.rgb_matrix_idle_anim = false;
+ dprintf("RGB Matrix Idle Animation [EEPROM]: %u\n", userspace_config.rgb_matrix_idle_anim);
+ is_eeprom_updated = true;
+ }
+# endif
+ if (is_eeprom_updated) {
+ eeconfig_update_user(userspace_config.raw);
+ }
+ }
+
+# if defined(RGBLIGHT_DISABLE_KEYCODES) || defined(RGB_MATRIX_DISABLE_KEYCODES)
+ if (keycode == RGB_MODE_FORWARD && record->event.pressed) {
+ uint8_t shifted = get_mods() & (MOD_MASK_SHIFT);
+ if (shifted) {
+# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
+ rgblight_step_reverse();
+# endif
+# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES)
+ rgb_matrix_step_reverse();
+# endif
+ } else {
+# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
+ rgblight_step();
+# endif
+# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES)
+ rgb_matrix_step();
+# endif
+ }
+ } else if (keycode == RGB_MODE_REVERSE && record->event.pressed) {
+ uint8_t shifted = get_mods() & (MOD_MASK_SHIFT);
+ if (shifted) {
+# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
+ rgblight_step();
+# endif
+# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES)
+ rgb_matrix_step();
+# endif
+ } else {
+# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
+ rgblight_step_reverse();
+# endif
+# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES)
+ rgb_matrix_step_reverse();
+# endif
+ }
+ } else if (keycode == RGB_HUI) {
+# ifndef SPLIT_KEYBOARD
+ if (record->event.pressed) {
+# else
+ if (!record->event.pressed) {
+# endif
+# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
+ rgblight_increase_hue();
+# endif
+# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES)
+ rgb_matrix_increase_hue();
+# endif
+ }
+ } else if (keycode == RGB_HUD) {
+# ifndef SPLIT_KEYBOARD
+ if (record->event.pressed) {
+# else
+ if (!record->event.pressed) {
+# endif
+# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
+ rgblight_decrease_hue();
+# endif
+# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES)
+ rgb_matrix_decrease_hue();
+# endif
+ }
+ } else if (keycode == RGB_SAI) {
+# ifndef SPLIT_KEYBOARD
+ if (record->event.pressed) {
+# else
+ if (!record->event.pressed) {
+# endif
+# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
+ rgblight_increase_sat();
+# endif
+# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES)
+ rgb_matrix_increase_sat();
+# endif
+ }
+ } else if (keycode == RGB_SAD) {
+# ifndef SPLIT_KEYBOARD
+ if (record->event.pressed) {
+# else
+ if (!record->event.pressed) {
+# endif
+# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
+ rgblight_decrease_sat();
+# endif
+# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES)
+ rgb_matrix_decrease_sat();
+# endif
+ }
+ } else if (keycode == RGB_VAI) {
+# ifndef SPLIT_KEYBOARD
+ if (record->event.pressed) {
+# else
+ if (!record->event.pressed) {
+# endif
+# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
+ rgblight_increase_val();
+# endif
+# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES)
+ rgb_matrix_increase_val();
+# endif
+ }
+ } else if (keycode == RGB_VAD) {
+# ifndef SPLIT_KEYBOARD
+ if (record->event.pressed) {
+# else
+ if (!record->event.pressed) {
+# endif
+# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
+ rgblight_decrease_val();
+# endif
+# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_KEYCODES)
+ rgb_matrix_decrease_val();
+# endif
+ }
+ } else if (keycode == RGB_SPI) {
+ if (record->event.pressed) {
+# if defined(RGBLIGHT_ENABLE) && !defined(RGBLIGHT_DISABLE_KEYCODES)
+ rgblight_increase_speed();
+# endif
+# if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_D