diff options
author | Drashna Jaelre <drashna@live.com> | 2021-09-29 11:16:11 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-29 11:16:11 -0700 |
commit | 1e54796f0cf469e2c1fdd880cc288b04e7b83985 (patch) | |
tree | bdcc76205faf3e7ec325fd73d36e932cdc0441da /users/drashna | |
parent | 929d959ef9e2572b4744930d86e322936e6e1f0e (diff) |
[Keymap] Update to Drashna Code (#14644)
Diffstat (limited to 'users/drashna')
-rw-r--r-- | users/drashna/drashna.c | 11 | ||||
-rw-r--r-- | users/drashna/oled_stuff.c | 20 | ||||
-rw-r--r-- | users/drashna/rules.mk | 16 | ||||
-rw-r--r-- | users/drashna/transport_sync.c | 33 | ||||
-rw-r--r-- | users/drashna/transport_sync.h | 10 |
5 files changed, 43 insertions, 47 deletions
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); |