aboutsummaryrefslogtreecommitdiff
path: root/drivers/haptic/DRV2605L.c
diff options
context:
space:
mode:
authorMechMerlin <30334081+mechmerlin@users.noreply.github.com>2019-09-19 09:42:33 -0700
committerDrashna Jaelre <drashna@live.com>2019-09-19 09:42:33 -0700
commit911b8915cc89c040db3c6075a1a547003b0ab37f (patch)
treefe7afcae351fd3a5e9bce4ea25ef406f6382f1d7 /drivers/haptic/DRV2605L.c
parent7a5a2591ebc797d9670366a45396afed48c5fc6f (diff)
downloadqmk_firmware-911b8915cc89c040db3c6075a1a547003b0ab37f.tar.gz
qmk_firmware-911b8915cc89c040db3c6075a1a547003b0ab37f.zip
DRV2605L Continuous Haptic Feedback Support (#6461)
* provide means to turn on RTP mode and set the amplitude * new keycode HPT_CONT to turn RTP off/on * introduce new keycodes HPT_CONI, and HPT_COND for Haptic Continuous Increase and Decrease * support for continuous mode amplitude increase and decrease * code cleanup * update docs to reference new keycodes and functionality * don't touch the keymaps * add function prototypes * add proper guards * cleanup guards * remove extra reserved
Diffstat (limited to 'drivers/haptic/DRV2605L.c')
-rw-r--r--drivers/haptic/DRV2605L.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/haptic/DRV2605L.c b/drivers/haptic/DRV2605L.c
index f74c96525..728554b01 100644
--- a/drivers/haptic/DRV2605L.c
+++ b/drivers/haptic/DRV2605L.c
@@ -114,6 +114,17 @@ void DRV_init(void) {
114 DRV_write(DRV_GO, 0x01); 114 DRV_write(DRV_GO, 0x01);
115} 115}
116 116
117void DRV_rtp_init(void) {
118 DRV_write(DRV_GO, 0x00);
119 DRV_write(DRV_RTP_INPUT, 20); //20 is the lowest value I've found where haptics can still be felt.
120 DRV_write(DRV_MODE, 0x05);
121 DRV_write(DRV_GO, 0x01);
122}
123
124void DRV_amplitude(uint8_t amplitude) {
125 DRV_write(DRV_RTP_INPUT, amplitude);
126}
127
117void DRV_pulse(uint8_t sequence) { 128void DRV_pulse(uint8_t sequence) {
118 DRV_write(DRV_GO, 0x00); 129 DRV_write(DRV_GO, 0x00);
119 DRV_write(DRV_WAVEFORM_SEQ_1, sequence); 130 DRV_write(DRV_WAVEFORM_SEQ_1, sequence);