1
0
Fork 0

Handle Haptic Feedback play on each half with support for remote sending

This commit is contained in:
Drashna Jael're 2024-10-26 15:43:20 -07:00
parent 26ec38782e
commit 7ba6f4d639
Signed by: drashna
GPG key ID: DBA1FD3A860D1B11
5 changed files with 38 additions and 12 deletions

View file

@ -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 (record->event.pressed) {
if (record.event.pressed) {
// 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();
}
} else {
// 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();
}
}
}
return true;
}