summaryrefslogtreecommitdiff
path: root/users/drashna
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2021-08-21 13:34:44 -0700
committerGitHub <noreply@github.com>2021-08-21 13:34:44 -0700
commit58a5030661b57f1dd05693053df2eddadc285f64 (patch)
tree025a7a2d0dc6643ce806b72798c92139eafb4ca6 /users/drashna
parentda1c011afc67dab0049b30a4c021dc38a36cb9aa (diff)
[Keymap] Drashna's Improve OLEDs and custom Split code (#14063)
* Fill the oleds with right mods * Enable double mods on x32 oleds * Disable forced NKRO * Make oleds fancy only on good MCUs * Overhaul oled display * Further enhance oled, with kitty! * Final oled form * Not working transport * Transport id of woring * Add acceleration * fix button placement for accel macro * Fix accelartion location and behavior * Remove OLED sync code * Fix alignment issue * Remove audio hack * Fix up zima keymap * Add matrix slave scan function and cleanup drashna.h * Clean up user space * Allow userspace sync to be disable-able * Fix weird issue with audio * Fix alignment issue with user split sync * Disable second rgb matrix task * Disable additional animations * Change dynamic keymap settings * Hacky fix for borked corne * Add Blackpill (F411) support to tractyl manuform * remove manual via eeprom reset * Remove all references to rgblight twinkle * Fix issues with config processing
Diffstat (limited to 'users/drashna')
-rw-r--r--users/drashna/config.h57
-rw-r--r--users/drashna/drashna.c95
-rw-r--r--users/drashna/drashna.h7
-rw-r--r--users/drashna/oled_stuff.c101
-rw-r--r--users/drashna/oled_stuff.h13
-rw-r--r--users/drashna/post_config.h40
-rw-r--r--users/drashna/process_records.c12
-rw-r--r--users/drashna/process_records.h1
-rw-r--r--users/drashna/rgb_matrix_stuff.c5
-rw-r--r--users/drashna/rgb_stuff.c135
-rw-r--r--users/drashna/rgb_stuff.h13
-rw-r--r--users/drashna/rules.mk11
-rw-r--r--users/drashna/transport_sync.c122
13 files changed, 303 insertions, 309 deletions
diff --git a/users/drashna/config.h b/users/drashna/config.h
index ab0080234d..c8007a61b8 100644
--- a/users/drashna/config.h
+++ b/users/drashna/config.h
@@ -30,8 +30,15 @@
# ifdef WPM_ENABLE
# define SPLIT_WPM_ENABLE
# endif
-# define SELECT_SOFT_SERIAL_SPEED 1
-# define SPLIT_TRANSACTION_IDS_USER RPC_ID_USER_STATE_SYNC, RPC_ID_USER_KEYMAP_SYNC, RPC_ID_USER_CONFIG_SYNC
+# ifdef OLED_DRIVER_ENABLE
+# define SPLIT_OLED_ENABLE
+# endif
+# if defined(__AVR__) && !defined(SELECT_SOFT_SERIAL_SPEED)
+# define SELECT_SOFT_SERIAL_SPEED 1
+# endif
+# ifdef CUSTOM_SPLIT_TRANSPORT_SYNC
+# define SPLIT_TRANSACTION_IDS_USER RPC_ID_USER_STATE_SYNC, RPC_ID_USER_KEYMAP_SYNC, RPC_ID_USER_CONFIG_SYNC
+# endif
#endif
#ifdef AUDIO_ENABLE
@@ -65,23 +72,6 @@
#ifdef RGBLIGHT_ENABLE
# define RGBLIGHT_SLEEP
-# undef RGBLIGHT_ANIMATIONS
-# if defined(__AVR__) && !defined(__AVR_AT90USB1286__)
-# define RGBLIGHT_EFFECT_BREATHING
-# define RGBLIGHT_EFFECT_SNAKE
-# define RGBLIGHT_EFFECT_KNIGHT
-# else
-# define RGBLIGHT_EFFECT_BREATHING
-# define RGBLIGHT_EFFECT_RAINBOW_MOOD
-# define RGBLIGHT_EFFECT_RAINBOW_SWIRL
-# define RGBLIGHT_EFFECT_SNAKE
-# define RGBLIGHT_EFFECT_KNIGHT
-// # define RGBLIGHT_EFFECT_CHRISTMAS
-// # define RGBLIGHT_EFFECT_STATIC_GRADIENT
-// # define RGBLIGHT_EFFECT_RGB_TEST
-// # define RGBLIGHT_EFFECT_ALTERNATING
-# define RGBLIGHT_EFFECT_TWINKLE
-# endif
# define RGBLIGHT_EFFECT_TWINKLE_LIFE 250
# define RGBLIGHT_EFFECT_TWINKLE_PROBABILITY 1 / 24
#endif // RGBLIGHT_ENABLE
@@ -107,8 +97,10 @@
# define DISABLE_RGB_MATRIX_CYCLE_ALL
# define DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
# define DISABLE_RGB_MATRIX_CYCLE_UP_DOWN
-// # define DISABLE_RGB_MATRIX_CYCLE_OUT_IN
+# if defined(SPLIT_KEYBOARD) || defined(KEYBOARD_ergodox_ez) || defined(KEYBOARD_moonlander)
+# define DISABLE_RGB_MATRIX_CYCLE_OUT_IN
// # define DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL
+# endif
# define DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
# define DISABLE_RGB_MATRIX_DUAL_BEACON
# define DISABLE_RGB_MATRIX_CYCLE_PINWHEEL
@@ -117,6 +109,12 @@
# define DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
# define DISABLE_RGB_MATRIX_RAINDROPS
# define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
+# define DISABLE_RGB_MATRIX_HUE_BREATHING
+# define DISABLE_RGB_MATRIX_HUE_PENDULUM
+# define DISABLE_RGB_MATRIX_HUE_WAVE
+# define DISABLE_RGB_MATRIX_PIXEL_RAIN
+# define DISABLE_RGB_MATRIX_PIXEL_FLOW
+# define DISABLE_RGB_MATRIX_PIXEL_FRACTAL
// # define DISABLE_RGB_MATRIX_TYPING_HEATMAP
# define DISABLE_RGB_MATRIX_DIGITAL_RAIN
# define DISABLE_RGB_MATRIX_SOLID_REACTIVE
@@ -132,7 +130,15 @@
# define DISABLE_RGB_MATRIX_SOLID_SPLASH
# define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH
# endif // AVR
-#endif // RGB_MATRIX_ENABLE
+# ifndef RGB_MATRIX_REST_MODE
+# if defined(SPLIT_KEYBOARD) || defined(KEYBOARD_ergodox_ez) || defined(KEYBOARD_moonlander)
+# define RGB_MATRIX_REST_MODE RGB_MATRIX_CYCLE_OUT_IN_DUAL
+# else
+# define RGB_MATRIX_REST_MODE RGB_MATRIX_CYCLE_OUT_IN
+# endif
+# endif
+# define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_REST_MODE
+#endif // RGB_MATRIX_ENABLE
#ifdef OLED_DRIVER_ENABLE
# ifdef SPLIT_KEYBOARD
@@ -182,8 +188,6 @@
# define TAPPING_TERM_PER_KEY
#endif
-#define FORCE_NKRO
-
#ifndef TAPPING_TOGGLE
# define TAPPING_TOGGLE 1
#endif
@@ -209,7 +213,12 @@
# undef LOCKING_RESYNC_ENABLE
#endif
-#define LAYER_STATE_16BIT
+#if !defined(LAYER_STATE_16BIT) && !defined(LAYER_STATE_8BIT) && !defined(LAYER_STATE_32BIT)
+# define LAYER_STATE_16BIT
+#endif
+#ifndef DYNAMIC_KEYMAP_LAYER_COUNT
+# define DYNAMIC_KEYMAP_LAYER_COUNT 11
+#endif
#ifdef CONVERT_TO_PROTON_C
// pins that are available but not present on Pro Micro
diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c
index 4cef5433d6..27b9b5bc99 100644
--- a/users/drashna/drashna.c
+++ b/users/drashna/drashna.c
@@ -50,8 +50,7 @@ bool mod_key_press(uint16_t code, uint16_t mod_code, bool pressed, uint16_t this
}
__attribute__((weak)) void keyboard_pre_init_keymap(void) {}
-
-void keyboard_pre_init_user(void) {
+void keyboard_pre_init_user(void) {
userspace_config.raw = eeconfig_read_user();
keyboard_pre_init_keymap();
}
@@ -59,12 +58,11 @@ void keyboard_pre_init_user(void) {
// This allows for a global, userspace functions, and continued
// customization of the keymap. Use _keymap instead of _user
// functions in the keymaps
-__attribute__((weak)) void matrix_init_keymap(void) {}
-__attribute__((weak)) void matrix_init_secret(void) {}
-
// Call user matrix init, set default RGB colors and then
// call the keymap's init function
-void matrix_init_user(void) {
+__attribute__((weak)) void matrix_init_keymap(void) {}
+__attribute__((weak)) void matrix_init_secret(void) {}
+void matrix_init_user(void) {
#if defined(BOOTLOADER_CATERINA) && defined(__AVR__)
DDRD &= ~(1 << 5);
PORTD &= ~(1 << 5);
@@ -75,11 +73,15 @@ void matrix_init_user(void) {
matrix_init_secret();
matrix_init_keymap();
+#if defined(AUDIO_ENABLE) && defined(SPLIT_KEYBOARD)
+ if (!is_keyboard_master()) {
+ stop_all_notes();
+ }
+#endif
}
__attribute__((weak)) void keyboard_post_init_keymap(void) {}
-
-void keyboard_post_init_user(void) {
+void keyboard_post_init_user(void) {
#if defined(RGBLIGHT_ENABLE)
keyboard_post_init_rgb_light();
#endif
@@ -92,13 +94,12 @@ void keyboard_post_init_user(void) {
keyboard_post_init_keymap();
}
-__attribute__((weak)) void shutdown_keymap(void) {}
-
#ifdef RGB_MATRIX_ENABLE
void rgb_matrix_update_pwm_buffers(void);
#endif
-void shutdown_user(void) {
+__attribute__((weak)) void shutdown_keymap(void) {}
+void shutdown_user(void) {
#ifdef RGBLIGHT_ENABLE
rgblight_enable_noeeprom();
rgblight_mode_noeeprom(1);
@@ -113,8 +114,7 @@ void shutdown_user(void) {
}
__attribute__((weak)) void suspend_power_down_keymap(void) {}
-
-void suspend_power_down_user(void) {
+void suspend_power_down_user(void) {
#ifdef OLED_DRIVER_ENABLE
oled_off();
#endif
@@ -122,8 +122,7 @@ void suspend_power_down_user(void) {
}
__attribute__((weak)) void suspend_wakeup_init_keymap(void) {}
-
-void suspend_wakeup_init_user(void) {
+void suspend_wakeup_init_user(void) {
if (layer_state_is(_GAMEPAD)) {
layer_off(_GAMEPAD);
}
@@ -133,13 +132,11 @@ void suspend_wakeup_init_user(void) {
suspend_wakeup_init_keymap();
}
-__attribute__((weak)) void matrix_scan_keymap(void) {}
-
-__attribute__((weak)) void matrix_scan_secret(void) {}
-
// No global matrix scan code, so just run keymap's matrix
// scan function
-void matrix_scan_user(void) {
+__attribute__((weak)) void matrix_scan_keymap(void) {}
+__attribute__((weak)) void matrix_scan_secret(void) {}
+void matrix_scan_user(void) {
static bool has_ran_yet;
if (!has_ran_yet) {
has_ran_yet = true;
@@ -166,11 +163,10 @@ void matrix_scan_user(void) {
float doom_song[][2] = SONG(E1M1_DOOM);
#endif
-__attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state) { return state; }
-
// on layer change, no matter where the change was initiated
// Then runs keymap's layer change check
-layer_state_t layer_state_set_user(layer_state_t state) {
+__attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state) { return state; }
+layer_state_t layer_state_set_user(layer_state_t state) {
if (!is_keyboard_master()) {
return state;
}
@@ -194,10 +190,9 @@ layer_state_t layer_state_set_user(layer_state_t state) {
return state;
}
-__attribute__((weak)) layer_state_t default_layer_state_set_keymap(layer_state_t state) { return state; }
-
// Runs state check and changes underglow color and animation
-layer_state_t default_layer_state_set_user(layer_state_t state) {
+__attribute__((weak)) layer_state_t default_layer_state_set_keymap(layer_state_t state) { return state; }
+layer_state_t default_layer_state_set_user(layer_state_t state) {
if (!is_keyboard_master()) {
return state;
}
@@ -212,22 +207,14 @@ layer_state_t default_layer_state_set_user(layer_state_t state) {
}
__attribute__((weak)) void led_set_keymap(uint8_t usb_led) {}
-
-// Any custom LED code goes here.
-// So far, I only have keyboard specific code,
-// So nothing goes here.
-void led_set_user(uint8_t usb_led) { led_set_keymap(usb_led); }
+void led_set_user(uint8_t usb_led) { led_set_keymap(usb_led); }
__attribute__((weak)) void eeconfig_init_keymap(void) {}
-
-void eeconfig_init_user(void) {
+void eeconfig_init_user(void) {
userspace_config.raw = 0;
userspace_config.rgb_layer_change = true;
eeconfig_update_user(userspace_config.raw);
eeconfig_init_keymap();
-#ifdef VIA_ENABLE
- via_eeprom_reset();
-#endif
keyboard_init();
}
@@ -237,3 +224,39 @@ bool hasAllBitsInMask(uint8_t value, uint8_t mask) {
return (value & mask) == mask;
}
+
+#ifdef SPLIT_KEYBOARD
+# if defined(AUDIO_ENABLE)
+bool delayed_tasks_run = false;
+# endif
+__attribute__((weak)) void matrix_slave_scan_keymap(void) {}
+void matrix_slave_scan_user(void) {
+# if defined(AUDIO_ENABLE)
+# if !defined(NO_MUSIC_MODE)
+ music_task();
+# endif
+ if (!is_keyboard_master()) {
+ static uint16_t delayed_task_timer = 0;
+ if (!delayed_tasks_run) {
+ if (!delayed_task_timer) {
+ delayed_task_timer = timer_read();
+ } else if (timer_elapsed(delayed_task_timer) > 300) {
+ audio_startup();
+ delayed_tasks_run = true;
+ }
+ }
+ }
+# endif
+# ifdef SEQUENCER_ENABLE
+ sequencer_task();
+# endif
+# ifdef LED_MATRIX_ENABLE
+ led_matrix_task();
+# endif
+# ifdef HAPTIC_ENABLE
+ haptic_task();
+# endif
+
+ matrix_slave_scan_keymap();
+}
+#endif
diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h
index ca849b0509..0ae5f779ae 100644
--- a/users/drashna/drashna.h
+++ b/users/drashna/drashna.h
@@ -94,6 +94,9 @@ layer_state_t default_layer_state_set_keymap(layer_state_t state);
void led_set_keymap(uint8_t usb_led);
void eeconfig_init_keymap(void);
bool hasAllBitsInMask(uint8_t value, uint8_t mask);
+#ifdef SPLIT_KEYBOARD
+void matrix_slave_scan_keymap(void);
+#endif
// clang-format off
typedef union {
@@ -126,7 +129,3 @@ We use custom codes here, so we can substitute the right stuff
# define KC_D3_3 KC_3
# define KC_D3_4 KC_4
#endif // TAP_DANCE_ENABLE
-
-#if defined(DRASHNA_CUSTOM_TRANSPORT) && defined(POINTING_DEVICE_ENABLE)
-void master_mouse_send(int8_t x, int8_t y);
-#endif
diff --git a/users/drashna/oled_stuff.c b/users/drashna/oled_stuff.c
index 103b1fc7a7..0d63c38fa4 100644
--- a/users/drashna/oled_stuff.c
+++ b/users/drashna/oled_stuff.c
@@ -18,7 +18,7 @@
#ifndef KEYLOGGER_LENGTH
// # ifdef OLED_DISPLAY_128X64
-# define KEYLOGGER_LENGTH ((int)(OLED_DISPLAY_HEIGHT / OLED_FONT_WIDTH))
+# define KEYLOGGER_LENGTH ((uint8_t)(OLED_DISPLAY_HEIGHT / OLED_FONT_WIDTH))
// # else
// # define KEYLOGGER_LENGTH (uint8_t *(OLED_DISPLAY_WIDTH / OLED_FONT_HEIGHT))
// # endif
@@ -160,17 +160,21 @@ void render_matrix_scan_rate(void) {
void render_mod_status(uint8_t modifiers) {
static const char PROGMEM mod_status[5][3] = {{0xE8, 0xE9, 0}, {0xE4, 0xE5, 0}, {0xE6, 0xE7, 0}, {0xEA, 0xEB, 0}, {0xEC, 0xED, 0}};
oled_write_P(PSTR(OLED_RENDER_MODS_NAME), false);
+#if defined(OLED_DISPLAY_128X64)
+ oled_write_P(mod_status[0], (modifiers & MOD_BIT(KC_LSHIFT)));
+ oled_write_P(mod_status[!keymap_config.swap_lctl_lgui ? 3 : 4], (modifiers & MOD_BIT(KC_LGUI)));
+ oled_write_P(mod_status[2], (modifiers & MOD_BIT(KC_LALT)));
+ oled_write_P(mod_status[1], (modifiers & MOD_BIT(KC_LCTL)));
+ oled_write_P(mod_status[1], (modifiers & MOD_BIT(KC_RCTL)));
+ oled_write_P(mod_status[2], (modifiers & MOD_BIT(KC_RALT)));
+ oled_write_P(mod_status[!keymap_config.swap_lctl_lgui ? 3 : 4], (modifiers & MOD_BIT(KC_RGUI)));
+ oled_write_P(mod_status[0], (modifiers & MOD_BIT(KC_RSHIFT)));
+#else
oled_write_P(mod_status[0], (modifiers & MOD_MASK_SHIFT));
oled_write_P(mod_status[!keymap_config.swap_lctl_lgui ? 3 : 4], (modifiers & MOD_MASK_GUI));
-#if !defined(OLED_DISPLAY_128X64)
oled_write_P(PSTR(" "), false);
-#endif
oled_write_P(mod_status[2], (modifiers & MOD_MASK_ALT));
oled_write_P(mod_status[1], (modifiers & MOD_MASK_CTRL));
-
- render_matrix_scan_rate();
-#if defined(OLED_DISPLAY_128X64)
- oled_advance_page(true);
#endif
}
@@ -279,7 +283,7 @@ void render_user_status(void) {
#endif
}
-__attribute__((weak)) void oled_driver_render_logo(void) {
+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,
@@ -289,75 +293,86 @@ __attribute__((weak)) void oled_driver_render_logo(void) {
oled_write_P(qmk_logo, false);
}
-void render_wpm(void) {
+void render_wpm(uint8_t padding) {
#ifdef WPM_ENABLE
uint8_t n = get_current_wpm();
-# ifdef OLED_DISPLAY_128X64
- char wpm_counter[4];
+ char wpm_counter[4];
wpm_counter[3] = '\0';
wpm_counter[2] = '0' + n % 10;
wpm_counter[1] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
wpm_counter[0] = n / 10 ? '0' + n / 10 : ' ';
-# else
- char wpm_counter[6];
- wpm_counter[5] = '\0';
- wpm_counter[4] = '0' + n % 10;
- wpm_counter[3] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
- wpm_counter[2] = n / 10 ? '0' + n / 10 : ' ';
- wpm_counter[1] = ' ';
- wpm_counter[0] = ' ';
-# endif
oled_write_P(PSTR(OLED_RENDER_WPM_COUNTER), false);
+ if (padding) {
+ for (uint8_t n = padding; n > 0; n--) {
+ oled_write_P(PSTR(" "), false);
+ }
+ }
oled_write(wpm_counter, false);
#endif
}
#if defined(KEYBOARD_handwired_tractyl_manuform_5x6_right)
-
-extern kb_runtime_config_t kb_state;
-void render_pointing_dpi_status(void) {
- char dpi_status[6];
- uint16_t n = kb_state.device_cpi;
- dpi_status[5] = '\0';
- dpi_status[4] = '0' + n % 10;
- dpi_status[3] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
+extern kb_config_data_t kb_config;
+void render_pointing_dpi_status(uint8_t padding) {
+ char dpi_status[5];
+ uint16_t n = kb_config.device_cpi;
+ dpi_status[4] = '\0';
+ dpi_status[3] = '0' + n % 10;
dpi_status[2] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
- dpi_status[1] = n / 10 ? '0' + n / 10 : ' ';
- dpi_status[0] = ' ';
- oled_write_P(PSTR(" DPI: "), false);
+ dpi_status[1] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
+ dpi_status[0] = n / 10 ? '0' + n / 10 : ' ';
+ oled_write_P(PSTR("DPI: "), false);
+ if (padding) {
+ for (uint8_t n = padding; n > 0; n--) {
+ oled_write_P(PSTR(" "), false);
+ }
+ }
oled_write(dpi_status, false);
}
#endif
-void render_status_secondary(void) {
+__attribute__((weak)) void oled_driver_render_logo_right(void) {
#if defined(OLED_DISPLAY_128X64)
oled_driver_render_logo();
-#endif
- /* Show Keyboard Layout */
render_default_layer_state();
- render_layer_state();
- render_mod_status(get_mods() | get_oneshot_mods());
-#if !defined(OLED_DISPLAY_128X64) && defined(WPM_ENABLE)
- render_wpm();
+ oled_set_cursor(0, 4);
+#else
+ render_default_layer_state();
#endif
- // render_keylock_status(host_keyboard_leds());
}
-void render_status_main(void) {
+__attribute__((weak)) void oled_driver_render_logo_left(void) {
#if defined(OLED_DISPLAY_128X64)
oled_driver_render_logo();
# ifdef DEBUG_MATRIX_SCAN_RATE
render_matrix_scan_rate();
# elif defined(WPM_ENABLE)
- render_wpm();
+ render_wpm(0);
# endif
+ oled_write_P(PSTR(" "), false);
# if defined(KEYBOARD_handwired_tractyl_manuform_5x6_right)
- render_pointing_dpi_status();
+ render_pointing_dpi_status(1);
# endif
- oled_write_P(PSTR("\n"), false);
+ oled_set_cursor(0, 4);
#else
render_default_layer_state();
#endif
+}
+
+void render_status_secondary(void) {
+ oled_driver_render_logo_right();
+ /* Show Keyboard Layout */
+ render_layer_state();
+ render_mod_status(get_mods() | get_oneshot_mods());
+#if !defined(OLED_DISPLAY_128X64) && defined(WPM_ENABLE)
+ render_wpm(2);
+#endif
+ // render_keylock_status(host_keyboard_leds());
+}
+
+void render_status_main(void) {
+ oled_driver_render_logo_left();
+
/* Show Keyboard Layout */
// render_keylock_status(host_keyboard_leds());
render_bootmagic_status();
diff --git a/users/drashna/oled_stuff.h b/users/drashna/oled_stuff.h
index bba3f39cbc..8795684d6a 100644
--- a/users/drashna/oled_stuff.h
+++ b/users/drashna/oled_stuff.h
@@ -23,6 +23,19 @@ void oled_driver_render_logo(void);
bool process_record_user_oled(uint16_t keycode, keyrecord_t *record);
oled_rotation_t oled_init_keymap(oled_rotation_t rotation);
extern uint32_t oled_timer;
+void render_keylogger_status(void);
+void render_default_layer_state(void);
+void render_layer_state(void);
+void render_keylock_status(uint8_t led_usb_state);
+void render_matrix_scan_rate(void);
+void render_mod_status(uint8_t modifiers);
+void render_bootmagic_status(void);
+void render_user_status(void);
+void oled_driver_render_logo(void);
+void render_wpm(uint8_t padding);
+void render_pointing_dpi_status(uint8_t padding);
+void oled_driver_render_logo_left(void);
+void oled_driver_render_logo_right(void);
#ifdef OLED_DISPLAY_128X64
# define OLED_RENDER_KEYLOGGER "Keylogger: "
diff --git a/users/drashna/post_config.h b/users/drashna/post_config.h
new file mode 100644
index 0000000000..7c214b66d0
--- /dev/null
+++ b/users/drashna/post_config.h
@@ -0,0 +1,40 @@
+/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+// because layouts seem to not be respecting config.h order atm
+#ifdef RGBLIGHT_ENABLE
+# undef RGBLIGHT_ANIMATIONS
+# if defined(__AVR__) && (!defined(__AVR_AT90USB1286__) && !defined(RGBLIGHT_ALL_ANIMATIONS))
+# define RGBLIGHT_EFFECT_BREATHING
+# define RGBLIGHT_EFFECT_SNAKE
+# define RGBLIGHT_EFFECT_KNIGHT
+# else
+# define RGBLIGHT_EFFECT_BREATHING
+# define RGBLIGHT_EFFECT_RAINBOW_MOOD
+# define RGBLIGHT_EFFECT_RAINBOW_SWIRL
+# define RGBLIGHT_EFFECT_SNAKE
+# define RGBLIGHT_EFFECT_KNIGHT
+# if defined(RGBLIGHT_ALL_ANIMATIONS)
+# define RGBLIGHT_EFFECT_CHRISTMAS
+# define RGBLIGHT_EFFECT_STATIC_GRADIENT
+# define RGBLIGHT_EFFECT_RGB_TEST
+# define RGBLIGHT_EFFECT_ALTERNATING
+# endif
+# define RGBLIGHT_EFFECT_TWINKLE
+# endif
+#endif
diff --git a/users/drashna/process_records.c b/users/drashna/process_records.c
index 1e6ecc1d6c..f5e6a867ae 100644
--- a/users/drashna/process_records.c
+++ b/users/drashna/process_records.c
@@ -19,13 +19,12 @@
uint16_t copy_paste_timer;
-__attribute__((weak)) 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; }
-
// Defines actions tor my global custom keycodes. Defined in drashna.h file
// Then runs the _keymap's record handier if not processed here
-bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+
+__attribute__((weak)) 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; }
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
// If console is enabled, it will print the matrix position and status of each key pressed
#ifdef KEYLOGGER_ENABLE
uprintf("KL: kc: 0x%04X, col: %2u, row: %2u, pressed: %b, time: %5u, int: %b, count: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed, record->event.time, record->tap.interrupted, record->tap.count);
@@ -203,3 +202,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return true;
}
+
+__attribute__((weak)) void post_process_record_keymap(uint16_t keycode, keyrecord_t *record) {}
+void post_process_record_user(uint16_t keycode, keyrecord_t *record) { post_process_record_keymap(keycode, record); }
diff --git a/users/drashna/process_records.h b/users/drashna/process_records.h
index 460d41d4df..231480ac59 100644
--- a/users/drashna/process_records.h
+++ b/users/drashna/process_records.h
@@ -51,6 +51,7 @@ enum userspace_custom_keycodes {
bool process_record_secrets(uint16_t keycode, keyrecord_t *record);
bool process_record_keymap(uint16_t keycode, keyrecord_t *record);
+void post_process_record_keymap(uint16_t keycode, keyrecord_t *record);
#define LOWER MO(_LOWER)
#define RAISE MO(_RAISE)
diff --git a/users/drashna/rgb_matrix_stuff.c b/users/drashna/rgb_matrix_stuff.c
index 5adbd8ab1b..97811092c1 100644
--- a/users/drashna/rgb_matrix_stuff.c
+++ b/users/drashna/rgb_matrix_stuff.c
@@ -20,11 +20,6 @@
extern led_config_t g_led_config;
static uint32_t hypno_timer;
-#if defined(SPLIT_KEYBOARD) || defined(KEYBOARD_ergodox_ez) || defined(KEYBOARD_crkbd)
-# define RGB_MATRIX_REST_MODE RGB_MATRIX_CYCLE_OUT_IN_DUAL
-#else
-# define RGB_MATRIX_REST_MODE RGB_MATRIX_CYCLE_OUT_IN
-#endif
void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode, uint8_t speed, uint8_t led_type, uint8_t led_min, uint8_t led_max) {
HSV hsv = {hue, sat, val};
diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c
index 8a0866539e..15108bde04 100644
--- a/users/drashna/rgb_stuff.c
+++ b/users/drashna/rgb_stuff.c
@@ -23,106 +23,19 @@
bool has_initialized;
void rgblight_sethsv_default_helper(uint8_t index) { rgblight_sethsv_at(rgblight_get_hue(), rgblight_get_sat(), rgblight_get_val(), index); }
-
-# ifdef RGBLIGHT_TWINKLE
-static rgblight_fadeout lights[RGBLED_NUM];
-
-/* Handler for fading/twinkling effect */
-void scan_rgblight_fadeout(void) { // Don't effing change this function .... rgblight_sethsv is supppppper intensive
- bool litup = false;
-
- for (uint8_t light_index = 0; light_index < RGBLED_NUM; ++light_index) {
- if (lights[light_index].enabled && sync_timer_elapsed(lights[light_index].timer) > 10) {
- rgblight_fadeout *light = &lights[light_index];
- litup = true;
-
- if (light->life) {
- light->life -= 1;
- if (get_highest_layer(layer_state) == 0) {
- sethsv(light->hue + rand() % 0xF, 255, light->life, (LED_TYPE *)&led[light_index]);
- }
- light->timer = sync_timer_read();
- } else {
- if (light->enabled && get_highest_layer(layer_state) == 0) {
- rgblight_sethsv_default_helper(light_index);
- }
- litup = light->enabled = false;
- }
- }
- }
- if (litup && get_highest_layer(layer_state) == 0) {
- rgblight_set();
- }
-}
-
-/* Triggers a LED to fade/twinkle.
- * This function handles the selection of the LED and prepres for it to be used.
- */
-void start_rgb_light(void) {
- uint8_t indices[RGBLED_NUM];
- uint8_t indices_count = 0;
- uint8_t min_life = 0xFF;
- uint8_t min_life_index = -1;
-
- for (uint8_t index = 0; index < RGBLED_NUM; ++index) {
- if (lights[index].enabled) {
- if (min_life_index == -1 || lights[index].life < min_life) {
- min_life = lights[index].life;
- min_life_index = index;
- }
- continue;
- }
-
- indices[indices_count] = index;
- ++indices_count;
- }
-
- uint8_t light_index;
- if (!indices_count) {
- light_index = min_life_index;
- } else {
- light_index = indices[rand() % indices_count];
- }
-
- rgblight_fadeout *light = &lights[light_index];
- light->enabled = true;
- light->timer = sync_timer_read();
- light->life = 0xC0 + rand() % 0x40;
-
- light->hue = rgblight_get_hue() + (rand() % 0xB4) - 0x54;
-
- rgblight_sethsv_at(light->hue, 255, light->life, light_index);
+void rgblight_set_hsv_and_mode(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode) {
+ rgblight_sethsv_noeeprom(hue, sat, val);
+ // wait_us(175); // Add a slight delay between color and mode to ensure it's processed correctly
+ rgblight_mode_noeeprom(mode);
}
-# endif
-
-bool process_record_user_rgb_light(uint16_t keycode, keyrecord_t *record) {
- uint16_t temp_keycode = keycode;
- // Filter out the actual keycode from MT and LT keys.
- if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) || (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)) {
- temp_keycode &= 0xFF;
- }
- switch (temp_keycode) {
-# ifdef RGBLIGHT_TWINKLE
- case KC_A ... KC_SLASH:
- case KC_F1 ... KC_F12:
- case KC_INSERT ... KC_UP:
- case KC_KP_SLASH ... KC_KP_DOT:
- case KC_F13 ... KC_F24:
- case KC_AUDIO_MUTE ... KC_MEDIA_REWIND:
- if (record->event.pressed) {
- start_rgb_light();
- }
- break;
-# endif // RGBLIGHT_TWINKLE
- }
- return true;
-}
+bool process_record_user_rgb_light(uint16_t keycode, keyrecord_t *record) { return true; }
# if defined(RGBLIGHT_STARTUP_ANIMATION)
static bool is_enabled;
static bool is_rgblight_startup;
-static uint8_t old_hue;
+static HSV old_hsv;
+static uint8_t old_mode;
static uint16_t rgblight_startup_loop_timer;
# endif
@@ -130,37 +43,35 @@ void keyboard_post_init_rgb_light(void) {
# if defined(RGBLIGHT_STARTUP_ANIMATION)
is_enabled = rgblight_is_enabled();
if (userspace_config.rgb_layer_change) {
- rgblight_enable_noeeprom();
- }
- if (rgblight_is_enabled()) {
layer_state_set_rgb_light(layer_state);
- old_hue = rgblight_get_hue();
- rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
- is_rgblight_startup = true;
}
+ old_hsv = rgblight_get_hsv();
+ old_mode = rgblight_get_mode();
+ rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
+ is_rgblight_startup = true;
# endif
- layer_state_set_rgb_light(layer_state);
+ if (userspace_config.rgb_layer_change) {
+ layer_state_set_rgb_light(layer_state);
+ }
}
void matrix_scan_rgb_light(void) {
-# ifdef RGBLIGHT_TWINKLE
- scan_rgblight_fadeout();
-# endif // RGBLIGHT_ENABLE
-
# if defined(RGBLIGHT_STARTUP_ANIMATION)
if (is_rgblight_startup && is_keyboard_master()) {
if (sync_timer_elapsed(rgblight_startup_loop_timer) > 10) {
static uint8_t counter;
counter++;
- rgblight_sethsv_noeeprom((counter + old_hue) % 255, 255, 255);
+ rgblight_sethsv_noeeprom((counter + old_hsv.h) % 255, 255, 255);
rgblight_startup_loop_timer = sync_timer_read();
if (counter == 255) {
is_rgblight_startup = false;
- if (!is_enabled) {
- rgblight_disable_noeeprom();
- }
if (userspace_config.rgb_layer_change) {
layer_state_set_rgb_light(layer_state);
+ } else {
+ rgblight_set_hsv_and_mode(old_hsv.h, old_hsv.s, old_hsv.v, old_mode);
+ }
+ if (!is_enabled) {
+ rgblight_disable_noeeprom();
}
}
}
@@ -168,12 +79,6 @@ void matrix_scan_rgb_light(void) {
# endif
}
-void rgblight_set_hsv_and_mode(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode) {
- rgblight_sethsv_noeeprom(hue, sat, val);
- // wait_us(175); // Add a slight delay between color and mode to ensure it's processed correctly
- rgblight_mode_noeeprom(mode);
-}
-
layer_state_t layer_state_set_rgb_light(layer_state_t state) {
# ifdef RGBLIGHT_ENABLE
if (userspace_config.rgb_layer_change) {
diff --git a/users/drashna/rgb_stuff.h b/users/drashna/rgb_stuff.h
index 0153adb543..af1acdde71 100644
--- a/users/drashna/rgb_stuff.h
+++ b/users/drashna/rgb_stuff.h
@@ -17,22 +17,9 @@
#pragma once
#include "quantum.h"
-#if defined(RGBLIGHT_TWINKLE)
-typedef struct {
- bool enabled;
- uint8_t hue;
- uint16_t timer;
- uint8_t life;
-} rgblight_fadeout;
-#endif
-
bool process_record_user_rgb_light(uint16_t keycode, keyrecord_t *record);
void keyboard_post_init_rgb_light(void);
void matrix_scan_rgb_light(void);
layer_state_t layer_state_set_rgb_light(layer_state_t state);
layer_state_t default_layer_state_set_rgb_light(layer_state_t state);
void rgblight_sethsv_default_helper(uint8_t index);
-
-#if defined(RGBLIGHT_TWINKLE)
-void scan_rgblight_fadeout(void);
-#endif
diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk
index b93ab1ee6c..02a75a7b74 100644
--- a/users/drashna/rules.mk
+++ b/users/drashna/rules.mk
@@ -29,9 +29,6 @@ CUSTOM_RGBLIGHT ?= yes
ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
ifeq ($(strip $(CUSTOM_RGBLIGHT)), yes)
SRC += rgb_stuff.c
- ifeq ($(strip $(RGBLIGHT_TWINKLE)), yes)
- OPT_DEFS += -DRGBLIGHT_TWINKLE
- endif
ifeq ($(strip $(RGBLIGHT_NOEEPROM)), yes)
OPT_DEFS += -DRGBLIGHT_NOEEPROM
endif
@@ -81,8 +78,12 @@ ifeq ($(strip $(PIMORONI_TRACKBALL_ENABLE)), yes)
QUANTUM_LIB_SRC += i2c_master.c
endif
-ifeq ($(strip $(SPLIT_KEYBOARD)), yes)
- QUANTUM_LIB_SRC += transport_sync.c
+CUSTOM_SPLIT_TRANSPORT_SYNC ?= yes
+ifeq ($(strip $(CUSTOM_SPLIT_TRANSPORT_SYNC)), yes)
+ ifeq ($(strip $(SPLIT_KEYBOARD)), yes)
+ QUANTUM_LIB_SRC += transport_sync.c
+ OPT_DEFS += -DCUSTOM_SPLIT_TRANSPORT_SYNC
+ endif
endif
# DEBUG_MATRIX_SCAN_RATE_ENABLE = api
diff --git a/users/drashna/transport_sync.c b/users/drashna/transport_sync.c
index c3ef2eff5b..fdd596c04c 100644
--- a/users/drashna/transport_sync.c
+++ b/users/drashna/transport_sync.c
@@ -1,30 +1,44 @@
-#ifdef SPLIT_TRANSACTION_IDS_USER
-# include "transport_sync.h"
-# include "transactions.h"
-# include <string.h>
-
-# ifdef UNICODE_ENABLE
+/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "transport_sync.h"
+#include "transactions.h"
+#include <string.h>
+
+#ifdef UNICODE_ENABLE
extern unicode_config_t unicode_config;
-# endif
-# ifdef AUDIO_ENABLE
-# include "audio.h"
-# endif
-# if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform)
+#endif
+#ifdef AUDIO_ENABLE
+# include "audio.h"
+extern bool delayed_tasks_run;
+#endif
+#if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform)
extern bool tap_toggling;
-# endif
-# ifdef SWAP_HANDS_ENABLE
+#endif
+#ifdef SWAP_HANDS_ENABLE
extern bool swap_hands;
-# endif
+#endif
extern userspace_config_t userspace_config;
-typedef struct {
- bool oled_on;
- bool audio_enable;
- bool audio_clicky_enable;
- bool tap_toggling;
- bool unicode_mode;
- bool swap_hands;
- uint8_t reserved :2;
+__attribute__((aligned(8))) typedef struct {
+ bool audio_enable;
+ bool audio_clicky_enable;
+ bool tap_toggling;
+ bool unicode_mode;
+ bool swap_hands;
} user_runtime_config_t;
uint16_t transport_keymap_config = 0;
@@ -57,58 +71,49 @@ void keyboard_post_init_transport_sync(void) {
void user_transport_update(void) {
if (is_keyboard_master()) {
-# ifdef OLED_DRIVER_ENABLE
- user_state.oled_on = is_oled_on();
-# endif
-
transport_keymap_config = keymap_config.raw;
transport_userspace_config = userspace_config.raw;
-# ifdef AUDIO_ENABLE
+#ifdef AUDIO_ENABLE
user_state.audio_enable = is_audio_on();
user_state.audio_clicky_enable = is_clicky_on();
-# endif
-# if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform)
+#endif
+#if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform)
user_state.tap_toggling = tap_toggling;
-# endif
-# ifdef SWAP_HANDS_ENABLE
+#endif
+#ifdef SWAP_HANDS_ENABLE
user_state.swap_hands = swap_hands;
-# endif
+#endif
} else {
-# ifdef OLED_DRIVER_ENABLE
- if (user_state.oled_on) {
- oled_on();
- } else {
- oled_off();
- }
-# endif
keymap_config.raw = transport_keymap_config;
userspace_config.raw = transport_userspace_config;
-# ifdef UNICODE_ENABLE
+#ifdef UNICODE_ENABLE
unicode_config.input_mode = user_state.unicode_mode;
-# endif
-# ifdef AUDIO_ENABLE
- if (user_state.audio_enable != is_audio_on()) {
- if (user_state.audio_enable) {
- audio_on();
- } else {
- audio_off();
+#endif
+#ifdef AUDIO_ENABLE
+ if (delayed_tasks_run) {
+ if (user_state.audio_enable != is_audio_on()) {
+ if (user_state.audio_enable) {
+ audio_on();
+ } else {
+ audio_off();
+ }
}
- }
- if (user_state.audio_clicky_enable != is_clicky_on()) {
- if (user_state.audio_clicky_enable) {
- clicky_on();
- } else {
- clicky_off();
+ if (user_state.audio_clicky_enable != is_clicky_on()) {
+ if (user_state.audio_clicky_enable) {
+ clicky_on();
+ } else {
+ clicky_off();
+ }
}
}
-# endif
-# if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform)
+#endif
+#if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform)
tap_toggling = user_state.tap_toggling;
-# endif
-# ifdef SWAP_HANDS_ENABLE
+#endif
+#ifdef SWAP_HANDS_ENABLE
swap_hands = user_state.swap_hands;
-# endif
+#endif
}
}
@@ -185,4 +190,3 @@ void housekeeping_task_user(void) {
// Data sync from master to slave
user_transport_sync();
}
-#endif