Handle Haptic Feedback play on each half with support for remote sending
This commit is contained in:
parent
26ec38782e
commit
7ba6f4d639
5 changed files with 38 additions and 12 deletions
|
@ -335,18 +335,27 @@ void haptic_play(void) {
|
||||||
uint8_t play_eff = 0;
|
uint8_t play_eff = 0;
|
||||||
play_eff = haptic_config.mode;
|
play_eff = haptic_config.mode;
|
||||||
drv2605l_pulse(play_eff);
|
drv2605l_pulse(play_eff);
|
||||||
# if defined(SPLIT_KEYBOARD) && defined(SPLIT_HAPTIC_ENABLE)
|
|
||||||
split_haptic_play = haptic_config.mode;
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAPTIC_SOLENOID
|
#ifdef HAPTIC_SOLENOID
|
||||||
solenoid_fire_handler();
|
solenoid_fire_handler();
|
||||||
# if defined(SPLIT_KEYBOARD) && defined(SPLIT_HAPTIC_ENABLE)
|
|
||||||
split_haptic_play = 1;
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(SPLIT_KEYBOARD) && defined(SPLIT_HAPTIC_ENABLE)
|
||||||
|
void set_haptic_split_play(uint8_t mode) {
|
||||||
|
split_haptic_play = mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
void split_haptic_play_effect(uint8_t mode) {
|
||||||
|
#ifdef HAPTIC_DRV2605L
|
||||||
|
drv2605l_pulse(mode);
|
||||||
|
#endif // HAPTIC_DRV2605L
|
||||||
|
#ifdef HAPTIC_SOLENOID
|
||||||
|
solenoid_fire_handler();
|
||||||
|
#endif // HAPTIC_SOLENOID
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void haptic_shutdown(void) {
|
void haptic_shutdown(void) {
|
||||||
#ifdef HAPTIC_SOLENOID
|
#ifdef HAPTIC_SOLENOID
|
||||||
solenoid_shutdown();
|
solenoid_shutdown();
|
||||||
|
|
|
@ -77,6 +77,11 @@ void haptic_cont_increase(void);
|
||||||
void haptic_cont_decrease(void);
|
void haptic_cont_decrease(void);
|
||||||
|
|
||||||
void haptic_play(void);
|
void haptic_play(void);
|
||||||
|
#if defined(SPLIT_KEYBOARD) && defined(SPLIT_HAPTIC_ENABLE)
|
||||||
|
void set_haptic_split_play(uint8_t mode);
|
||||||
|
void split_haptic_play_effect(uint8_t mode);
|
||||||
|
#endif
|
||||||
|
|
||||||
void haptic_shutdown(void);
|
void haptic_shutdown(void);
|
||||||
void haptic_notify_usb_device_state_change(void);
|
void haptic_notify_usb_device_state_change(void);
|
||||||
|
|
||||||
|
|
|
@ -506,6 +506,10 @@ void switch_events(uint8_t row, uint8_t col, bool pressed) {
|
||||||
#if defined(RGB_MATRIX_ENABLE)
|
#if defined(RGB_MATRIX_ENABLE)
|
||||||
rgb_matrix_handle_key_event(row, col, pressed);
|
rgb_matrix_handle_key_event(row, col, pressed);
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(HAPTIC_ENABLE) && defined(SPLIT_HAPTIC_ENABLE)
|
||||||
|
void haptic_handle_key_event(uint8_t row, uint8_t col, bool pressed);
|
||||||
|
haptic_handle_key_event(row, col, pressed);
|
||||||
|
#endif // HAPTIC_ENABLE && SPLIT_HAPTIC_ENABLE
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -129,19 +129,28 @@ bool process_haptic(uint16_t keycode, keyrecord_t *record) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void haptic_handle_key_event(uint8_t row, uint8_t col, bool pressed) {
|
||||||
|
keyevent_t event = MAKE_KEYEVENT(row, col, pressed);
|
||||||
|
keyrecord_t record = {.event = event};
|
||||||
|
uint16_t keycode = get_event_keycode(event, false);
|
||||||
|
|
||||||
if (haptic_get_enable() && ((!HAPTIC_OFF_IN_LOW_POWER) || (usb_device_state_get_configure_state() == USB_DEVICE_STATE_CONFIGURED))) {
|
if (haptic_get_enable() && ((!HAPTIC_OFF_IN_LOW_POWER) || (usb_device_state_get_configure_state() == USB_DEVICE_STATE_CONFIGURED))) {
|
||||||
if (record->event.pressed) {
|
if (record.event.pressed) {
|
||||||
// keypress
|
// keypress
|
||||||
if (haptic_get_feedback() < 2 && get_haptic_enabled_key(keycode, record)) {
|
if (haptic_get_feedback() < 2 && get_haptic_enabled_key(keycode, &record)) {
|
||||||
haptic_play();
|
haptic_play();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// keyrelease
|
// keyrelease
|
||||||
if (haptic_get_feedback() > 0 && get_haptic_enabled_key(keycode, record)) {
|
if (haptic_get_feedback() > 0 && get_haptic_enabled_key(keycode, &record)) {
|
||||||
haptic_play();
|
haptic_play();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -838,8 +838,7 @@ static void haptic_handlers_slave(matrix_row_t master_matrix[], matrix_row_t sla
|
||||||
memcpy(&haptic_config, &split_shmem->haptic_sync.haptic_config, sizeof(haptic_config_t));
|
memcpy(&haptic_config, &split_shmem->haptic_sync.haptic_config, sizeof(haptic_config_t));
|
||||||
|
|
||||||
if (split_shmem->haptic_sync.haptic_play != 0xFF) {
|
if (split_shmem->haptic_sync.haptic_play != 0xFF) {
|
||||||
haptic_set_mode(split_shmem->haptic_sync.haptic_play);
|
split_haptic_play_effect(split_shmem->haptic_sync.haptic_play);
|
||||||
haptic_play();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue