diff options
| author | Purdea Andrei <andrei@purdea.ro> | 2021-11-02 07:54:29 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-02 16:54:29 +1100 |
| commit | 76fb54403ccd3ebaf1ca49c5172335e3593c5c5c (patch) | |
| tree | 30b41c0b027baa5b9494f80ec0fd83c50a53fd5b /quantum/haptic.h | |
| parent | 85d94d0c4d97de3d1b7ce0476499f44e79c25944 (diff) | |
| download | qmk_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 'quantum/haptic.h')
| -rw-r--r-- | quantum/haptic.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/quantum/haptic.h b/quantum/haptic.h index fc7ca2f3e..7d70a0133 100644 --- a/quantum/haptic.h +++ b/quantum/haptic.h | |||
| @@ -75,3 +75,30 @@ void haptic_cont_decrease(void); | |||
| 75 | 75 | ||
| 76 | void haptic_play(void); | 76 | void haptic_play(void); |
| 77 | void haptic_shutdown(void); | 77 | void haptic_shutdown(void); |
| 78 | void haptic_notify_usb_device_state_change(void); | ||
| 79 | |||
| 80 | #ifdef HAPTIC_ENABLE_PIN_ACTIVE_LOW | ||
| 81 | # ifndef HAPTIC_ENABLE_PIN | ||
| 82 | # error HAPTIC_ENABLE_PIN not defined | ||
| 83 | # endif | ||
| 84 | # define HAPTIC_ENABLE_PIN_WRITE_ACTIVE() writePinLow(HAPTIC_ENABLE_PIN) | ||
| 85 | # define HAPTIC_ENABLE_PIN_WRITE_INACTIVE() writePinHigh(HAPTIC_ENABLE_PIN) | ||
| 86 | #else | ||
| 87 | # define HAPTIC_ENABLE_PIN_WRITE_ACTIVE() writePinHigh(HAPTIC_ENABLE_PIN) | ||
| 88 | # define HAPTIC_ENABLE_PIN_WRITE_INACTIVE() writePinLow(HAPTIC_ENABLE_PIN) | ||
| 89 | #endif | ||
| 90 | |||
| 91 | #ifdef HAPTIC_ENABLE_STATUS_LED_ACTIVE_LOW | ||
| 92 | # ifndef HAPTIC_ENABLE_STATUS_LED | ||
| 93 | # error HAPTIC_ENABLE_STATUS_LED not defined | ||
| 94 | # endif | ||
| 95 | # define HAPTIC_ENABLE_STATUS_LED_WRITE_ACTIVE() writePinLow(HAPTIC_ENABLE_STATUS_LED) | ||
| 96 | # define HAPTIC_ENABLE_STATUS_LED_WRITE_INACTIVE() writePinHigh(HAPTIC_ENABLE_STATUS_LED) | ||
| 97 | #else | ||
| 98 | # define HAPTIC_ENABLE_STATUS_LED_WRITE_ACTIVE() writePinHigh(HAPTIC_ENABLE_STATUS_LED) | ||
| 99 | # define HAPTIC_ENABLE_STATUS_LED_WRITE_INACTIVE() writePinLow(HAPTIC_ENABLE_STATUS_LED) | ||
| 100 | #endif | ||
| 101 | |||
| 102 | #ifndef HAPTIC_OFF_IN_LOW_POWER | ||
| 103 | # define HAPTIC_OFF_IN_LOW_POWER 0 | ||
| 104 | #endif | ||
