summaryrefslogtreecommitdiffstats
path: root/quantum/haptic.h
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 /quantum/haptic.h
parent85d94d0c4d97de3d1b7ce0476499f44e79c25944 (diff)
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 'quantum/haptic.h')
-rw-r--r--quantum/haptic.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/quantum/haptic.h b/quantum/haptic.h
index fc7ca2f3e6..7d70a01333 100644
--- a/quantum/haptic.h
+++ b/quantum/haptic.h
@@ -75,3 +75,30 @@ void haptic_cont_decrease(void);
void haptic_play(void);
void haptic_shutdown(void);
+void haptic_notify_usb_device_state_change(void);
+
+#ifdef HAPTIC_ENABLE_PIN_ACTIVE_LOW
+# ifndef HAPTIC_ENABLE_PIN
+# error HAPTIC_ENABLE_PIN not defined
+# endif
+# define HAPTIC_ENABLE_PIN_WRITE_ACTIVE() writePinLow(HAPTIC_ENABLE_PIN)
+# define HAPTIC_ENABLE_PIN_WRITE_INACTIVE() writePinHigh(HAPTIC_ENABLE_PIN)
+#else
+# define HAPTIC_ENABLE_PIN_WRITE_ACTIVE() writePinHigh(HAPTIC_ENABLE_PIN)
+# define HAPTIC_ENABLE_PIN_WRITE_INACTIVE() writePinLow(HAPTIC_ENABLE_PIN)
+#endif
+
+#ifdef HAPTIC_ENABLE_STATUS_LED_ACTIVE_LOW
+# ifndef HAPTIC_ENABLE_STATUS_LED
+# error HAPTIC_ENABLE_STATUS_LED not defined
+# endif
+# define HAPTIC_ENABLE_STATUS_LED_WRITE_ACTIVE() writePinLow(HAPTIC_ENABLE_STATUS_LED)
+# define HAPTIC_ENABLE_STATUS_LED_WRITE_INACTIVE() writePinHigh(HAPTIC_ENABLE_STATUS_LED)
+#else
+# define HAPTIC_ENABLE_STATUS_LED_WRITE_ACTIVE() writePinHigh(HAPTIC_ENABLE_STATUS_LED)
+# define HAPTIC_ENABLE_STATUS_LED_WRITE_INACTIVE() writePinLow(HAPTIC_ENABLE_STATUS_LED)
+#endif
+
+#ifndef HAPTIC_OFF_IN_LOW_POWER
+# define HAPTIC_OFF_IN_LOW_POWER 0
+#endif