mirror of
https://github.com/firewalkwithm3/qmk_firmware.git
synced 2024-11-22 19:40:29 +08:00
Add full solenoid support on split keyboards (#21583)
Co-authored-by: Jacob Gable <jacob.gable@statheros.tech>
This commit is contained in:
parent
7a761ebf7d
commit
99290b4c7e
|
@ -298,7 +298,7 @@ This enables transmitting the pointing device status to the master side of the s
|
||||||
#define SPLIT_HAPTIC_ENABLE
|
#define SPLIT_HAPTIC_ENABLE
|
||||||
```
|
```
|
||||||
|
|
||||||
This enables triggering of haptic feedback on the slave side of the split keyboard. For DRV2605L this will send the mode, but for solenoids it is expected that the desired mode is already set up on the slave.
|
This enables the triggering of haptic feedback on the slave side of the split keyboard. This will send information to the slave side such as the mode, dwell, and whether buzz is enabled.
|
||||||
|
|
||||||
```c
|
```c
|
||||||
#define SPLIT_ACTIVITY_ENABLE
|
#define SPLIT_ACTIVITY_ENABLE
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
uint8_t solenoid_dwell = SOLENOID_DEFAULT_DWELL;
|
|
||||||
static pin_t solenoid_pads[] = SOLENOID_PINS;
|
static pin_t solenoid_pads[] = SOLENOID_PINS;
|
||||||
#define NUMBER_OF_SOLENOIDS ARRAY_SIZE(solenoid_pads)
|
#define NUMBER_OF_SOLENOIDS ARRAY_SIZE(solenoid_pads)
|
||||||
bool solenoid_on[NUMBER_OF_SOLENOIDS] = {false};
|
bool solenoid_on[NUMBER_OF_SOLENOIDS] = {false};
|
||||||
|
@ -53,7 +52,7 @@ void solenoid_set_buzz(uint8_t buzz) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void solenoid_set_dwell(uint8_t dwell) {
|
void solenoid_set_dwell(uint8_t dwell) {
|
||||||
solenoid_dwell = dwell;
|
haptic_set_dwell(dwell);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -119,7 +118,7 @@ void solenoid_check(void) {
|
||||||
elapsed[i] = timer_elapsed(solenoid_start[i]);
|
elapsed[i] = timer_elapsed(solenoid_start[i]);
|
||||||
|
|
||||||
// Check if it's time to finish this solenoid click cycle
|
// Check if it's time to finish this solenoid click cycle
|
||||||
if (elapsed[i] > solenoid_dwell) {
|
if (elapsed[i] > haptic_config.dwell) {
|
||||||
solenoid_stop(i);
|
solenoid_stop(i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "usb_device_state.h"
|
#include "usb_device_state.h"
|
||||||
#include "gpio.h"
|
#include "gpio.h"
|
||||||
|
#include "keyboard.h"
|
||||||
|
|
||||||
#ifdef HAPTIC_DRV2605L
|
#ifdef HAPTIC_DRV2605L
|
||||||
# include "drv2605l.h"
|
# include "drv2605l.h"
|
||||||
|
@ -58,6 +59,11 @@ static void set_haptic_config_enable(bool enabled) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void haptic_init(void) {
|
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()) {
|
if (!eeconfig_is_enabled()) {
|
||||||
eeconfig_init();
|
eeconfig_init();
|
||||||
}
|
}
|
||||||
|
@ -99,8 +105,12 @@ void haptic_init(void) {
|
||||||
|
|
||||||
void haptic_task(void) {
|
void haptic_task(void) {
|
||||||
#ifdef HAPTIC_SOLENOID
|
#ifdef HAPTIC_SOLENOID
|
||||||
solenoid_check();
|
// Only run task on seconary boards if the user desires
|
||||||
|
# if defined(SPLIT_KEYBOARD) && !defined(SPLIT_HAPTIC_ENABLE)
|
||||||
|
if (!is_keyboard_master()) return;
|
||||||
# endif
|
# endif
|
||||||
|
solenoid_check();
|
||||||
|
#endif // HAPTIC_SOLENOID
|
||||||
}
|
}
|
||||||
|
|
||||||
void eeconfig_debug_haptic(void) {
|
void eeconfig_debug_haptic(void) {
|
||||||
|
|
|
@ -395,9 +395,6 @@ void quantum_init(void) {
|
||||||
#if defined(UNICODE_COMMON_ENABLE)
|
#if defined(UNICODE_COMMON_ENABLE)
|
||||||
unicode_input_mode_init();
|
unicode_input_mode_init();
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAPTIC_ENABLE
|
|
||||||
haptic_init();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \brief keyboard_init
|
/** \brief keyboard_init
|
||||||
|
@ -462,6 +459,9 @@ void keyboard_init(void) {
|
||||||
#ifdef BLUETOOTH_ENABLE
|
#ifdef BLUETOOTH_ENABLE
|
||||||
bluetooth_init();
|
bluetooth_init();
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAPTIC_ENABLE
|
||||||
|
haptic_init();
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(DEBUG_MATRIX_SCAN_RATE) && defined(CONSOLE_ENABLE)
|
#if defined(DEBUG_MATRIX_SCAN_RATE) && defined(CONSOLE_ENABLE)
|
||||||
debug_enable = true;
|
debug_enable = true;
|
||||||
|
@ -617,10 +617,6 @@ void quantum_task(void) {
|
||||||
decay_wpm();
|
decay_wpm();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAPTIC_ENABLE
|
|
||||||
haptic_task();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DIP_SWITCH_ENABLE
|
#ifdef DIP_SWITCH_ENABLE
|
||||||
dip_switch_read(false);
|
dip_switch_read(false);
|
||||||
#endif
|
#endif
|
||||||
|
@ -726,5 +722,9 @@ void keyboard_task(void) {
|
||||||
bluetooth_task();
|
bluetooth_task();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAPTIC_ENABLE
|
||||||
|
haptic_task();
|
||||||
|
#endif
|
||||||
|
|
||||||
led_task();
|
led_task();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue