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) | |
| download | qmk_firmware-1e54796f0cf469e2c1fdd880cc288b04e7b83985.tar.gz qmk_firmware-1e54796f0cf469e2c1fdd880cc288b04e7b83985.zip | |
[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 3423e379a..871136c13 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c | |||
| @@ -73,11 +73,6 @@ void matrix_init_user(void) { | |||
| 73 | 73 | ||
| 74 | matrix_init_secret(); | 74 | matrix_init_secret(); |
| 75 | matrix_init_keymap(); | 75 | matrix_init_keymap(); |
| 76 | #if defined(AUDIO_ENABLE) && defined(SPLIT_KEYBOARD) | ||
| 77 | if (!is_keyboard_master()) { | ||
| 78 | stop_all_notes(); | ||
| 79 | } | ||
| 80 | #endif | ||
| 81 | } | 76 | } |
| 82 | 77 | ||
| 83 | __attribute__((weak)) void keyboard_post_init_keymap(void) {} | 78 | __attribute__((weak)) void keyboard_post_init_keymap(void) {} |
| @@ -227,16 +222,15 @@ bool hasAllBitsInMask(uint8_t value, uint8_t mask) { | |||
| 227 | } | 222 | } |
| 228 | 223 | ||
| 229 | #ifdef SPLIT_KEYBOARD | 224 | #ifdef SPLIT_KEYBOARD |
| 230 | # if defined(AUDIO_ENABLE) | ||
| 231 | bool delayed_tasks_run = false; | ||
| 232 | # endif | ||
| 233 | __attribute__((weak)) void matrix_slave_scan_keymap(void) {} | 225 | __attribute__((weak)) void matrix_slave_scan_keymap(void) {} |
| 234 | void matrix_slave_scan_user(void) { | 226 | void matrix_slave_scan_user(void) { |
| 235 | # if defined(AUDIO_ENABLE) | 227 | # if defined(AUDIO_ENABLE) |
| 236 | # if !defined(NO_MUSIC_MODE) | 228 | # if !defined(NO_MUSIC_MODE) |
| 237 | music_task(); | 229 | music_task(); |
| 238 | # endif | 230 | # endif |
| 231 | # ifdef AUDIO_INIT_DELAY | ||
| 239 | if (!is_keyboard_master()) { | 232 | if (!is_keyboard_master()) { |
| 233 | static bool delayed_tasks_run = false; | ||
| 240 | static uint16_t delayed_task_timer = 0; | 234 | static uint16_t delayed_task_timer = 0; |
| 241 | if (!delayed_tasks_run) { | 235 | if (!delayed_tasks_run) { |
| 242 | if (!delayed_task_timer) { | 236 | if (!delayed_task_timer) { |
| @@ -247,6 +241,7 @@ void matrix_slave_scan_user(void) { | |||
| 247 | } | 241 | } |
| 248 | } | 242 | } |
| 249 | } | 243 | } |
| 244 | # endif | ||
| 250 | # endif | 245 | # endif |
| 251 | # ifdef SEQUENCER_ENABLE | 246 | # ifdef SEQUENCER_ENABLE |
| 252 | sequencer_task(); | 247 | sequencer_task(); |
diff --git a/users/drashna/oled_stuff.c b/users/drashna/oled_stuff.c index 0bdd0212b..7811cabc6 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) { | |||
| 62 | return; | 62 | return; |
| 63 | } | 63 | } |
| 64 | } | 64 | } |
| 65 | if (keycode > 0xFF) { | ||
| 66 | return; | ||
| 67 | } | ||
| 65 | 68 | ||
| 66 | for (uint8_t i = 1; i < KEYLOGGER_LENGTH; i++) { | 69 | for (uint8_t i = 1; i < KEYLOGGER_LENGTH; i++) { |
| 67 | keylog_str[i - 1] = keylog_str[i]; | 70 | keylog_str[i - 1] = keylog_str[i]; |
| @@ -250,6 +253,17 @@ extern bool tap_toggling; | |||
| 250 | #endif | 253 | #endif |
| 251 | 254 | ||
| 252 | void render_user_status(void) { | 255 | void render_user_status(void) { |
| 256 | #ifdef AUDIO_ENABLE | ||
| 257 | bool is_audio_on = false, is_clicky_on = false; | ||
| 258 | # ifdef SPLIT_KEYBOARD | ||
| 259 | |||
| 260 | is_audio_on = user_state.audio_enable; | ||
| 261 | is_clicky_on = user_state.audio_clicky_enable; | ||
| 262 | # else | ||
| 263 | is_audio_on = is_audio_on(); | ||
| 264 | is_clicky_on = is_clicky_on(); | ||
| 265 | # endif | ||
| 266 | #endif | ||
| 253 | oled_write_P(PSTR(OLED_RENDER_USER_NAME), false); | 267 | oled_write_P(PSTR(OLED_RENDER_USER_NAME), false); |
| 254 | #if !defined(OLED_DISPLAY_128X64) | 268 | #if !defined(OLED_DISPLAY_128X64) |
| 255 | oled_write_P(PSTR(" "), false); | 269 | oled_write_P(PSTR(" "), false); |
| @@ -265,11 +279,11 @@ void render_user_status(void) { | |||
| 265 | #endif | 279 | #endif |
| 266 | #ifdef AUDIO_ENABLE | 280 | #ifdef AUDIO_ENABLE |
| 267 | static const char PROGMEM audio_status[2][3] = {{0xE0, 0xE1, 0}, {0xE2, 0xE3, 0}}; | 281 | static const char PROGMEM audio_status[2][3] = {{0xE0, 0xE1, 0}, {0xE2, 0xE3, 0}}; |
| 268 | oled_write_P(audio_status[is_audio_on()], false); | 282 | oled_write_P(audio_status[is_audio_on], false); |
| 269 | 283 | ||
| 270 | # ifdef AUDIO_CLICKY | 284 | # ifdef AUDIO_CLICKY |
| 271 | static const char PROGMEM audio_clicky_status[2][3] = {{0xF4, 0xF5, 0}, {0xF6, 0xF7, 0}}; | 285 | static const char PROGMEM audio_clicky_status[2][3] = {{0xF4, 0xF5, 0}, {0xF6, 0xF7, 0}}; |
| 272 | oled_write_P(audio_clicky_status[is_clicky_on() && is_audio_on()], false); | 286 | oled_write_P(audio_clicky_status[is_clicky_on && is_audio_on], false); |
| 273 | # if !defined(OLED_DISPLAY_128X64) | 287 | # if !defined(OLED_DISPLAY_128X64) |
| 274 | oled_write_P(PSTR(" "), false); | 288 | oled_write_P(PSTR(" "), false); |
| 275 | # endif | 289 | # endif |
| @@ -370,7 +384,7 @@ void render_status_secondary(void) { | |||
| 370 | /* Show Keyboard Layout */ | 384 | /* Show Keyboard Layout */ |
| 371 | render_layer_state(); | 385 | render_layer_state(); |
| 372 | render_mod_status(get_mods() | get_oneshot_mods()); | 386 | render_mod_status(get_mods() | get_oneshot_mods()); |
| 373 | #if !defined(OLED_DISPLAY_128X64) && defined(WPM_ENABLE) | 387 | #if !defined(OLED_DISPLAY_128X64) && defined(WPM_ENABLE) && !defined(CONVERT_TO_PROTON_C) |
| 374 | render_wpm(2); | 388 | render_wpm(2); |
| 375 | #endif | 389 | #endif |
| 376 | // render_keylock_status(host_keyboard_leds()); | 390 | // render_keylock_status(host_keyboard_leds()); |
diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk index dbacae1d5..e9911979c 100644 --- a/users/drashna/rules.mk +++ b/users/drashna/rules.mk | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | SRC += drashna.c \ | 1 | SRC += $(USER_PATH)/drashna.c \ |
| 2 | process_records.c | 2 | $(USER_PATH)/process_records.c |
| 3 | 3 | ||
| 4 | ifneq ($(PLATFORM),CHIBIOS) | 4 | ifneq ($(PLATFORM),CHIBIOS) |
| 5 | ifneq ($(strip $(LTO_SUPPORTED)), no) | 5 | ifneq ($(strip $(LTO_SUPPORTED)), no) |
| @@ -11,7 +11,7 @@ GRAVE_ESC_ENABLE = no | |||
| 11 | 11 | ||
| 12 | ifneq ($(strip $(NO_SECRETS)), yes) | 12 | ifneq ($(strip $(NO_SECRETS)), yes) |
| 13 | ifneq ("$(wildcard $(USER_PATH)/secrets.c)","") | 13 | ifneq ("$(wildcard $(USER_PATH)/secrets.c)","") |
| 14 | SRC += secrets.c | 14 | SRC += $(USER_PATH)/secrets.c |
| 15 | endif | 15 | endif |
| 16 | ifeq ($(strip $(NO_SECRETS)), lite) | 16 | ifeq ($(strip $(NO_SECRETS)), lite) |
| 17 | OPT_DEFS += -DNO_SECRETS | 17 | OPT_DEFS += -DNO_SECRETS |
| @@ -21,14 +21,14 @@ endif | |||
| 21 | CUSTOM_TAP_DANCE ?= yes | 21 | CUSTOM_TAP_DANCE ?= yes |
| 22 | ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) | 22 | ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) |
| 23 | ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) | 23 | ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) |
| 24 | SRC += tap_dances.c | 24 | SRC += $(USER_PATH)/tap_dances.c |
| 25 | endif | 25 | endif |
| 26 | endif | 26 | endif |
| 27 | 27 | ||
| 28 | CUSTOM_RGBLIGHT ?= yes | 28 | CUSTOM_RGBLIGHT ?= yes |
| 29 | ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) | 29 | ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) |
| 30 | ifeq ($(strip $(CUSTOM_RGBLIGHT)), yes) | 30 | ifeq ($(strip $(CUSTOM_RGBLIGHT)), yes) |
| 31 | SRC += rgb_stuff.c | 31 | SRC += $(USER_PATH)/rgb_stuff.c |
| 32 | ifeq ($(strip $(RGBLIGHT_NOEEPROM)), yes) | 32 | ifeq ($(strip $(RGBLIGHT_NOEEPROM)), yes) |
| 33 | OPT_DEFS += -DRGBLIGHT_NOEEPROM | 33 | OPT_DEFS += -DRGBLIGHT_NOEEPROM |
| 34 | endif | 34 | endif |
| @@ -41,7 +41,7 @@ endif | |||
| 41 | CUSTOM_RGB_MATRIX ?= yes | 41 | CUSTOM_RGB_MATRIX ?= yes |
| 42 | ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes) | 42 | ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes) |
| 43 | ifeq ($(strip $(CUSTOM_RGB_MATRIX)), yes) | 43 | ifeq ($(strip $(CUSTOM_RGB_MATRIX)), yes) |
| 44 | SRC += rgb_matrix_stuff.c | 44 | SRC += $(USER_PATH)/rgb_matrix_stuff.c |
| 45 | endif | 45 | endif |
| 46 | endif | 46 | endif |
| 47 | 47 | ||
| @@ -66,7 +66,7 @@ endif | |||
| 66 | CUSTOM_OLED_DRIVER ?= yes | 66 | CUSTOM_OLED_DRIVER ?= yes |
| 67 | ifeq ($(strip $(OLED_ENABLE)), yes) | 67 | ifeq ($(strip $(OLED_ENABLE)), yes) |
| 68 | ifeq ($(strip $(CUSTOM_OLED_DRIVER)), yes) | 68 | ifeq ($(strip $(CUSTOM_OLED_DRIVER)), yes) |
| 69 | SRC += oled_stuff.c | 69 | SRC += $(USER_PATH)/oled_stuff.c |
| 70 | OPT_DEFS += -DCUSTOM_OLED_DRIVER_CODE | 70 | OPT_DEFS += -DCUSTOM_OLED_DRIVER_CODE |
| 71 | endif | 71 | endif |
| 72 | endif | 72 | endif |
| @@ -81,7 +81,7 @@ endif | |||
| 81 | CUSTOM_SPLIT_TRANSPORT_SYNC ?= yes | 81 | CUSTOM_SPLIT_TRANSPORT_SYNC ?= yes |
| 82 | ifeq ($(strip $(CUSTOM_SPLIT_TRANSPORT_SYNC)), yes) | 82 | ifeq ($(strip $(CUSTOM_SPLIT_TRANSPORT_SYNC)), yes) |
| 83 | ifeq ($(strip $(SPLIT_KEYBOARD)), yes) | 83 | ifeq ($(strip $(SPLIT_KEYBOARD)), yes) |
| 84 | QUANTUM_LIB_SRC += transport_sync.c | 84 | QUANTUM_LIB_SRC += $(USER_PATH)/transport_sync.c |
| 85 | OPT_DEFS += -DCUSTOM_SPLIT_TRANSPORT_SYNC | 85 | OPT_DEFS += -DCUSTOM_SPLIT_TRANSPORT_SYNC |
| 86 | endif | 86 | endif |
| 87 | endif | 87 | endif |
diff --git a/users/drashna/transport_sync.c b/users/drashna/transport_sync.c index fdd596c04..39db64135 100644 --- a/users/drashna/transport_sync.c +++ b/users/drashna/transport_sync.c | |||
| @@ -23,7 +23,8 @@ extern unicode_config_t unicode_config; | |||
| 23 | #endif | 23 | #endif |
| 24 | #ifdef AUDIO_ENABLE | 24 | #ifdef AUDIO_ENABLE |
| 25 | # include "audio.h" | 25 | # include "audio.h" |
| 26 | extern bool delayed_tasks_run; | 26 | extern audio_config_t audio_config; |
| 27 | extern bool delayed_tasks_run; | ||
| 27 | #endif | 28 | #endif |
| 28 | #if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform) | 29 | #if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform) |
| 29 | extern bool tap_toggling; | 30 | extern bool tap_toggling; |
| @@ -33,14 +34,6 @@ extern bool swap_hands; | |||
| 33 | #endif | 34 | #endif |
| 34 | extern userspace_config_t userspace_config; | 35 | extern userspace_config_t userspace_config; |
| 35 | 36 | ||
| 36 | __attribute__((aligned(8))) typedef struct { | ||
| 37 | bool audio_enable; | ||
| 38 | bool audio_clicky_enable; | ||
| 39 | bool tap_toggling; | ||
| 40 | bool unicode_mode; | ||
| 41 | bool swap_hands; | ||
| 42 | } user_runtime_config_t; | ||
| 43 | |||
| 44 | uint16_t transport_keymap_config = 0; | 37 | uint16_t transport_keymap_config = 0; |
| 45 | uint32_t transport_userspace_config = 0; | 38 | uint32_t transport_userspace_config = 0; |
| 46 | 39 | ||
| @@ -80,34 +73,18 @@ void user_transport_update(void) { | |||
| 80 | #if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform) | 73 | #if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform) |
| 81 | user_state.tap_toggling = tap_toggling; | 74 | user_state.tap_toggling = tap_toggling; |
| 82 | #endif | 75 | #endif |
| 76 | #ifdef UNICODE_ENABLE | ||
| 77 | user_state.unicode_mode = unicode_config.input_mode; | ||
| 78 | #endif | ||
| 83 | #ifdef SWAP_HANDS_ENABLE | 79 | #ifdef SWAP_HANDS_ENABLE |
| 84 | user_state.swap_hands = swap_hands; | 80 | user_state.swap_hands = swap_hands; |
| 85 | #endif | 81 | #endif |
| 86 | |||
| 87 | } else { | 82 | } else { |
| 88 | keymap_config.raw = transport_keymap_config; | 83 | keymap_config.raw = transport_keymap_config; |
| 89 | userspace_config.raw = transport_userspace_config; | 84 | userspace_config.raw = transport_userspace_config; |
| 90 | #ifdef UNICODE_ENABLE | 85 | #ifdef UNICODE_ENABLE |
| 91 | unicode_config.input_mode = user_state.unicode_mode; | 86 | unicode_config.input_mode = user_state.unicode_mode; |
| 92 | #endif | 87 | #endif |
| 93 | #ifdef AUDIO_ENABLE | ||
| 94 | if (delayed_tasks_run) { | ||
| 95 | if (user_state.audio_enable != is_audio_on()) { | ||
| 96 | if (user_state.audio_enable) { | ||
| 97 | audio_on(); | ||
| 98 | } else { | ||
| 99 | audio_off(); | ||
| 100 | } | ||
| 101 | } | ||
| 102 | if (user_state.audio_clicky_enable != is_clicky_on()) { | ||
| 103 | if (user_state.audio_clicky_enable) { | ||
| 104 | clicky_on(); | ||
| 105 | } else { | ||
| 106 | clicky_off(); | ||
| 107 | } | ||
| 108 | } | ||
| 109 | } | ||
| 110 | #endif | ||
| 111 | #if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform) | 88 | #if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform) |
| 112 | tap_toggling = user_state.tap_toggling; | 89 | tap_toggling = user_state.tap_toggling; |
| 113 | #endif | 90 | #endif |
diff --git a/users/drashna/transport_sync.h b/users/drashna/transport_sync.h index e2b3eae76..062df2bac 100644 --- a/users/drashna/transport_sync.h +++ b/users/drashna/transport_sync.h | |||
| @@ -19,4 +19,14 @@ | |||
| 19 | 19 | ||
| 20 | #include "drashna.h" | 20 | #include "drashna.h" |
| 21 | 21 | ||
| 22 | __attribute__((aligned(8))) typedef struct { | ||
| 23 | bool audio_enable; | ||
| 24 | bool audio_clicky_enable; | ||
| 25 | bool tap_toggling; | ||
| 26 | bool unicode_mode; | ||
| 27 | bool swap_hands; | ||
| 28 | } user_runtime_config_t; | ||
| 29 | |||
| 30 | extern user_runtime_config_t user_state; | ||
| 31 | |||
| 22 | void keyboard_post_init_transport_sync(void); | 32 | void keyboard_post_init_transport_sync(void); |
