diff options
| author | jacob-w-gable <82864625+jacob-w-gable@users.noreply.github.com> | 2023-09-24 21:23:31 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-25 12:23:31 +1000 |
| commit | 99290b4c7e891e69ca161d79c74a0e32014645bb (patch) | |
| tree | e52a0ab1c51c56a78a8157169fb0a8f7c0acdfc2 /quantum | |
| parent | 7a761ebf7dfc4aa27132583a9a7ba7790df72b32 (diff) | |
Add full solenoid support on split keyboards (#21583)
Co-authored-by: Jacob Gable <jacob.gable@statheros.tech>
Diffstat (limited to 'quantum')
| -rw-r--r-- | quantum/haptic.c | 12 | ||||
| -rw-r--r-- | quantum/keyboard.c | 14 |
2 files changed, 18 insertions, 8 deletions
diff --git a/quantum/haptic.c b/quantum/haptic.c index 5a700dca38..a1fea29625 100644 --- a/quantum/haptic.c +++ b/quantum/haptic.c | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include "debug.h" | 20 | #include "debug.h" |
| 21 | #include "usb_device_state.h" | 21 | #include "usb_device_state.h" |
| 22 | #include "gpio.h" | 22 | #include "gpio.h" |
| 23 | #include "keyboard.h" | ||
| 23 | 24 | ||
| 24 | #ifdef HAPTIC_DRV2605L | 25 | #ifdef HAPTIC_DRV2605L |
| 25 | # include "drv2605l.h" | 26 | # include "drv2605l.h" |
| @@ -58,6 +59,11 @@ static void set_haptic_config_enable(bool enabled) { | |||
| 58 | } | 59 | } |
| 59 | 60 | ||
| 60 | void haptic_init(void) { | 61 | void haptic_init(void) { |
| 62 | // only initialize on secondary boards if the user desires | ||
| 63 | #if defined(SPLIT_KEYBOARD) && !defined(SPLIT_HAPTIC_ENABLE) | ||
| 64 | if (!is_keyboard_master()) return; | ||
| 65 | #endif | ||
| 66 | |||
| 61 | if (!eeconfig_is_enabled()) { | 67 | if (!eeconfig_is_enabled()) { |
| 62 | eeconfig_init(); | 68 | eeconfig_init(); |
| 63 | } | 69 | } |
| @@ -99,8 +105,12 @@ void haptic_init(void) { | |||
| 99 | 105 | ||
| 100 | void haptic_task(void) { | 106 | void haptic_task(void) { |
| 101 | #ifdef HAPTIC_SOLENOID | 107 | #ifdef HAPTIC_SOLENOID |
| 108 | // Only run task on seconary boards if the user desires | ||
| 109 | # if defined(SPLIT_KEYBOARD) && !defined(SPLIT_HAPTIC_ENABLE) | ||
| 110 | if (!is_keyboard_master()) return; | ||
| 111 | # endif | ||
| 102 | solenoid_check(); | 112 | solenoid_check(); |
| 103 | #endif | 113 | #endif // HAPTIC_SOLENOID |
| 104 | } | 114 | } |
| 105 | 115 | ||
| 106 | void eeconfig_debug_haptic(void) { | 116 | void eeconfig_debug_haptic(void) { |
diff --git a/quantum/keyboard.c b/quantum/keyboard.c index c2ca15d52d..cf3361dff9 100644 --- a/quantum/keyboard.c +++ b/quantum/keyboard.c | |||
| @@ -395,9 +395,6 @@ void quantum_init(void) { | |||
| 395 | #if defined(UNICODE_COMMON_ENABLE) | 395 | #if defined(UNICODE_COMMON_ENABLE) |
| 396 | unicode_input_mode_init(); | 396 | unicode_input_mode_init(); |
| 397 | #endif | 397 | #endif |
| 398 | #ifdef HAPTIC_ENABLE | ||
| 399 | haptic_init(); | ||
| 400 | #endif | ||
| 401 | } | 398 | } |
| 402 | 399 | ||
| 403 | /** \brief keyboard_init | 400 | /** \brief keyboard_init |
| @@ -462,6 +459,9 @@ void keyboard_init(void) { | |||
| 462 | #ifdef BLUETOOTH_ENABLE | 459 | #ifdef BLUETOOTH_ENABLE |
| 463 | bluetooth_init(); | 460 | bluetooth_init(); |
| 464 | #endif | 461 | #endif |
| 462 | #ifdef HAPTIC_ENABLE | ||
| 463 | haptic_init(); | ||
| 464 | #endif | ||
| 465 | 465 | ||
| 466 | #if defined(DEBUG_MATRIX_SCAN_RATE) && defined(CONSOLE_ENABLE) | 466 | #if defined(DEBUG_MATRIX_SCAN_RATE) && defined(CONSOLE_ENABLE) |
| 467 | debug_enable = true; | 467 | debug_enable = true; |
| @@ -617,10 +617,6 @@ void quantum_task(void) { | |||
| 617 | decay_wpm(); | 617 | decay_wpm(); |
| 618 | #endif | 618 | #endif |
| 619 | 619 | ||
| 620 | #ifdef HAPTIC_ENABLE | ||
| 621 | haptic_task(); | ||
| 622 | #endif | ||
| 623 | |||
| 624 | #ifdef DIP_SWITCH_ENABLE | 620 | #ifdef DIP_SWITCH_ENABLE |
| 625 | dip_switch_read(false); | 621 | dip_switch_read(false); |
| 626 | #endif | 622 | #endif |
| @@ -726,5 +722,9 @@ void keyboard_task(void) { | |||
| 726 | bluetooth_task(); | 722 | bluetooth_task(); |
| 727 | #endif | 723 | #endif |
| 728 | 724 | ||
| 725 | #ifdef HAPTIC_ENABLE | ||
| 726 | haptic_task(); | ||
| 727 | #endif | ||
| 728 | |||
| 729 | led_task(); | 729 | led_task(); |
| 730 | } | 730 | } |
