2022-01-10 10:33:48 +00:00
|
|
|
// Copyright 2021 Christoph Rehmann (crehmann)
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
|
|
|
#include "haptic_utils.h"
|
|
|
|
|
|
|
|
#ifdef HAPTIC_ENABLE
|
2023-07-20 23:17:39 +00:00
|
|
|
#include "drivers/haptic/drv2605l.h"
|
2022-01-10 10:33:48 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAPTIC_ENABLE
|
|
|
|
bool get_haptic_enabled_key(uint16_t keycode, keyrecord_t *record) {
|
|
|
|
switch (keycode) {
|
|
|
|
case KC_BTN1 ... KC_BTN5:
|
|
|
|
return true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void process_layer_pulse(layer_state_t state) {
|
|
|
|
#ifdef HAPTIC_ENABLE
|
|
|
|
switch (get_highest_layer(state)) {
|
|
|
|
case 1:
|
2023-07-20 23:17:39 +00:00
|
|
|
drv2605l_pulse(soft_bump);
|
2022-01-10 10:33:48 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2023-07-20 23:17:39 +00:00
|
|
|
drv2605l_pulse(sh_dblsharp_tick);
|
2022-01-10 10:33:48 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2023-07-20 23:17:39 +00:00
|
|
|
drv2605l_pulse(lg_dblclick_str);
|
2022-01-10 10:33:48 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
2023-07-20 23:17:39 +00:00
|
|
|
drv2605l_pulse(soft_bump);
|
2022-01-10 10:33:48 +00:00
|
|
|
break;
|
|
|
|
case 5:
|
2023-07-20 23:17:39 +00:00
|
|
|
drv2605l_pulse(pulsing_sharp);
|
2022-01-10 10:33:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|