From 76fb54403ccd3ebaf1ca49c5172335e3593c5c5c Mon Sep 17 00:00:00 2001 From: Purdea Andrei Date: Tue, 2 Nov 2021 07:54:29 +0200 Subject: 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. --- quantum/haptic.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'quantum/haptic.h') 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 -- cgit v1.2.3