summaryrefslogtreecommitdiff
path: root/tmk_core
diff options
context:
space:
mode:
authorPurdea Andrei <andrei@purdea.ro>2021-11-02 07:54:29 +0200
committerGitHub <noreply@github.com>2021-11-02 16:54:29 +1100
commit76fb54403ccd3ebaf1ca49c5172335e3593c5c5c (patch)
tree30b41c0b027baa5b9494f80ec0fd83c50a53fd5b /tmk_core
parent85d94d0c4d97de3d1b7ce0476499f44e79c25944 (diff)
downloadqmk_firmware-76fb54403ccd3ebaf1ca49c5172335e3593c5c5c.tar.gz
qmk_firmware-76fb54403ccd3ebaf1ca49c5172335e3593c5c5c.zip
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.
Diffstat (limited to 'tmk_core')
-rw-r--r--tmk_core/protocol/usb_device_state.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/tmk_core/protocol/usb_device_state.c b/tmk_core/protocol/usb_device_state.c
index 5ccd309ec2..84f01943be 100644
--- a/tmk_core/protocol/usb_device_state.c
+++ b/tmk_core/protocol/usb_device_state.c
@@ -16,6 +16,9 @@
*/
#include "usb_device_state.h"
+#if defined(HAPTIC_ENABLE)
+# include "haptic.h"
+#endif
enum usb_device_state usb_device_state = USB_DEVICE_STATE_NO_INIT;
@@ -23,7 +26,12 @@ __attribute__((weak)) void notify_usb_device_state_change_kb(enum usb_device_sta
__attribute__((weak)) void notify_usb_device_state_change_user(enum usb_device_state usb_device_state) {}
-static void notify_usb_device_state_change(enum usb_device_state usb_device_state) { notify_usb_device_state_change_kb(usb_device_state); }
+static void notify_usb_device_state_change(enum usb_device_state usb_device_state) {
+#if defined(HAPTIC_ENABLE) && HAPTIC_OFF_IN_LOW_POWER
+ haptic_notify_usb_device_state_change();
+#endif
+ notify_usb_device_state_change_kb(usb_device_state);
+}
void usb_device_state_set_configuration(bool isConfigured, uint8_t configurationNumber) {
usb_device_state = isConfigured ? USB_DEVICE_STATE_CONFIGURED : USB_DEVICE_STATE_INIT;