1
0
Fork 0

haptic: Feature to disable it when usb port is not configured or suspended. (#12692)

This also add support for specifying a LED pin to indicate haptic status,
and also adds support for a haptic-enable pin, which is useful to turn off
the boost converter on the solenoid driver.
This commit is contained in:
Purdea Andrei 2021-11-02 07:54:29 +02:00 committed by GitHub
parent 85d94d0c4d
commit 76fb54403c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 115 additions and 11 deletions

View file

@ -17,6 +17,7 @@
#include "process_haptic.h"
#include "quantum_keycodes.h"
#include "action_tapping.h"
#include "usb_device_state.h"
__attribute__((weak)) bool get_haptic_enabled_key(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
@ -131,7 +132,7 @@ bool process_haptic(uint16_t keycode, keyrecord_t *record) {
}
}
if (haptic_get_enable()) {
if (haptic_get_enable() && ((!HAPTIC_OFF_IN_LOW_POWER) || (usb_device_state == USB_DEVICE_STATE_CONFIGURED))) {
if (record->event.pressed) {
// keypress
if (haptic_get_feedback() < 2 && get_haptic_enabled_key(keycode, record)) {