Add full solenoid support on split keyboards (#21583)

Co-authored-by: Jacob Gable <jacob.gable@statheros.tech>
This commit is contained in:
jacob-w-gable
2023-09-24 21:23:31 -05:00
committed by GitHub
parent 7a761ebf7d
commit 99290b4c7e
4 changed files with 21 additions and 12 deletions

View File

@@ -20,6 +20,7 @@
#include "debug.h"
#include "usb_device_state.h"
#include "gpio.h"
#include "keyboard.h"
#ifdef HAPTIC_DRV2605L
# include "drv2605l.h"
@@ -58,6 +59,11 @@ static void set_haptic_config_enable(bool enabled) {
}
void haptic_init(void) {
// only initialize on secondary boards if the user desires
#if defined(SPLIT_KEYBOARD) && !defined(SPLIT_HAPTIC_ENABLE)
if (!is_keyboard_master()) return;
#endif
if (!eeconfig_is_enabled()) {
eeconfig_init();
}
@@ -99,8 +105,12 @@ void haptic_init(void) {
void haptic_task(void) {
#ifdef HAPTIC_SOLENOID
// Only run task on seconary boards if the user desires
# if defined(SPLIT_KEYBOARD) && !defined(SPLIT_HAPTIC_ENABLE)
if (!is_keyboard_master()) return;
# endif
solenoid_check();
#endif
#endif // HAPTIC_SOLENOID
}
void eeconfig_debug_haptic(void) {

View File

@@ -395,9 +395,6 @@ void quantum_init(void) {
#if defined(UNICODE_COMMON_ENABLE)
unicode_input_mode_init();
#endif
#ifdef HAPTIC_ENABLE
haptic_init();
#endif
}
/** \brief keyboard_init
@@ -462,6 +459,9 @@ void keyboard_init(void) {
#ifdef BLUETOOTH_ENABLE
bluetooth_init();
#endif
#ifdef HAPTIC_ENABLE
haptic_init();
#endif
#if defined(DEBUG_MATRIX_SCAN_RATE) && defined(CONSOLE_ENABLE)
debug_enable = true;
@@ -617,10 +617,6 @@ void quantum_task(void) {
decay_wpm();
#endif
#ifdef HAPTIC_ENABLE
haptic_task();
#endif
#ifdef DIP_SWITCH_ENABLE
dip_switch_read(false);
#endif
@@ -726,5 +722,9 @@ void keyboard_task(void) {
bluetooth_task();
#endif
#ifdef HAPTIC_ENABLE
haptic_task();
#endif
led_task();
}