From 1e54796f0cf469e2c1fdd880cc288b04e7b83985 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Wed, 29 Sep 2021 11:16:11 -0700 Subject: [PATCH] [Keymap] Update to Drashna Code (#14644) --- .../community/split_3x6_3/drashna/keymap.c | 141 +++++++++++++++++- users/drashna/drashna.c | 11 +- users/drashna/oled_stuff.c | 20 ++- users/drashna/rules.mk | 16 +- users/drashna/transport_sync.c | 33 +--- users/drashna/transport_sync.h | 10 ++ 6 files changed, 180 insertions(+), 51 deletions(-) diff --git a/layouts/community/split_3x6_3/drashna/keymap.c b/layouts/community/split_3x6_3/drashna/keymap.c index 707dd3646b..a3145a4044 100644 --- a/layouts/community/split_3x6_3/drashna/keymap.c +++ b/layouts/community/split_3x6_3/drashna/keymap.c @@ -97,6 +97,143 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { #ifdef OLED_ENABLE oled_rotation_t oled_init_keymap(oled_rotation_t rotation) { return OLED_ROTATION_270; } + +# ifdef CONVERT_TO_PROTON_C +// WPM-responsive animation stuff here +# define SLEEP_FRAMES 2 +# define SLEEP_SPEED 10 // below this wpm value your animation will idle + +# define WAKE_FRAMES 2 // uncomment if >1 + +# define KAKI_FRAMES 3 +# define KAKI_SPEED 40 // above this wpm value typing animation to triggere + +# define RTOGI_FRAMES 2 +//#define LTOGI_FRAMES 2 + +//#define ANIM_FRAME_DURATION 500 // how long each frame lasts in ms +// #define SLEEP_TIMER 60000 // should sleep after this period of 0 wpm, needs fixing +# define ANIM_SIZE 512 // number of bytes in array, minimize for adequate firmware size, max is 1024 + +uint32_t anim_timer = 0; +uint32_t anim_frame_duration = 500; +uint8_t current_sleep_frame = 0; +uint8_t current_wake_frame = 0; // uncomment if WAKE_FRAMES >1 +uint8_t current_kaki_frame = 0; +uint8_t current_rtogi_frame = 0; +// uint8_t current_ltogi_frame = 0; +// clang-format off +void render_kitty(void) { + // Images credit j-inc(/James Incandenza) and pixelbenny. Credit to obosob for initial animation approach. + static const char PROGMEM sleep[SLEEP_FRAMES][ANIM_SIZE] = {{ + // 'sleep1', 32x32px + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0xa8, 0x48, 0xa8, 0x18, 0x08, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x80, 0x44, 0x84, 0x06, 0x05, 0x04, 0x80, 0x40, 0x20, 0x10, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x18, 0x04, 0x04, 0x02, 0x7a, 0x86, 0x01, 0x80, 0x80, 0x01, 0x03, 0x05, 0x07, 0x01, 0x00, 0x00, 0x80, 0x83, 0x45, 0xfa, 0x3c, 0xe0, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x33, 0x24, 0x28, 0x28, 0x29, 0x29, 0x29, 0x3a, 0x18, 0x1c, 0x39, 0x24, 0x24, 0x3a, 0x2d, 0x26, 0x31, 0x1f, 0x00, + }, + {// 'sleep2', 32x32px + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x22, 0x3a, 0x2a, 0x26, 0x22, 0x80, 0xc0, 0x80, 0x00, 0x24, 0x34, 0x2c, 0xe4, 0x60, 0x10, 0x70, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x38, 0x04, 0x02, 0x02, 0x01, 0x79, 0x87, 0x01, 0x80, 0x81, 0x83, 0x05, 0x05, 0x03, 0x01, 0x00, 0x00, 0x80, 0x43, 0x05, 0xfa, 0x3c, 0xe0, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x33, 0x24, 0x28, 0x28, 0x28, 0x29, 0x29, 0x3a, 0x18, 0x1c, 0x39, 0x24, 0x24, 0x3a, 0x2d, 0x26, 0x31, 0x1f, 0x00 + }}; + static const char PROGMEM wake[WAKE_FRAMES][ANIM_SIZE] = {{ + // 'mati2', 32x32px + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x30, 0x08, 0x10, 0x60, 0x80, 0x00, 0x80, 0x60, 0x10, 0x08, 0x30, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x80, 0x40, 0x40, 0x5c, 0x00, 0x01, 0x41, 0x01, 0x00, 0x5c, 0x40, 0x40, 0x80, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x40, 0x80, 0xe1, 0x12, 0x0a, 0x06, 0x00, 0x80, 0x00, 0x06, 0x0a, 0x12, 0xe1, 0x80, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x10, 0x10, 0x1f, 0x11, 0x10, 0x10, 0x14, 0x14, 0x1f, 0x1c, 0x14, 0x14, 0x14, 0x08 + }, + {// 'mati3', 32x32px + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x30, 0x08, 0x10, 0x60, 0x80, 0x00, 0x80, 0x60, 0x10, 0x08, 0x30, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x90, 0x12, 0x0a, 0x02, 0xf4, 0x09, 0x0d, 0xf1, 0x04, 0x02, 0x0a, 0x12, 0x90, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x40, 0x80, 0xe1, 0x12, 0x0a, 0x06, 0x01, 0x81, 0x00, 0x06, 0x0a, 0x12, 0xe1, 0x80, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x10, 0x10, 0x1f, 0x11, 0x10, 0x10, 0x14, 0x14, 0x1f, 0x1c, 0x14, 0x14, 0x14, 0x08 + }}; + static const char PROGMEM kaki[KAKI_FRAMES][ANIM_SIZE] = {{ + // 'jare2', 32x32px + 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x40, 0x40, 0x80, 0x80, 0x80, 0x00, 0xfc, 0x84, 0x08, 0x08, 0x10, 0x20, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x1e, 0x60, 0x80, 0x00, 0x00, 0x91, 0xa1, 0x80, 0x00, 0x00, 0x22, 0x84, 0x40, 0x50, 0x48, 0xc1, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x41, 0x82, 0xe2, 0x12, 0x0a, 0x06, 0x00, 0x80, 0x88, 0x4f, 0x02, 0x22, 0xe2, 0x9f, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x14, 0x10, 0x10, 0x10, 0x10, 0x10, 0x14, 0x14, 0x1f, 0x1a, 0x0a, 0x0a, 0x04, 0x00 + }, + { + // 'kaki1', 32x32px + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x06, 0x1a, 0x22, 0xc2, 0x04, 0x04, 0x04, 0x07, 0x00, 0xc0, 0x20, 0x10, 0x80, 0x80, 0x01, 0x01, 0x02, 0xfc, 0xfe, 0x02, 0x3c, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0d, 0x8d, 0x55, 0x50, 0x94, 0xf0, 0x10, 0x09, 0x08, 0x00, 0x80, 0x00, 0x06, 0x09, 0x1b, 0xee, 0x00, 0x00, 0x00, 0x00, 0x81, 0xfe, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x10, 0x10, 0x1f, 0x19, 0x18, 0x1c, 0x14, 0x16, 0x15, 0x14, 0x14, 0x14, 0x14, 0x08 + }, + {// 'kaki2', 32x32px + 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0f, 0xf0, 0x00, 0x01, 0x02, 0x04, 0x04, 0x03, 0x80, 0x40, 0x40, 0x20, 0x00, 0x01, 0x02, 0x8c, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0d, 0x8d, 0x55, 0x50, 0x94, 0xf0, 0x10, 0x0a, 0x0e, 0x1d, 0x95, 0x24, 0x24, 0x27, 0x13, 0xe1, 0x01, 0x01, 0x01, 0x01, 0x02, 0xfc, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x14, 0x14, 0x10, 0x10, 0x11, 0x1f, 0x10, 0x10, 0x18, 0x0f, 0x18, 0x10, 0x10, 0x1f, 0x19, 0x18, 0x1c, 0x14, 0x14, 0x17, 0x14, 0x14, 0x14, 0x14, 0x08, + }}; + static const char PROGMEM rtogi[KAKI_FRAMES][ANIM_SIZE] = {{ + // 'rtogi1', 32x32px + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x10, 0x10, 0x08, 0x04, 0x02, 0x01, 0x0f, 0x90, 0x10, 0x20, 0xf0, 0xf8, 0xf8, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x48, 0x47, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x88, 0xc7, 0xc4, 0x62, 0x23, 0x11, 0x3f, + 0x80, 0x40, 0x20, 0x10, 0x88, 0xcc, 0x43, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xc0, 0x80, 0x80, 0xc0, 0xe1, 0xfe, 0xb8, 0x88, 0x0c, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x06, 0x04, 0x04, 0x04, 0x04, 0x05, 0x04, 0x04, 0x04, 0x07, 0x07, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }, + {// 'rtogi2', 32x32px + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x10, 0x10, 0x08, 0x04, 0x02, 0x01, 0x1f, 0xa0, 0x20, 0x40, 0x80, 0x00, 0xf0, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x48, 0x47, 0x88, 0x00, 0x00, 0x00, 0x00, 0x24, 0x24, 0x28, 0x6b, 0x40, 0xa0, 0x99, 0x86, 0xff, + 0x0f, 0x11, 0x22, 0x44, 0x48, 0x4c, 0x43, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xc0, 0x80, 0x80, 0xc0, 0xe1, 0xfe, 0xb8, 0x88, 0x0c, 0x04, 0x06, 0x06, 0x06, 0x0e, 0x0e, 0x06, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x06, 0x04, 0x04, 0x04, 0x04, 0x05, 0x04, 0x04, 0x04, 0x07, 0x07, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }}; + + // assumes 1 frame prep stage + extern bool swap_hands; + void animation_phase(void) { + if (swap_hands) { + anim_frame_duration = 300; + current_rtogi_frame = (current_rtogi_frame + 1) % RTOGI_FRAMES; + oled_write_raw_P(rtogi[abs((RTOGI_FRAMES - 1) - current_rtogi_frame)], ANIM_SIZE); + } else { + if (get_current_wpm() <= SLEEP_SPEED) { + anim_frame_duration = 500; + current_sleep_frame = (current_sleep_frame + 1) % SLEEP_FRAMES; + oled_write_raw_P(sleep[abs((SLEEP_FRAMES - 1) - current_sleep_frame)], ANIM_SIZE); + } + // if(get_current_wpm() >IDLE_SPEED && get_current_wpm() SLEEP_SPEED) { + anim_frame_duration = 800; + current_wake_frame = (current_wake_frame + 1) % WAKE_FRAMES; + oled_write_raw_P(wake[abs((WAKE_FRAMES - 1) - current_wake_frame)], ANIM_SIZE); + // oled_write_raw_P(wake[0], ANIM_SIZE); // remove if IDLE_FRAMES >1 + } + if (get_current_wpm() >= KAKI_SPEED) { + anim_frame_duration = 500; + current_kaki_frame = (current_kaki_frame + 1) % KAKI_FRAMES; + oled_write_raw_P(kaki[abs((KAKI_FRAMES - 1) - current_kaki_frame)], ANIM_SIZE); + } + } + } + if (get_current_wpm() != 000) { + // if(timer_elapsed32(anim_timer) > ANIM_FRAME_DURATION) { + if (timer_elapsed32(anim_timer) > anim_frame_duration) { + anim_timer = timer_read32(); + animation_phase(); + } + } else { + // if(timer_elapsed32(anim_timer) > ANIM_FRAME_DURATION) { + if (timer_elapsed32(anim_timer) > anim_frame_duration) { + anim_timer = timer_read32(); + animation_phase(); + } + } +} + +void oled_driver_render_logo_right(void) { + render_kitty(); + + oled_set_cursor(0, 4); + render_default_layer_state(); +} +# endif #endif #ifdef TAPPING_TERM_PER_KEY @@ -111,10 +248,6 @@ uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { #endif #ifdef RGB_MATRIX_ENABLE -void suspend_power_down_keymap(void) { rgb_matrix_set_suspend_state(true); } - -void suspend_wakeup_init_keymap(void) { rgb_matrix_set_suspend_state(false); } - void check_default_layer(uint8_t mode, uint8_t type, uint8_t led_min, uint8_t led_max) { switch (get_highest_layer(default_layer_state)) { case _QWERTY: diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index 3423e379a1..871136c137 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c @@ -73,11 +73,6 @@ 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) {} @@ -227,16 +222,15 @@ bool hasAllBitsInMask(uint8_t value, uint8_t 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 +# ifdef AUDIO_INIT_DELAY if (!is_keyboard_master()) { + static bool delayed_tasks_run = false; static uint16_t delayed_task_timer = 0; if (!delayed_tasks_run) { if (!delayed_task_timer) { @@ -247,6 +241,7 @@ void matrix_slave_scan_user(void) { } } } +# endif # endif # ifdef SEQUENCER_ENABLE sequencer_task(); diff --git a/users/drashna/oled_stuff.c b/users/drashna/oled_stuff.c index 0bdd0212be..7811cabc60 100644 --- a/users/drashna/oled_stuff.c +++ b/users/drashna/oled_stuff.c @@ -62,6 +62,9 @@ void add_keylog(uint16_t keycode, keyrecord_t *record) { return; } } + if (keycode > 0xFF) { + return; + } for (uint8_t i = 1; i < KEYLOGGER_LENGTH; i++) { keylog_str[i - 1] = keylog_str[i]; @@ -250,6 +253,17 @@ extern bool tap_toggling; #endif void render_user_status(void) { +#ifdef AUDIO_ENABLE + bool is_audio_on = false, is_clicky_on = false; +# ifdef SPLIT_KEYBOARD + + is_audio_on = user_state.audio_enable; + is_clicky_on = user_state.audio_clicky_enable; +# else + is_audio_on = is_audio_on(); + is_clicky_on = is_clicky_on(); +# endif +#endif oled_write_P(PSTR(OLED_RENDER_USER_NAME), false); #if !defined(OLED_DISPLAY_128X64) oled_write_P(PSTR(" "), false); @@ -265,11 +279,11 @@ void render_user_status(void) { #endif #ifdef AUDIO_ENABLE static const char PROGMEM audio_status[2][3] = {{0xE0, 0xE1, 0}, {0xE2, 0xE3, 0}}; - oled_write_P(audio_status[is_audio_on()], false); + oled_write_P(audio_status[is_audio_on], false); # ifdef AUDIO_CLICKY static const char PROGMEM audio_clicky_status[2][3] = {{0xF4, 0xF5, 0}, {0xF6, 0xF7, 0}}; - oled_write_P(audio_clicky_status[is_clicky_on() && is_audio_on()], false); + oled_write_P(audio_clicky_status[is_clicky_on && is_audio_on], false); # if !defined(OLED_DISPLAY_128X64) oled_write_P(PSTR(" "), false); # endif @@ -370,7 +384,7 @@ void render_status_secondary(void) { /* Show Keyboard Layout */ render_layer_state(); render_mod_status(get_mods() | get_oneshot_mods()); -#if !defined(OLED_DISPLAY_128X64) && defined(WPM_ENABLE) +#if !defined(OLED_DISPLAY_128X64) && defined(WPM_ENABLE) && !defined(CONVERT_TO_PROTON_C) render_wpm(2); #endif // render_keylock_status(host_keyboard_leds()); diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk index dbacae1d56..e9911979c7 100644 --- a/users/drashna/rules.mk +++ b/users/drashna/rules.mk @@ -1,5 +1,5 @@ -SRC += drashna.c \ - process_records.c +SRC += $(USER_PATH)/drashna.c \ + $(USER_PATH)/process_records.c ifneq ($(PLATFORM),CHIBIOS) ifneq ($(strip $(LTO_SUPPORTED)), no) @@ -11,7 +11,7 @@ GRAVE_ESC_ENABLE = no ifneq ($(strip $(NO_SECRETS)), yes) ifneq ("$(wildcard $(USER_PATH)/secrets.c)","") - SRC += secrets.c + SRC += $(USER_PATH)/secrets.c endif ifeq ($(strip $(NO_SECRETS)), lite) OPT_DEFS += -DNO_SECRETS @@ -21,14 +21,14 @@ endif CUSTOM_TAP_DANCE ?= yes ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) - SRC += tap_dances.c + SRC += $(USER_PATH)/tap_dances.c endif endif CUSTOM_RGBLIGHT ?= yes ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) ifeq ($(strip $(CUSTOM_RGBLIGHT)), yes) - SRC += rgb_stuff.c + SRC += $(USER_PATH)/rgb_stuff.c ifeq ($(strip $(RGBLIGHT_NOEEPROM)), yes) OPT_DEFS += -DRGBLIGHT_NOEEPROM endif @@ -41,7 +41,7 @@ endif CUSTOM_RGB_MATRIX ?= yes ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes) ifeq ($(strip $(CUSTOM_RGB_MATRIX)), yes) - SRC += rgb_matrix_stuff.c + SRC += $(USER_PATH)/rgb_matrix_stuff.c endif endif @@ -66,7 +66,7 @@ endif CUSTOM_OLED_DRIVER ?= yes ifeq ($(strip $(OLED_ENABLE)), yes) ifeq ($(strip $(CUSTOM_OLED_DRIVER)), yes) - SRC += oled_stuff.c + SRC += $(USER_PATH)/oled_stuff.c OPT_DEFS += -DCUSTOM_OLED_DRIVER_CODE endif endif @@ -81,7 +81,7 @@ endif CUSTOM_SPLIT_TRANSPORT_SYNC ?= yes ifeq ($(strip $(CUSTOM_SPLIT_TRANSPORT_SYNC)), yes) ifeq ($(strip $(SPLIT_KEYBOARD)), yes) - QUANTUM_LIB_SRC += transport_sync.c + QUANTUM_LIB_SRC += $(USER_PATH)/transport_sync.c OPT_DEFS += -DCUSTOM_SPLIT_TRANSPORT_SYNC endif endif diff --git a/users/drashna/transport_sync.c b/users/drashna/transport_sync.c index fdd596c04c..39db641354 100644 --- a/users/drashna/transport_sync.c +++ b/users/drashna/transport_sync.c @@ -23,7 +23,8 @@ extern unicode_config_t unicode_config; #endif #ifdef AUDIO_ENABLE # include "audio.h" -extern bool delayed_tasks_run; +extern audio_config_t audio_config; +extern bool delayed_tasks_run; #endif #if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform) extern bool tap_toggling; @@ -33,14 +34,6 @@ extern bool swap_hands; #endif extern userspace_config_t userspace_config; -__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; uint32_t transport_userspace_config = 0; @@ -80,34 +73,18 @@ void user_transport_update(void) { #if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform) user_state.tap_toggling = tap_toggling; #endif +#ifdef UNICODE_ENABLE + user_state.unicode_mode = unicode_config.input_mode; +#endif #ifdef SWAP_HANDS_ENABLE user_state.swap_hands = swap_hands; #endif - } else { keymap_config.raw = transport_keymap_config; userspace_config.raw = transport_userspace_config; #ifdef UNICODE_ENABLE unicode_config.input_mode = user_state.unicode_mode; #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(); - } - } - } -#endif #if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform) tap_toggling = user_state.tap_toggling; #endif diff --git a/users/drashna/transport_sync.h b/users/drashna/transport_sync.h index e2b3eae76b..062df2bacc 100644 --- a/users/drashna/transport_sync.h +++ b/users/drashna/transport_sync.h @@ -19,4 +19,14 @@ #include "drashna.h" +__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; + +extern user_runtime_config_t user_state; + void keyboard_post_init_transport_sync(void);