From b26c67fa01111fe3dced935c94d26b0972fbf6bb Mon Sep 17 00:00:00 2001 From: Sadek Baroudi Date: Wed, 14 Sep 2022 01:26:28 -0700 Subject: [PATCH] removed layer haptic except for mouse layer, added copy paste haptic --- users/sadekbaroudi/haptic_stuff.c | 19 +++++++++++++----- users/sadekbaroudi/haptic_stuff.h | 3 ++- users/sadekbaroudi/process_records.c | 30 +++++++++++++++++++++++++--- 3 files changed, 43 insertions(+), 9 deletions(-) diff --git a/users/sadekbaroudi/haptic_stuff.c b/users/sadekbaroudi/haptic_stuff.c index ec8f98e9d8..995cf23479 100644 --- a/users/sadekbaroudi/haptic_stuff.c +++ b/users/sadekbaroudi/haptic_stuff.c @@ -7,27 +7,27 @@ layer_state_t layer_state_set_haptic(layer_state_t state) { case _ALPHA_ALT: case _ALPHA: #ifdef HAPTIC_ENABLE - DRV_pulse(soft_bump); + // DRV_pulse(soft_bump); #endif break; case _NAVIGATION: #ifdef HAPTIC_ENABLE - DRV_pulse(sh_dblsharp_tick); + // DRV_pulse(sh_dblsharp_tick); #endif break; case _SYMBOLS: #ifdef HAPTIC_ENABLE - DRV_pulse(lg_dblclick_str); + // DRV_pulse(lg_dblclick_str); #endif break; case _FUNCTION: #ifdef HAPTIC_ENABLE - DRV_pulse(pulsing_sharp); + // DRV_pulse(pulsing_sharp); #endif break; case _MEDIA: #ifdef HAPTIC_ENABLE - DRV_pulse(transition_rampup_short_smooth1); + // DRV_pulse(transition_rampup_short_smooth1); #endif break; case _MOUSE: @@ -41,3 +41,12 @@ layer_state_t layer_state_set_haptic(layer_state_t state) { return state; } + +// manually handle haptic +bool get_haptic_enabled_key(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + default: + return false; + break; + } +} \ No newline at end of file diff --git a/users/sadekbaroudi/haptic_stuff.h b/users/sadekbaroudi/haptic_stuff.h index 9f78de3900..78f18cb49b 100644 --- a/users/sadekbaroudi/haptic_stuff.h +++ b/users/sadekbaroudi/haptic_stuff.h @@ -1,4 +1,5 @@ #pragma once #include "quantum.h" -layer_state_t layer_state_set_haptic(layer_state_t state); \ No newline at end of file +layer_state_t layer_state_set_haptic(layer_state_t state); +bool get_haptic_enabled_key(uint16_t keycode, keyrecord_t *record); \ No newline at end of file diff --git a/users/sadekbaroudi/process_records.c b/users/sadekbaroudi/process_records.c index fe573c5a85..6381f08d3d 100755 --- a/users/sadekbaroudi/process_records.c +++ b/users/sadekbaroudi/process_records.c @@ -179,19 +179,43 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { break; #endif case KC_BTN1: + if (record->event.pressed) { #ifdef HAPTIC_ENABLE - DRV_pulse(medium_click1); + DRV_pulse(medium_click1); #endif + } break; case KC_BTN2: + if (record->event.pressed) { #ifdef HAPTIC_ENABLE - DRV_pulse(sh_dblclick_str); + DRV_pulse(sh_dblclick_str); #endif + } break; case KC_BTN3: + if (record->event.pressed) { #ifdef HAPTIC_ENABLE - DRV_pulse(lg_dblclick_med); + // DRV_pulse(lg_dblclick_med); #endif + } + break; + case KC_C: // copy + if (record->event.pressed) { +#ifdef HAPTIC_ENABLE + if (get_mods() & MOD_MASK_CTRL) { + DRV_pulse(lg_dblclick_str); + } +#endif + } + break; + case KC_V: // paste + if (record->event.pressed) { +#ifdef HAPTIC_ENABLE + if (get_mods() & MOD_MASK_CTRL) { + DRV_pulse(soft_bump); + } +#endif + } break; case C_CAPSWORD: // NOTE: if you change this behavior, may want to update in keymap.c for COMBO behavior