diff options
53 files changed, 667 insertions, 660 deletions
diff --git a/builddefs/common_features.mk b/builddefs/common_features.mk index 5687201d61..2de2bdd56b 100644 --- a/builddefs/common_features.mk +++ b/builddefs/common_features.mk | |||
| @@ -721,18 +721,23 @@ ifeq ($(strip $(FNV_ENABLE)), yes) | |||
| 721 | SRC += qmk_fnv_type_validation.c hash_32a.c hash_64a.c | 721 | SRC += qmk_fnv_type_validation.c hash_32a.c hash_64a.c |
| 722 | endif | 722 | endif |
| 723 | 723 | ||
| 724 | VALID_HAPTIC_DRIVER_TYPES := drv2605l solenoid | ||
| 724 | ifeq ($(strip $(HAPTIC_ENABLE)),yes) | 725 | ifeq ($(strip $(HAPTIC_ENABLE)),yes) |
| 725 | COMMON_VPATH += $(DRIVER_PATH)/haptic | 726 | ifeq ($(filter $(HAPTIC_DRIVER),$(VALID_HAPTIC_DRIVER_TYPES)),) |
| 727 | $(call CATASTROPHIC_ERROR,Invalid HAPTIC_DRIVER,HAPTIC_DRIVER="$(HAPTIC_DRIVER)" is not a valid Haptic driver) | ||
| 728 | else | ||
| 729 | COMMON_VPATH += $(DRIVER_PATH)/haptic | ||
| 726 | 730 | ||
| 727 | ifneq ($(filter DRV2605L, $(HAPTIC_DRIVER)), ) | 731 | ifeq ($(strip $(HAPTIC_DRIVER)), drv2605l) |
| 728 | SRC += DRV2605L.c | 732 | SRC += drv2605l.c |
| 729 | QUANTUM_LIB_SRC += i2c_master.c | 733 | QUANTUM_LIB_SRC += i2c_master.c |
| 730 | OPT_DEFS += -DDRV2605L | 734 | OPT_DEFS += -DHAPTIC_DRV2605L |
| 731 | endif | 735 | endif |
| 732 | 736 | ||
| 733 | ifneq ($(filter SOLENOID, $(HAPTIC_DRIVER)), ) | 737 | ifeq ($(strip $(HAPTIC_DRIVER)), solenoid) |
| 734 | SRC += solenoid.c | 738 | SRC += solenoid.c |
| 735 | OPT_DEFS += -DSOLENOID_ENABLE | 739 | OPT_DEFS += -DHAPTIC_SOLENOID |
| 740 | endif | ||
| 736 | endif | 741 | endif |
| 737 | endif | 742 | endif |
| 738 | 743 | ||
diff --git a/docs/feature_haptic_feedback.md b/docs/feature_haptic_feedback.md index b456bad736..02a231138d 100644 --- a/docs/feature_haptic_feedback.md +++ b/docs/feature_haptic_feedback.md | |||
| @@ -4,11 +4,12 @@ | |||
| 4 | 4 | ||
| 5 | The following options are currently available for haptic feedback in `rules.mk`: | 5 | The following options are currently available for haptic feedback in `rules.mk`: |
| 6 | 6 | ||
| 7 | ``` | 7 | ```make |
| 8 | HAPTIC_ENABLE = yes | 8 | HAPTIC_ENABLE = yes |
| 9 | 9 | ||
| 10 | HAPTIC_DRIVER += DRV2605L | 10 | HAPTIC_DRIVER = drv2605l |
| 11 | HAPTIC_DRIVER += SOLENOID | 11 | # or |
| 12 | HAPTIC_DRIVER = solenoid | ||
| 12 | ``` | 13 | ``` |
| 13 | 14 | ||
| 14 | The following `config.h` settings are available for all types of haptic feedback: | 15 | The following `config.h` settings are available for all types of haptic feedback: |
| @@ -92,7 +93,7 @@ This driver supports 2 different feedback motors. Set the following in your `con | |||
| 92 | 93 | ||
| 93 | Eccentric Rotating Mass vibration motors (ERM) is motor with a off-set weight attached so when drive signal is attached, the off-set weight spins and causes a sinusoidal wave that translate into vibrations. | 94 | Eccentric Rotating Mass vibration motors (ERM) is motor with a off-set weight attached so when drive signal is attached, the off-set weight spins and causes a sinusoidal wave that translate into vibrations. |
| 94 | 95 | ||
| 95 | ``` | 96 | ```c |
| 96 | #define FB_ERM_LRA 0 | 97 | #define FB_ERM_LRA 0 |
| 97 | #define FB_BRAKEFACTOR 3 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */ | 98 | #define FB_BRAKEFACTOR 3 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */ |
| 98 | #define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */ | 99 | #define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */ |
| @@ -105,7 +106,7 @@ Eccentric Rotating Mass vibration motors (ERM) is motor with a off-set weight at | |||
| 105 | 106 | ||
| 106 | Linear resonant actuators (LRA, also know as a linear vibrator) works different from a ERM. A LRA has a weight and magnet suspended by springs and a voice coil. When the drive signal is applied, the weight would be vibrate on a single axis (side to side or up and down). Since the weight is attached to a spring, there is a resonance effect at a specific frequency. This frequency is where the LRA will operate the most efficiently. Refer to the motor's datasheet for the recommanded range for this frequency. | 107 | Linear resonant actuators (LRA, also know as a linear vibrator) works different from a ERM. A LRA has a weight and magnet suspended by springs and a voice coil. When the drive signal is applied, the weight would be vibrate on a single axis (side to side or up and down). Since the weight is attached to a spring, there is a resonance effect at a specific frequency. This frequency is where the LRA will operate the most efficiently. Refer to the motor's datasheet for the recommanded range for this frequency. |
| 107 | 108 | ||
| 108 | ``` | 109 | ```c |
| 109 | #define FB_ERM_LRA 1 | 110 | #define FB_ERM_LRA 1 |
| 110 | #define FB_BRAKEFACTOR 3 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */ | 111 | #define FB_BRAKEFACTOR 3 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */ |
| 111 | #define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */ | 112 | #define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */ |
| @@ -170,13 +171,13 @@ List of waveform sequences from the datasheet: | |||
| 170 | | 42 | lg_dblclick_med_80 | 84 | transition_rampup_med_smooth1 | | | | 171 | | 42 | lg_dblclick_med_80 | 84 | transition_rampup_med_smooth1 | | | |
| 171 | ### Optional DRV2605L defines | 172 | ### Optional DRV2605L defines |
| 172 | 173 | ||
| 173 | ``` | 174 | ```c |
| 174 | #define DRV_GREETING *sequence name or number* | 175 | #define DRV2605L_GREETING *sequence name or number* |
| 175 | ``` | 176 | ``` |
| 176 | If haptic feedback is enabled, the keyboard will vibrate to a specific sequence during startup. That can be selected using the following define: | 177 | If haptic feedback is enabled, the keyboard will vibrate to a specific sequence during startup. That can be selected using the following define: |
| 177 | 178 | ||
| 178 | ``` | 179 | ```c |
| 179 | #define DRV_MODE_DEFAULT *sequence name or number* | 180 | #define DRV2605L_DEFAULT_MODE *sequence name or number* |
| 180 | ``` | 181 | ``` |
| 181 | This will set what sequence `HF_RST` will set as the active mode. If not defined, mode will be set to 1 when `HF_RST` is pressed. | 182 | This will set what sequence `HF_RST` will set as the active mode. If not defined, mode will be set to 1 when `HF_RST` is pressed. |
| 182 | 183 | ||
diff --git a/drivers/haptic/DRV2605L.c b/drivers/haptic/DRV2605L.c deleted file mode 100644 index 5a1d2ca0af..0000000000 --- a/drivers/haptic/DRV2605L.c +++ /dev/null | |||
| @@ -1,122 +0,0 @@ | |||
| 1 | /* Copyright 2018 ishtob | ||
| 2 | * Driver for DRV2605L written for QMK | ||
| 3 | * | ||
| 4 | * This program is free software: you can redistribute it and/or modify | ||
| 5 | * it under the terms of the GNU General Public License as published by | ||
| 6 | * the Free Software Foundation, either version 2 of the License, or | ||
| 7 | * (at your option) any later version. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | * GNU General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License | ||
| 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | #include "DRV2605L.h" | ||
| 18 | #include "print.h" | ||
| 19 | #include <stdlib.h> | ||
| 20 | #include <stdio.h> | ||
| 21 | #include <math.h> | ||
| 22 | |||
| 23 | uint8_t DRV2605L_transfer_buffer[2]; | ||
| 24 | uint8_t DRV2605L_read_register; | ||
| 25 | |||
| 26 | void DRV_write(uint8_t drv_register, uint8_t settings) { | ||
| 27 | DRV2605L_transfer_buffer[0] = drv_register; | ||
| 28 | DRV2605L_transfer_buffer[1] = settings; | ||
| 29 | i2c_transmit(DRV2605L_BASE_ADDRESS << 1, DRV2605L_transfer_buffer, 2, 100); | ||
| 30 | } | ||
| 31 | |||
| 32 | uint8_t DRV_read(uint8_t regaddress) { | ||
| 33 | i2c_readReg(DRV2605L_BASE_ADDRESS << 1, regaddress, &DRV2605L_read_register, 1, 100); | ||
| 34 | |||
| 35 | return DRV2605L_read_register; | ||
| 36 | } | ||
| 37 | |||
| 38 | void DRV_init(void) { | ||
| 39 | i2c_init(); | ||
| 40 | /* 0x07 sets DRV2605 into calibration mode */ | ||
| 41 | DRV_write(DRV_MODE, 0x07); | ||
| 42 | |||
| 43 | // DRV_write(DRV_FEEDBACK_CTRL,0xB6); | ||
| 44 | |||
| 45 | #if FB_ERM_LRA == 0 | ||
| 46 | /* ERM settings */ | ||
| 47 | DRV_write(DRV_RATED_VOLT, (RATED_VOLTAGE / 21.33) * 1000); | ||
| 48 | # if ERM_OPEN_LOOP == 0 | ||
| 49 | DRV_write(DRV_OVERDRIVE_CLAMP_VOLT, (((V_PEAK * (DRIVE_TIME + BLANKING_TIME + IDISS_TIME)) / 0.02133) / (DRIVE_TIME - 0.0003))); | ||
| 50 | # elif ERM_OPEN_LOOP == 1 | ||
| 51 | DRV_write(DRV_OVERDRIVE_CLAMP_VOLT, (V_PEAK / 0.02196)); | ||
| 52 | # endif | ||
| 53 | #elif FB_ERM_LRA == 1 | ||
| 54 | DRV_write(DRV_RATED_VOLT, ((V_RMS * sqrt(1 - ((4 * ((150 + (SAMPLE_TIME * 50)) * 0.000001)) + 0.0003) * F_LRA) / 0.02071))); | ||
| 55 | # if LRA_OPEN_LOOP == 0 | ||
| 56 | DRV_write(DRV_OVERDRIVE_CLAMP_VOLT, ((V_PEAK / sqrt(1 - (F_LRA * 0.0008)) / 0.02133))); | ||
| 57 | # elif LRA_OPEN_LOOP == 1 | ||
| 58 | DRV_write(DRV_OVERDRIVE_CLAMP_VOLT, (V_PEAK / 0.02196)); | ||
| 59 | # endif | ||
| 60 | #endif | ||
| 61 | |||
| 62 | DRVREG_FBR FB_SET; | ||
| 63 | FB_SET.Bits.ERM_LRA = FB_ERM_LRA; | ||
| 64 | FB_SET.Bits.BRAKE_FACTOR = FB_BRAKEFACTOR; | ||
| 65 | FB_SET.Bits.LOOP_GAIN = FB_LOOPGAIN; | ||
| 66 | FB_SET.Bits.BEMF_GAIN = 0; /* auto-calibration populates this field*/ | ||
| 67 | DRV_write(DRV_FEEDBACK_CTRL, (uint8_t)FB_SET.Byte); | ||
| 68 | DRVREG_CTRL1 C1_SET; | ||
| 69 | C1_SET.Bits.C1_DRIVE_TIME = DRIVE_TIME; | ||
| 70 | C1_SET.Bits.C1_AC_COUPLE = AC_COUPLE; | ||
| 71 | C1_SET.Bits.C1_STARTUP_BOOST = STARTUP_BOOST; | ||
| 72 | DRV_write(DRV_CTRL_1, (uint8_t)C1_SET.Byte); | ||
| 73 | DRVREG_CTRL2 C2_SET; | ||
| 74 | C2_SET.Bits.C2_BIDIR_INPUT = BIDIR_INPUT; | ||
| 75 | C2_SET.Bits.C2_BRAKE_STAB = BRAKE_STAB; | ||
| 76 | C2_SET.Bits.C2_SAMPLE_TIME = SAMPLE_TIME; | ||
| 77 | C2_SET.Bits.C2_BLANKING_TIME = BLANKING_TIME; | ||
| 78 | C2_SET.Bits.C2_IDISS_TIME = IDISS_TIME; | ||
| 79 | DRV_write(DRV_CTRL_2, (uint8_t)C2_SET.Byte); | ||
| 80 | DRVREG_CTRL3 C3_SET; | ||
| 81 | C3_SET.Bits.C3_LRA_OPEN_LOOP = LRA_OPEN_LOOP; | ||
| 82 | C3_SET.Bits.C3_N_PWM_ANALOG = N_PWM_ANALOG; | ||
| 83 | C3_SET.Bits.C3_LRA_DRIVE_MODE = LRA_DRIVE_MODE; | ||
| 84 | C3_SET.Bits.C3_DATA_FORMAT_RTO = DATA_FORMAT_RTO; | ||
| 85 | C3_SET.Bits.C3_SUPPLY_COMP_DIS = SUPPLY_COMP_DIS; | ||
| 86 | C3_SET.Bits.C3_ERM_OPEN_LOOP = ERM_OPEN_LOOP; | ||
| 87 | C3_SET.Bits.C3_NG_THRESH = NG_THRESH; | ||
| 88 | DRV_write(DRV_CTRL_3, (uint8_t)C3_SET.Byte); | ||
| 89 | DRVREG_CTRL4 C4_SET; | ||
| 90 | C4_SET.Bits.C4_ZC_DET_TIME = ZC_DET_TIME; | ||
| 91 | C4_SET.Bits.C4_AUTO_CAL_TIME = AUTO_CAL_TIME; | ||
| 92 | DRV_write(DRV_CTRL_4, (uint8_t)C4_SET.Byte); | ||
| 93 | DRV_write(DRV_LIB_SELECTION, LIB_SELECTION); | ||
| 94 | |||
| 95 | DRV_write(DRV_GO, 0x01); | ||
| 96 | |||
| 97 | /* 0x00 sets DRV2605 out of standby and to use internal trigger | ||
| 98 | * 0x01 sets DRV2605 out of standby and to use external trigger */ | ||
| 99 | DRV_write(DRV_MODE, 0x00); | ||
| 100 | |||
| 101 | // Play greeting sequence | ||
| 102 | DRV_write(DRV_GO, 0x00); | ||
| 103 | DRV_write(DRV_WAVEFORM_SEQ_1, DRV_GREETING); | ||
| 104 | DRV_write(DRV_GO, 0x01); | ||
| 105 | } | ||
| 106 | |||
| 107 | void DRV_rtp_init(void) { | ||
| 108 | DRV_write(DRV_GO, 0x00); | ||
| 109 | DRV_write(DRV_RTP_INPUT, 20); // 20 is the lowest value I've found where haptics can still be felt. | ||
| 110 | DRV_write(DRV_MODE, 0x05); | ||
| 111 | DRV_write(DRV_GO, 0x01); | ||
| 112 | } | ||
| 113 | |||
| 114 | void DRV_amplitude(uint8_t amplitude) { | ||
| 115 | DRV_write(DRV_RTP_INPUT, amplitude); | ||
| 116 | } | ||
| 117 | |||
| 118 | void DRV_pulse(uint8_t sequence) { | ||
| 119 | DRV_write(DRV_GO, 0x00); | ||
| 120 | DRV_write(DRV_WAVEFORM_SEQ_1, sequence); | ||
| 121 | DRV_write(DRV_GO, 0x01); | ||
| 122 | } | ||
diff --git a/drivers/haptic/DRV2605L.h b/drivers/haptic/DRV2605L.h deleted file mode 100644 index 8b8eae38b8..0000000000 --- a/drivers/haptic/DRV2605L.h +++ /dev/null | |||
| @@ -1,406 +0,0 @@ | |||
| 1 | /* Copyright 2018 ishtob | ||
| 2 | * Driver for DRV2605L written for QMK | ||
| 3 | * | ||
| 4 | * This program is free software: you can redistribute it and/or modify | ||
| 5 | * it under the terms of the GNU General Public License as published by | ||
| 6 | * the Free Software Foundation, either version 2 of the License, or | ||
| 7 | * (at your option) any later version. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | * GNU General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License | ||
| 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #pragma once | ||
| 19 | #include "i2c_master.h" | ||
| 20 | |||
| 21 | /* Initialization settings | ||
| 22 | |||
| 23 | * Feedback Control Settings */ | ||
| 24 | #ifndef FB_ERM_LRA | ||
| 25 | # define FB_ERM_LRA 1 /* For ERM:0 or LRA:1*/ | ||
| 26 | #endif | ||
| 27 | #ifndef FB_BRAKEFACTOR | ||
| 28 | # define FB_BRAKEFACTOR 3 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */ | ||
| 29 | #endif | ||
| 30 | #ifndef FB_LOOPGAIN | ||
| 31 | # define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */ | ||
| 32 | #endif | ||
| 33 | |||
| 34 | /* LRA specific settings */ | ||
| 35 | #if FB_ERM_LRA == 1 | ||
| 36 | # ifndef V_RMS | ||
| 37 | # define V_RMS 2.0 | ||
| 38 | # endif | ||
| 39 | # ifndef V_PEAK | ||
| 40 | # define V_PEAK 2.1 | ||
| 41 | # endif | ||
| 42 | # ifndef F_LRA | ||
| 43 | # define F_LRA 205 | ||
| 44 | # endif | ||
| 45 | # ifndef RATED_VOLTAGE | ||
| 46 | # define RATED_VOLTAGE 2 /* 2v as safe range in case device voltage is not set */ | ||
| 47 | # endif | ||
| 48 | #endif | ||
| 49 | |||
| 50 | #ifndef RATED_VOLTAGE | ||
| 51 | # define RATED_VOLTAGE 2 /* 2v as safe range in case device voltage is not set */ | ||
| 52 | #endif | ||
| 53 | #ifndef V_PEAK | ||
| 54 | # define V_PEAK 2.8 | ||
| 55 | #endif | ||
| 56 | |||
| 57 | /* Library Selection */ | ||
| 58 | #ifndef LIB_SELECTION | ||
| 59 | # if FB_ERM_LRA == 1 | ||
| 60 | # define LIB_SELECTION 6 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */ | ||
| 61 | # else | ||
| 62 | # define LIB_SELECTION 1 | ||
| 63 | # endif | ||
| 64 | #endif | ||
| 65 | |||
| 66 | #ifndef DRV_GREETING | ||
| 67 | # define DRV_GREETING alert_750ms | ||
| 68 | #endif | ||
| 69 | #ifndef DRV_MODE_DEFAULT | ||
| 70 | # define DRV_MODE_DEFAULT strong_click1 | ||
| 71 | #endif | ||
| 72 | |||
| 73 | /* Control 1 register settings */ | ||
| 74 | #ifndef DRIVE_TIME | ||
| 75 | # define DRIVE_TIME 25 | ||
| 76 | #endif | ||
| 77 | #ifndef AC_COUPLE | ||
| 78 | # define AC_COUPLE 0 | ||
| 79 | #endif | ||
| 80 | #ifndef STARTUP_BOOST | ||
| 81 | # define STARTUP_BOOST 1 | ||
| 82 | #endif | ||
| 83 | |||
| 84 | /* Control 2 Settings */ | ||
| 85 | #ifndef BIDIR_INPUT | ||
| 86 | # define BIDIR_INPUT 1 | ||
| 87 | #endif | ||
| 88 | #ifndef BRAKE_STAB | ||
| 89 | # define BRAKE_STAB 1 /* Loopgain is reduced when braking is almost complete to improve stability */ | ||
| 90 | #endif | ||
| 91 | #ifndef SAMPLE_TIME | ||
| 92 | # define SAMPLE_TIME 3 | ||
| 93 | #endif | ||
| 94 | #ifndef BLANKING_TIME | ||
| 95 | # define BLANKING_TIME 1 | ||
| 96 | #endif | ||
| 97 | #ifndef IDISS_TIME | ||
| 98 | # define IDISS_TIME 1 | ||
| 99 | #endif | ||
| 100 | |||
| 101 | /* Control 3 settings */ | ||
| 102 | #ifndef NG_THRESH | ||
| 103 | # define NG_THRESH 2 | ||
| 104 | #endif | ||
| 105 | #ifndef ERM_OPEN_LOOP | ||
| 106 | # define ERM_OPEN_LOOP 1 | ||
| 107 | #endif | ||
| 108 | #ifndef SUPPLY_COMP_DIS | ||
| 109 | # define SUPPLY_COMP_DIS 0 | ||
| 110 | #endif | ||
| 111 | #ifndef DATA_FORMAT_RTO | ||
| 112 | # define DATA_FORMAT_RTO 0 | ||
| 113 | #endif | ||
| 114 | #ifndef LRA_DRIVE_MODE | ||
| 115 | # define LRA_DRIVE_MODE 0 | ||
| 116 | #endif | ||
| 117 | #ifndef N_PWM_ANALOG | ||
| 118 | # define N_PWM_ANALOG 0 | ||
| 119 | #endif | ||
| 120 | #ifndef LRA_OPEN_LOOP | ||
| 121 | # define LRA_OPEN_LOOP 0 | ||
| 122 | #endif | ||
| 123 | |||
| 124 | /* Control 4 settings */ | ||
| 125 | #ifndef ZC_DET_TIME | ||
| 126 | # define ZC_DET_TIME 0 | ||
| 127 | #endif | ||
| 128 | #ifndef AUTO_CAL_TIME | ||
| 129 | # define AUTO_CAL_TIME 3 | ||
| 130 | #endif | ||
| 131 | |||
| 132 | /* register defines -------------------------------------------------------- */ | ||
| 133 | #define DRV2605L_BASE_ADDRESS 0x5A /* DRV2605L Base address */ | ||
| 134 | #define DRV_STATUS 0x00 | ||
| 135 | #define DRV_MODE 0x01 | ||
| 136 | #define DRV_RTP_INPUT 0x02 | ||
| 137 | #define DRV_LIB_SELECTION 0x03 | ||
| 138 | #define DRV_WAVEFORM_SEQ_1 0x04 | ||
| 139 | #define DRV_WAVEFORM_SEQ_2 0x05 | ||
| 140 | #define DRV_WAVEFORM_SEQ_3 0x06 | ||
| 141 | #define DRV_WAVEFORM_SEQ_4 0x07 | ||
| 142 | #define DRV_WAVEFORM_SEQ_5 0x08 | ||
| 143 | #define DRV_WAVEFORM_SEQ_6 0x09 | ||
| 144 | #define DRV_WAVEFORM_SEQ_7 0x0A | ||
| 145 | #define DRV_WAVEFORM_SEQ_8 0x0B | ||
| 146 | #define DRV_GO 0x0C | ||
| 147 | #define DRV_OVERDRIVE_TIME_OFFSET 0x0D | ||
| 148 | #define DRV_SUSTAIN_TIME_OFFSET_P 0x0E | ||
| 149 | #define DRV_SUSTAIN_TIME_OFFSET_N 0x0F | ||
| 150 | #define DRV_BRAKE_TIME_OFFSET 0x10 | ||
| 151 | #define DRV_AUDIO_2_VIBE_CTRL 0x11 | ||
| 152 | #define DRV_AUDIO_2_VIBE_MIN_IN 0x12 | ||
| 153 | #define DRV_AUDIO_2_VIBE_MAX_IN 0x13 | ||
| 154 | #define DRV_AUDIO_2_VIBE_MIN_OUTDRV 0x14 | ||
| 155 | #define DRV_AUDIO_2_VIBE_MAX_OUTDRV 0x15 | ||
| 156 | #define DRV_RATED_VOLT 0x16 | ||
| 157 | #define DRV_OVERDRIVE_CLAMP_VOLT 0x17 | ||
| 158 | #define DRV_AUTO_CALIB_COMP_RESULT 0x18 | ||
| 159 | #define DRV_AUTO_CALIB_BEMF_RESULT 0x19 | ||
| 160 | #define DRV_FEEDBACK_CTRL 0x1A | ||
| 161 | #define DRV_CTRL_1 0x1B | ||
| 162 | #define DRV_CTRL_2 0x1C | ||
| 163 | #define DRV_CTRL_3 0x1D | ||
| 164 | #define DRV_CTRL_4 0x1E | ||
| 165 | #define DRV_CTRL_5 0x1F | ||
| 166 | #define DRV_OPEN_LOOP_PERIOD 0x20 | ||
| 167 | #define DRV_VBAT_VOLT_MONITOR 0x21 | ||
| 168 | #define DRV_LRA_RESONANCE_PERIOD 0x22 | ||
| 169 | |||
| 170 | void DRV_init(void); | ||
| 171 | void DRV_write(const uint8_t drv_register, const uint8_t settings); | ||
| 172 | uint8_t DRV_read(const uint8_t regaddress); | ||
| 173 | void DRV_rtp_init(void); | ||
| 174 | void DRV_amplitude(const uint8_t amplitude); | ||
| 175 | void DRV_pulse(const uint8_t sequence); | ||
| 176 | |||
| 177 | typedef enum DRV_EFFECT { | ||
| 178 | clear_sequence = 0, | ||
| 179 | strong_click = 1, | ||
| 180 | strong_click_60 = 2, | ||
| 181 | strong_click_30 = 3, | ||
| 182 | sharp_click = 4, | ||
| 183 | sharp_click_60 = 5, | ||
| 184 | sharp_click_30 = 6, | ||
| 185 | soft_bump = 7, | ||
| 186 | soft_bump_60 = 8, | ||
| 187 | soft_bump_30 = 9, | ||
| 188 | dbl_click = 10, | ||
| 189 | dbl_click_60 = 11, | ||
| 190 | trp_click = 12, | ||
| 191 | soft_fuzz = 13, | ||
| 192 | strong_buzz = 14, | ||
| 193 | alert_750ms = 15, | ||
| 194 | alert_1000ms = 16, | ||
| 195 | strong_click1 = 17, | ||
| 196 | strong_click2_80 = 18, | ||
| 197 | strong_click3_60 = 19, | ||
| 198 | strong_click4_30 = 20, | ||
| 199 | medium_click1 = 21, | ||
| 200 | medium_click2_80 = 22, | ||
| 201 | medium_click3_60 = 23, | ||
| 202 | sharp_tick1 = 24, | ||
| 203 | sharp_tick2_80 = 25, | ||
| 204 | sharp_tick3_60 = 26, | ||
| 205 | sh_dblclick_str = 27, | ||
| 206 | sh_dblclick_str_80 = 28, | ||
| 207 | sh_dblclick_str_60 = 29, | ||
| 208 | sh_dblclick_str_30 = 30, | ||
| 209 | sh_dblclick_med = 31, | ||
| 210 | sh_dblclick_med_80 = 32, | ||
| 211 | sh_dblclick_med_60 = 33, | ||
| 212 | sh_dblsharp_tick = 34, | ||
| 213 | sh_dblsharp_tick_80 = 35, | ||
| 214 | sh_dblsharp_tick_60 = 36, | ||
| 215 | lg_dblclick_str = 37, | ||
| 216 | lg_dblclick_str_80 = 38, | ||
| 217 | lg_dblclick_str_60 = 39, | ||
| 218 | lg_dblclick_str_30 = 40, | ||
| 219 | lg_dblclick_med = 41, | ||
| 220 | lg_dblclick_med_80 = 42, | ||
| 221 | lg_dblclick_med_60 = 43, | ||
| 222 | lg_dblsharp_tick = 44, | ||
| 223 | lg_dblsharp_tick_80 = 45, | ||
| 224 | lg_dblsharp_tick_60 = 46, | ||
| 225 | buzz = 47, | ||
| 226 | buzz_80 = 48, | ||
| 227 | buzz_60 = 49, | ||
| 228 | buzz_40 = 50, | ||
| 229 | buzz_20 = 51, | ||
| 230 | pulsing_strong = 52, | ||
| 231 | pulsing_strong_80 = 53, | ||
| 232 | pulsing_medium = 54, | ||
| 233 | pulsing_medium_80 = 55, | ||
| 234 | pulsing_sharp = 56, | ||
| 235 | pulsing_sharp_80 = 57, | ||
| 236 | transition_click = 58, | ||
| 237 | transition_click_80 = 59, | ||
| 238 | transition_click_60 = 60, | ||
| 239 | transition_click_40 = 61, | ||
| 240 | transition_click_20 = 62, | ||
| 241 | transition_click_10 = 63, | ||
| 242 | transition_hum = 64, | ||
| 243 | transition_hum_80 = 65, | ||
| 244 | transition_hum_60 = 66, | ||
| 245 | transition_hum_40 = 67, | ||
| 246 | transition_hum_20 = 68, | ||
| 247 | transition_hum_10 = 69, | ||
| 248 | transition_rampdown_long_smooth1 = 70, | ||
| 249 | transition_rampdown_long_smooth2 = 71, | ||
| 250 | transition_rampdown_med_smooth1 = 72, | ||
| 251 | transition_rampdown_med_smooth2 = 73, | ||
| 252 | transition_rampdown_short_smooth1 = 74, | ||
| 253 | transition_rampdown_short_smooth2 = 75, | ||
| 254 | transition_rampdown_long_sharp1 = 76, | ||
| 255 | transition_rampdown_long_sharp2 = 77, | ||
| 256 | transition_rampdown_med_sharp1 = 78, | ||
| 257 | transition_rampdown_med_sharp2 = 79, | ||
| 258 | transition_rampdown_short_sharp1 = 80, | ||
| 259 | transition_rampdown_short_sharp2 = 81, | ||
| 260 | transition_rampup_long_smooth1 = 82, | ||
| 261 | transition_rampup_long_smooth2 = 83, | ||
| 262 | transition_rampup_med_smooth1 = 84, | ||
| 263 | transition_rampup_med_smooth2 = 85, | ||
| 264 | transition_rampup_short_smooth1 = 86, | ||
| 265 | transition_rampup_short_smooth2 = 87, | ||
| 266 | transition_rampup_long_sharp1 = 88, | ||
| 267 | transition_rampup_long_sharp2 = 89, | ||
| 268 | transition_rampup_med_sharp1 = 90, | ||
| 269 | transition_rampup_med_sharp2 = 91, | ||
| 270 | transition_rampup_short_sharp1 = 92, | ||
| 271 | transition_rampup_short_sharp2 = 93, | ||
| 272 | transition_rampdown_long_smooth1_50 = 94, | ||
| 273 | transition_rampdown_long_smooth2_50 = 95, | ||
| 274 | transition_rampdown_med_smooth1_50 = 96, | ||
| 275 | transition_rampdown_med_smooth2_50 = 97, | ||
| 276 | transition_rampdown_short_smooth1_50 = 98, | ||
| 277 | transition_rampdown_short_smooth2_50 = 99, | ||
| 278 | transition_rampdown_long_sharp1_50 = 100, | ||
| 279 | transition_rampdown_long_sharp2_50 = 101, | ||
| 280 | transition_rampdown_med_sharp1_50 = 102, | ||
| 281 | transition_rampdown_med_sharp2_50 = 103, | ||
| 282 | transition_rampdown_short_sharp1_50 = 104, | ||
| 283 | transition_rampdown_short_sharp2_50 = 105, | ||
| 284 | transition_rampup_long_smooth1_50 = 106, | ||
| 285 | transition_rampup_long_smooth2_50 = 107, | ||
| 286 | transition_rampup_med_smooth1_50 = 108, | ||
| 287 | transition_rampup_med_smooth2_50 = 109, | ||
| 288 | transition_rampup_short_smooth1_50 = 110, | ||
| 289 | transition_rampup_short_smooth2_50 = 111, | ||
| 290 | transition_rampup_long_sharp1_50 = 112, | ||
| 291 | transition_rampup_long_sharp2_50 = 113, | ||
| 292 | transition_rampup_med_sharp1_50 = 114, | ||
| 293 | transition_rampup_med_sharp2_50 = 115, | ||
| 294 | transition_rampup_short_sharp1_50 = 116, | ||
| 295 | transition_rampup_short_sharp2_50 = 117, | ||
| 296 | long_buzz_for_programmatic_stopping = 118, | ||
| 297 | smooth_hum1_50 = 119, | ||
| 298 | smooth_hum2_40 = 120, | ||
| 299 | smooth_hum3_30 = 121, | ||
| 300 | smooth_hum4_20 = 122, | ||
| 301 | smooth_hum5_10 = 123, | ||
| 302 | drv_effect_max = 124, | ||
| 303 | } DRV_EFFECT; | ||
| 304 | |||
| 305 | /* Register bit array unions */ | ||
| 306 | |||
| 307 | typedef union DRVREG_STATUS { /* register 0x00 */ | ||
| 308 | uint8_t Byte; | ||
| 309 | struct { | ||
| 310 | uint8_t OC_DETECT : 1; /* set to 1 when overcurrent event is detected */ | ||
| 311 | uint8_t OVER_TEMP : 1; /* set to 1 when device exceeds temp threshold */ | ||
| 312 | uint8_t FB_STS : 1; /* set to 1 when feedback controller has timed out */ | ||
| 313 | /* auto-calibration routine and diagnostic result | ||
| 314 | * result | auto-calibation | diagnostic | | ||
| 315 | * 0 | passed | actuator func normal | | ||
| 316 | * 1 | failed | actuator func fault* | | ||
| 317 | * * actuator is not present or is shorted, timing out, or giving out–of-range back-EMF */ | ||
| 318 | uint8_t DIAG_RESULT : 1; | ||
| 319 | uint8_t : 1; | ||
| 320 | uint8_t DEVICE_ID : 3; /* Device IDs 3: DRV2605 4: DRV2604 5: DRV2604L 6: DRV2605L */ | ||
| 321 | } Bits; | ||
| 322 | } DRVREG_STATUS; | ||
| 323 | |||
| 324 | typedef union DRVREG_MODE { /* register 0x01 */ | ||
| 325 | uint8_t Byte; | ||
| 326 | struct { | ||
| 327 | uint8_t MODE : 3; /* Mode setting */ | ||
| 328 | uint8_t : 3; | ||
| 329 | uint8_t STANDBY : 1; /* 0:standby 1:ready */ | ||
| 330 | } Bits; | ||
| 331 | } DRVREG_MODE; | ||
| 332 | |||
| 333 | typedef union DRVREG_WAIT { | ||
| 334 | uint8_t Byte; | ||
| 335 | struct { | ||
| 336 | uint8_t WAIT_MODE : 1; /* Set to 1 to interpret as wait for next 7 bits x10ms */ | ||
| 337 | uint8_t WAIT_TIME : 7; | ||
| 338 | } Bits; | ||
| 339 | } DRVREG_WAIT; | ||
| 340 | |||
| 341 | typedef union DRVREG_FBR { /* register 0x1A */ | ||
| 342 | uint8_t Byte; | ||
| 343 | struct { | ||
| 344 | uint8_t BEMF_GAIN : 2; | ||
| 345 | uint8_t LOOP_GAIN : 2; | ||
| 346 | uint8_t BRAKE_FACTOR : 3; | ||
| 347 | uint8_t ERM_LRA : 1; | ||
| 348 | } Bits; | ||
| 349 | } DRVREG_FBR; | ||
| 350 | |||
| 351 | typedef union DRVREG_CTRL1 { /* register 0x1B */ | ||
| 352 | uint8_t Byte; | ||
| 353 | struct { | ||
| 354 | uint8_t C1_DRIVE_TIME : 5; | ||
| 355 | uint8_t C1_AC_COUPLE : 1; | ||
| 356 | uint8_t : 1; | ||
| 357 | uint8_t C1_STARTUP_BOOST : 1; | ||
| 358 | } Bits; | ||
| 359 | } DRVREG_CTRL1; | ||
| 360 | |||
| 361 | typedef union DRVREG_CTRL2 { /* register 0x1C */ | ||
| 362 | uint8_t Byte; | ||
| 363 | struct { | ||
| 364 | uint8_t C2_IDISS_TIME : 2; | ||
| 365 | uint8_t C2_BLANKING_TIME : 2; | ||
| 366 | uint8_t C2_SAMPLE_TIME : 2; | ||
| 367 | uint8_t C2_BRAKE_STAB : 1; | ||
| 368 | uint8_t C2_BIDIR_INPUT : 1; | ||
| 369 | } Bits; | ||
| 370 | } DRVREG_CTRL2; | ||
| 371 | |||
| 372 | typedef union DRVREG_CTRL3 { /* register 0x1D */ | ||
| 373 | uint8_t Byte; | ||
| 374 | struct { | ||
| 375 | uint8_t C3_LRA_OPEN_LOOP : 1; | ||
| 376 | uint8_t C3_N_PWM_ANALOG : 1; | ||
| 377 | uint8_t C3_LRA_DRIVE_MODE : 1; | ||
| 378 | uint8_t C3_DATA_FORMAT_RTO : 1; | ||
| 379 | uint8_t C3_SUPPLY_COMP_DIS : 1; | ||
| 380 | uint8_t C3_ERM_OPEN_LOOP : 1; | ||
| 381 | uint8_t C3_NG_THRESH : 2; | ||
| 382 | } Bits; | ||
| 383 | } DRVREG_CTRL3; | ||
| 384 | |||
| 385 | typedef union DRVREG_CTRL4 { /* register 0x1E */ | ||
| 386 | uint8_t Byte; | ||
| 387 | struct { | ||
| 388 | uint8_t C4_OTP_PROGRAM : 1; | ||
| 389 | uint8_t : 1; | ||
| 390 | uint8_t C4_OTP_STATUS : 1; | ||
| 391 | uint8_t : 1; | ||
| 392 | uint8_t C4_AUTO_CAL_TIME : 2; | ||
| 393 | uint8_t C4_ZC_DET_TIME : 2; | ||
| 394 | } Bits; | ||
| 395 | } DRVREG_CTRL4; | ||
| 396 | |||
| 397 | typedef union DRVREG_CTRL5 { /* register 0x1F */ | ||
| 398 | uint8_t Byte; | ||
| 399 | struct { | ||
| 400 | uint8_t C5_IDISS_TIME : 2; | ||
| 401 | uint8_t C5_BLANKING_TIME : 2; | ||
| 402 | uint8_t C5_PLAYBACK_INTERVAL : 1; | ||
| 403 | uint8_t C5_LRA_AUTO_OPEN_LOOP : 1; | ||
| 404 | uint8_t C5_AUTO_OL_CNT : 2; | ||
| 405 | } Bits; | ||
| 406 | } DRVREG_CTRL5; | ||
diff --git a/drivers/haptic/drv2605l.c b/drivers/haptic/drv2605l.c new file mode 100644 index 0000000000..7613dc59d1 --- /dev/null +++ b/drivers/haptic/drv2605l.c | |||
| @@ -0,0 +1,126 @@ | |||
| 1 | /* Copyright 2018 ishtob | ||
| 2 | * Driver for DRV2605L written for QMK | ||
| 3 | * | ||
| 4 | * This program is free software: you can redistribute it and/or modify | ||
| 5 | * it under the terms of the GNU General Public License as published by | ||
| 6 | * the Free Software Foundation, either version 2 of the License, or | ||
| 7 | * (at your option) any later version. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | * GNU General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License | ||
| 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include "drv2605l.h" | ||
| 19 | #include "i2c_master.h" | ||
| 20 | #include <math.h> | ||
| 21 | |||
| 22 | uint8_t drv2605l_write_buffer[2]; | ||
| 23 | uint8_t drv2605l_read_buffer; | ||
| 24 | |||
| 25 | void drv2605l_write(uint8_t reg_addr, uint8_t data) { | ||
| 26 | drv2605l_write_buffer[0] = reg_addr; | ||
| 27 | drv2605l_write_buffer[1] = data; | ||
| 28 | i2c_transmit(DRV2605L_I2C_ADDRESS << 1, drv2605l_write_buffer, 2, 100); | ||
| 29 | } | ||
| 30 | |||
| 31 | uint8_t drv2605l_read(uint8_t reg_addr) { | ||
| 32 | i2c_readReg(DRV2605L_I2C_ADDRESS << 1, reg_addr, &drv2605l_read_buffer, 1, 100); | ||
| 33 | |||
| 34 | return drv2605l_read_buffer; | ||
| 35 | } | ||
| 36 | |||
| 37 | void drv2605l_init(void) { | ||
| 38 | i2c_init(); | ||
| 39 | /* 0x07 sets DRV2605 into calibration mode */ | ||
| 40 | drv2605l_write(DRV2605L_REG_MODE, 0x07); | ||
| 41 | |||
| 42 | // drv2605l_write(DRV2605L_REG_FEEDBACK_CTRL,0xB6); | ||
| 43 | |||
| 44 | #if FB_ERM_LRA == 0 | ||
| 45 | /* ERM settings */ | ||
| 46 | drv2605l_write(DRV2605L_REG_RATED_VOLTAGE, (RATED_VOLTAGE / 21.33) * 1000); | ||
| 47 | # if ERM_OPEN_LOOP == 0 | ||
| 48 | drv2605l_write(DRV2605L_REG_OVERDRIVE_CLAMP_VOLTAGE, (((V_PEAK * (DRIVE_TIME + BLANKING_TIME + IDISS_TIME)) / 0.02133) / (DRIVE_TIME - 0.0003))); | ||
| 49 | # elif ERM_OPEN_LOOP == 1 | ||
| 50 | drv2605l_write(DRV2605L_REG_OVERDRIVE_CLAMP_VOLTAGE, (V_PEAK / 0.02196)); | ||
| 51 | # endif | ||
| 52 | #elif FB_ERM_LRA == 1 | ||
| 53 | drv2605l_write(DRV2605L_REG_RATED_VOLTAGE, ((V_RMS * sqrt(1 - ((4 * ((150 + (SAMPLE_TIME * 50)) * 0.000001)) + 0.0003) * F_LRA) / 0.02071))); | ||
| 54 | # if LRA_OPEN_LOOP == 0 | ||
| 55 | drv2605l_write(DRV2605L_REG_OVERDRIVE_CLAMP_VOLTAGE, ((V_PEAK / sqrt(1 - (F_LRA * 0.0008)) / 0.02133))); | ||
| 56 | # elif LRA_OPEN_LOOP == 1 | ||
| 57 | drv2605l_write(DRV2605L_REG_OVERDRIVE_CLAMP_VOLTAGE, (V_PEAK / 0.02196)); | ||
| 58 | # endif | ||
| 59 | #endif | ||
| 60 | |||
| 61 | DRVREG_FBR FB_SET; | ||
| 62 | FB_SET.Bits.ERM_LRA = FB_ERM_LRA; | ||
| 63 | FB_SET.Bits.BRAKE_FACTOR = FB_BRAKEFACTOR; | ||
| 64 | FB_SET.Bits.LOOP_GAIN = FB_LOOPGAIN; | ||
| 65 | FB_SET.Bits.BEMF_GAIN = 0; /* auto-calibration populates this field*/ | ||
| 66 | drv2605l_write(DRV2605L_REG_FEEDBACK_CTRL, (uint8_t)FB_SET.Byte); | ||
| 67 | |||
| 68 | DRVREG_CTRL1 C1_SET; | ||
| 69 | C1_SET.Bits.C1_DRIVE_TIME = DRIVE_TIME; | ||
| 70 | C1_SET.Bits.C1_AC_COUPLE = AC_COUPLE; | ||
| 71 | C1_SET.Bits.C1_STARTUP_BOOST = STARTUP_BOOST; | ||
| 72 | drv2605l_write(DRV2605L_REG_CTRL1, (uint8_t)C1_SET.Byte); | ||
| 73 | |||
| 74 | DRVREG_CTRL2 C2_SET; | ||
| 75 | C2_SET.Bits.C2_BIDIR_INPUT = BIDIR_INPUT; | ||
| 76 | C2_SET.Bits.C2_BRAKE_STAB = BRAKE_STAB; | ||
| 77 | C2_SET.Bits.C2_SAMPLE_TIME = SAMPLE_TIME; | ||
| 78 | C2_SET.Bits.C2_BLANKING_TIME = BLANKING_TIME; | ||
| 79 | C2_SET.Bits.C2_IDISS_TIME = IDISS_TIME; | ||
| 80 | drv2605l_write(DRV2605L_REG_CTRL2, (uint8_t)C2_SET.Byte); | ||
| 81 | |||
| 82 | DRVREG_CTRL3 C3_SET; | ||
| 83 | C3_SET.Bits.C3_LRA_OPEN_LOOP = LRA_OPEN_LOOP; | ||
| 84 | C3_SET.Bits.C3_N_PWM_ANALOG = N_PWM_ANALOG; | ||
| 85 | C3_SET.Bits.C3_LRA_DRIVE_MODE = LRA_DRIVE_MODE; | ||
| 86 | C3_SET.Bits.C3_DATA_FORMAT_RTO = DATA_FORMAT_RTO; | ||
| 87 | C3_SET.Bits.C3_SUPPLY_COMP_DIS = SUPPLY_COMP_DIS; | ||
| 88 | C3_SET.Bits.C3_ERM_OPEN_LOOP = ERM_OPEN_LOOP; | ||
| 89 | C3_SET.Bits.C3_NG_THRESH = NG_THRESH; | ||
| 90 | drv2605l_write(DRV2605L_REG_CTRL3, (uint8_t)C3_SET.Byte); | ||
| 91 | |||
| 92 | DRVREG_CTRL4 C4_SET; | ||
| 93 | C4_SET.Bits.C4_ZC_DET_TIME = ZC_DET_TIME; | ||
| 94 | C4_SET.Bits.C4_AUTO_CAL_TIME = AUTO_CAL_TIME; | ||
| 95 | drv2605l_write(DRV2605L_REG_CTRL4, (uint8_t)C4_SET.Byte); | ||
| 96 | |||
| 97 | drv2605l_write(DRV2605L_REG_LIBRARY_SELECTION, DRV2605L_LIBRARY); | ||
| 98 | |||
| 99 | drv2605l_write(DRV2605L_REG_GO, 0x01); | ||
| 100 | |||
| 101 | /* 0x00 sets DRV2605 out of standby and to use internal trigger | ||
| 102 | * 0x01 sets DRV2605 out of standby and to use external trigger */ | ||
| 103 | drv2605l_write(DRV2605L_REG_MODE, 0x00); | ||
| 104 | |||
| 105 | // Play greeting sequence | ||
| 106 | drv2605l_write(DRV2605L_REG_GO, 0x00); | ||
| 107 | drv2605l_write(DRV2605L_REG_WAVEFORM_SEQUENCER_1, DRV2605L_GREETING); | ||
| 108 | drv2605l_write(DRV2605L_REG_GO, 0x01); | ||
| 109 | } | ||
| 110 | |||
| 111 | void drv2605l_rtp_init(void) { | ||
| 112 | drv2605l_write(DRV2605L_REG_GO, 0x00); | ||
| 113 | drv2605l_write(DRV2605L_REG_RTP_INPUT, 20); // 20 is the lowest value I've found where haptics can still be felt. | ||
| 114 | drv2605l_write(DRV2605L_REG_MODE, 0x05); | ||
| 115 | drv2605l_write(DRV2605L_REG_GO, 0x01); | ||
| 116 | } | ||
| 117 | |||
| 118 | void drv2605l_amplitude(uint8_t amplitude) { | ||
| 119 | drv2605l_write(DRV2605L_REG_RTP_INPUT, amplitude); | ||
| 120 | } | ||
| 121 | |||
| 122 | void drv2605l_pulse(uint8_t sequence) { | ||
| 123 | drv2605l_write(DRV2605L_REG_GO, 0x00); | ||
| 124 | drv2605l_write(DRV2605L_REG_WAVEFORM_SEQUENCER_1, sequence); | ||
| 125 | drv2605l_write(DRV2605L_REG_GO, 0x01); | ||
| 126 | } | ||
diff --git a/drivers/haptic/drv2605l.h b/drivers/haptic/drv2605l.h new file mode 100644 index 0000000000..796611edb6 --- /dev/null +++ b/drivers/haptic/drv2605l.h | |||
| @@ -0,0 +1,407 @@ | |||
| 1 | /* Copyright 2018 ishtob | ||
| 2 | * Driver for DRV2605L written for QMK | ||
| 3 | * | ||
| 4 | * This program is free software: you can redistribute it and/or modify | ||
| 5 | * it under the terms of the GNU General Public License as published by | ||
| 6 | * the Free Software Foundation, either version 2 of the License, or | ||
| 7 | * (at your option) any later version. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | * GNU General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License | ||
| 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #pragma once | ||
| 19 | |||
| 20 | #include <stdint.h> | ||
| 21 | |||
| 22 | /* Initialization settings | ||
| 23 | |||
| 24 | * Feedback Control Settings */ | ||
| 25 | #ifndef FB_ERM_LRA | ||
| 26 | # define FB_ERM_LRA 1 /* For ERM:0 or LRA:1*/ | ||
| 27 | #endif | ||
| 28 | #ifndef FB_BRAKEFACTOR | ||
| 29 | # define FB_BRAKEFACTOR 3 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */ | ||
| 30 | #endif | ||
| 31 | #ifndef FB_LOOPGAIN | ||
| 32 | # define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */ | ||
| 33 | #endif | ||
| 34 | |||
| 35 | /* LRA specific settings */ | ||
| 36 | #if FB_ERM_LRA == 1 | ||
| 37 | # ifndef V_RMS | ||
| 38 | # define V_RMS 2.0 | ||
| 39 | # endif | ||
| 40 | # ifndef V_PEAK | ||
| 41 | # define V_PEAK 2.1 | ||
| 42 | # endif | ||
| 43 | # ifndef F_LRA | ||
| 44 | # define F_LRA 205 | ||
| 45 | # endif | ||
| 46 | # ifndef RATED_VOLTAGE | ||
| 47 | # define RATED_VOLTAGE 2 /* 2v as safe range in case device voltage is not set */ | ||
| 48 | # endif | ||
| 49 | #endif | ||
| 50 | |||
| 51 | #ifndef RATED_VOLTAGE | ||
| 52 | # define RATED_VOLTAGE 2 /* 2v as safe range in case device voltage is not set */ | ||
| 53 | #endif | ||
| 54 | #ifndef V_PEAK | ||
| 55 | # define V_PEAK 2.8 | ||
| 56 | #endif | ||
| 57 | |||
| 58 | /* Library Selection */ | ||
| 59 | #ifndef DRV2605L_LIBRARY | ||
| 60 | # if FB_ERM_LRA == 1 | ||
| 61 | # define DRV2605L_LIBRARY 6 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */ | ||
| 62 | # else | ||
| 63 | # define DRV2605L_LIBRARY 1 | ||
| 64 | # endif | ||
| 65 | #endif | ||
| 66 | |||
| 67 | #ifndef DRV2605L_GREETING | ||
| 68 | # define DRV2605L_GREETING alert_750ms | ||
| 69 | #endif | ||
| 70 | #ifndef DRV2605L_DEFAULT_MODE | ||
| 71 | # define DRV2605L_DEFAULT_MODE strong_click1 | ||
| 72 | #endif | ||
| 73 | |||
| 74 | /* Control 1 register settings */ | ||
| 75 | #ifndef DRIVE_TIME | ||
| 76 | # define DRIVE_TIME 25 | ||
| 77 | #endif | ||
| 78 | #ifndef AC_COUPLE | ||
| 79 | # define AC_COUPLE 0 | ||
| 80 | #endif | ||
| 81 | #ifndef STARTUP_BOOST | ||
| 82 | # define STARTUP_BOOST 1 | ||
| 83 | #endif | ||
| 84 | |||
| 85 | /* Control 2 Settings */ | ||
| 86 | #ifndef BIDIR_INPUT | ||
| 87 | # define BIDIR_INPUT 1 | ||
| 88 | #endif | ||
| 89 | #ifndef BRAKE_STAB | ||
| 90 | # define BRAKE_STAB 1 /* Loopgain is reduced when braking is almost complete to improve stability */ | ||
| 91 | #endif | ||
| 92 | #ifndef SAMPLE_TIME | ||
| 93 | # define SAMPLE_TIME 3 | ||
| 94 | #endif | ||
| 95 | #ifndef BLANKING_TIME | ||
| 96 | # define BLANKING_TIME 1 | ||
| 97 | #endif | ||
| 98 | #ifndef IDISS_TIME | ||
| 99 | # define IDISS_TIME 1 | ||
| 100 | #endif | ||
| 101 | |||
| 102 | /* Control 3 settings */ | ||
| 103 | #ifndef NG_THRESH | ||
| 104 | # define NG_THRESH 2 | ||
| 105 | #endif | ||
| 106 | #ifndef ERM_OPEN_LOOP | ||
| 107 | # define ERM_OPEN_LOOP 1 | ||
| 108 | #endif | ||
| 109 | #ifndef SUPPLY_COMP_DIS | ||
| 110 | # define SUPPLY_COMP_DIS 0 | ||
| 111 | #endif | ||
| 112 | #ifndef DATA_FORMAT_RTO | ||
| 113 | # define DATA_FORMAT_RTO 0 | ||
| 114 | #endif | ||
| 115 | #ifndef LRA_DRIVE_MODE | ||
| 116 | # define LRA_DRIVE_MODE 0 | ||
| 117 | #endif | ||
| 118 | #ifndef N_PWM_ANALOG | ||
| 119 | # define N_PWM_ANALOG 0 | ||
| 120 | #endif | ||
| 121 | #ifndef LRA_OPEN_LOOP | ||
| 122 | # define LRA_OPEN_LOOP 0 | ||
| 123 | #endif | ||
| 124 | |||
| 125 | /* Control 4 settings */ | ||
| 126 | #ifndef ZC_DET_TIME | ||
| 127 | # define ZC_DET_TIME 0 | ||
| 128 | #endif | ||
| 129 | #ifndef AUTO_CAL_TIME | ||
| 130 | # define AUTO_CAL_TIME 3 | ||
| 131 | #endif | ||
| 132 | |||
| 133 | #define DRV2605L_I2C_ADDRESS 0x5A | ||
| 134 | |||
| 135 | #define DRV2605L_REG_STATUS 0x00 | ||
| 136 | #define DRV2605L_REG_MODE 0x01 | ||
| 137 | #define DRV2605L_REG_RTP_INPUT 0x02 | ||
| 138 | #define DRV2605L_REG_LIBRARY_SELECTION 0x03 | ||
| 139 | #define DRV2605L_REG_WAVEFORM_SEQUENCER_1 0x04 | ||
| 140 | #define DRV2605L_REG_WAVEFORM_SEQUENCER_2 0x05 | ||
| 141 | #define DRV2605L_REG_WAVEFORM_SEQUENCER_3 0x06 | ||
| 142 | #define DRV2605L_REG_WAVEFORM_SEQUENCER_4 0x07 | ||
| 143 | #define DRV2605L_REG_WAVEFORM_SEQUENCER_5 0x08 | ||
| 144 | #define DRV2605L_REG_WAVEFORM_SEQUENCER_6 0x09 | ||
| 145 | #define DRV2605L_REG_WAVEFORM_SEQUENCER_7 0x0A | ||
| 146 | #define DRV2605L_REG_WAVEFORM_SEQUENCER_8 0x0B | ||
| 147 | #define DRV2605L_REG_GO 0x0C | ||
| 148 | #define DRV2605L_REG_OVERDRIVE_TIME_OFFSET 0x0D | ||
| 149 | #define DRV2605L_REG_SUSTAIN_TIME_OFFSET_P 0x0E | ||
| 150 | #define DRV2605L_REG_SUSTAIN_TIME_OFFSET_N 0x0F | ||
| 151 | #define DRV2605L_REG_BRAKE_TIME_OFFSET 0x10 | ||
| 152 | #define DRV2605L_REG_AUDIO_TO_VIBE_CTRL 0x11 | ||
| 153 | #define DRV2605L_REG_AUDIO_TO_VIBE_MIN_INPUT 0x12 | ||
| 154 | #define DRV2605L_REG_AUDIO_TO_VIBE_MAX_INPUT 0x13 | ||
| 155 | #define DRV2605L_REG_AUDIO_TO_VIBE_MIN_OUTPUT_DRIVE 0x14 | ||
| 156 | #define DRV2605L_REG_AUDIO_TO_VIBE_MAX_OUTPUT_DRIVE 0x15 | ||
| 157 | #define DRV2605L_REG_RATED_VOLTAGE 0x16 | ||
| 158 | #define DRV2605L_REG_OVERDRIVE_CLAMP_VOLTAGE 0x17 | ||
| 159 | #define DRV2605L_REG_AUTO_CALIBRATION_COMPENSATION_RESULT 0x18 | ||
| 160 | #define DRV2605L_REG_AUTO_CALIBRATION_BACK_EMF_RESULT 0x19 | ||
| 161 | #define DRV2605L_REG_FEEDBACK_CTRL 0x1A | ||
| 162 | #define DRV2605L_REG_CTRL1 0x1B | ||
| 163 | #define DRV2605L_REG_CTRL2 0x1C | ||
| 164 | #define DRV2605L_REG_CTRL3 0x1D | ||
| 165 | #define DRV2605L_REG_CTRL4 0x1E | ||
| 166 | #define DRV2605L_REG_CTRL5 0x1F | ||
| 167 | #define DRV2605L_REG_LRA_OPEN_LOOP_PERIOD 0x20 | ||
| 168 | #define DRV2605L_REG_VBAT_VOLTAGE_MONITOR 0x21 | ||
| 169 | #define DRV2605L_REG_LRA_RESONANCE_PERIOD 0x22 | ||
| 170 | |||
| 171 | void drv2605l_init(void); | ||
| 172 | void drv2605l_write(const uint8_t reg_addr, const uint8_t data); | ||
| 173 | uint8_t drv2605l_read(const uint8_t reg_addr); | ||
| 174 | void drv2605l_rtp_init(void); | ||
| 175 | void drv2605l_amplitude(const uint8_t amplitude); | ||
| 176 | void drv2605l_pulse(const uint8_t sequence); | ||
| 177 | |||
| 178 | typedef enum DRV_EFFECT { | ||
| 179 | clear_sequence, | ||
| 180 | strong_click, | ||
| 181 | strong_click_60, | ||
| 182 | strong_click_30, | ||
| 183 | sharp_click, | ||
| 184 | sharp_click_60, | ||
| 185 | sharp_click_30, | ||
| 186 | soft_bump, | ||
| 187 | soft_bump_60, | ||
| 188 | soft_bump_30, | ||
| 189 | dbl_click, | ||
| 190 | dbl_click_60, | ||
| 191 | trp_click, | ||
| 192 | soft_fuzz, | ||
| 193 | strong_buzz, | ||
| 194 | alert_750ms, | ||
| 195 | alert_1000ms, | ||
| 196 | strong_click1, | ||
| 197 | strong_click2_80, | ||
| 198 | strong_click3_60, | ||
| 199 | strong_click4_30, | ||
| 200 | medium_click1, | ||
| 201 | medium_click2_80, | ||
| 202 | medium_click3_60, | ||
| 203 | sharp_tick1, | ||
| 204 | sharp_tick2_80, | ||
| 205 | sharp_tick3_60, | ||
| 206 | sh_dblclick_str, | ||
| 207 | sh_dblclick_str_80, | ||
| 208 | sh_dblclick_str_60, | ||
| 209 | sh_dblclick_str_30, | ||
| 210 | sh_dblclick_med, | ||
| 211 | sh_dblclick_med_80, | ||
| 212 | sh_dblclick_med_60, | ||
| 213 | sh_dblsharp_tick, | ||
| 214 | sh_dblsharp_tick_80, | ||
| 215 | sh_dblsharp_tick_60, | ||
| 216 | lg_dblclick_str, | ||
| 217 | lg_dblclick_str_80, | ||
| 218 | lg_dblclick_str_60, | ||
| 219 | lg_dblclick_str_30, | ||
| 220 | lg_dblclick_med, | ||
| 221 | lg_dblclick_med_80, | ||
| 222 | lg_dblclick_med_60, | ||
| 223 | lg_dblsharp_tick, | ||
| 224 | lg_dblsharp_tick_80, | ||
| 225 | lg_dblsharp_tick_60, | ||
| 226 | buzz, | ||
| 227 | buzz_80, | ||
| 228 | buzz_60, | ||
| 229 | buzz_40, | ||
| 230 | buzz_20, | ||
| 231 | pulsing_strong, | ||
| 232 | pulsing_strong_80, | ||
| 233 | pulsing_medium, | ||
| 234 | pulsing_medium_80, | ||
| 235 | pulsing_sharp, | ||
| 236 | pulsing_sharp_80, | ||
| 237 | transition_click, | ||
| 238 | transition_click_80, | ||
| 239 | transition_click_60, | ||
| 240 | transition_click_40, | ||
| 241 | transition_click_20, | ||
| 242 | transition_click_10, | ||
| 243 | transition_hum, | ||
| 244 | transition_hum_80, | ||
| 245 | transition_hum_60, | ||
| 246 | transition_hum_40, | ||
| 247 | transition_hum_20, | ||
| 248 | transition_hum_10, | ||
| 249 | transition_rampdown_long_smooth1, | ||
| 250 | transition_rampdown_long_smooth2, | ||
| 251 | transition_rampdown_med_smooth1, | ||
| 252 | transition_rampdown_med_smooth2, | ||
| 253 | transition_rampdown_short_smooth1, | ||
| 254 | transition_rampdown_short_smooth2, | ||
| 255 | transition_rampdown_long_sharp1, | ||
| 256 | transition_rampdown_long_sharp2, | ||
| 257 | transition_rampdown_med_sharp1, | ||
| 258 | transition_rampdown_med_sharp2, | ||
| 259 | transition_rampdown_short_sharp1, | ||
| 260 | transition_rampdown_short_sharp2, | ||
| 261 | transition_rampup_long_smooth1, | ||
| 262 | transition_rampup_long_smooth2, | ||
| 263 | transition_rampup_med_smooth1, | ||
| 264 | transition_rampup_med_smooth2, | ||
| 265 | transition_rampup_short_smooth1, | ||
| 266 | transition_rampup_short_smooth2, | ||
| 267 | transition_rampup_long_sharp1, | ||
| 268 | transition_rampup_long_sharp2, | ||
| 269 | transition_rampup_med_sharp1, | ||
| 270 | transition_rampup_med_sharp2, | ||
| 271 | transition_rampup_short_sharp1, | ||
| 272 | transition_rampup_short_sharp2, | ||
| 273 | transition_rampdown_long_smooth1_50, | ||
| 274 | transition_rampdown_long_smooth2_50, | ||
| 275 | transition_rampdown_med_smooth1_50, | ||
| 276 | transition_rampdown_med_smooth2_50, | ||
| 277 | transition_rampdown_short_smooth1_50, | ||
| 278 | transition_rampdown_short_smooth2_50, | ||
| 279 | transition_rampdown_long_sharp1_50, | ||
| 280 | transition_rampdown_long_sharp2_50, | ||
| 281 | transition_rampdown_med_sharp1_50, | ||
| 282 | transition_rampdown_med_sharp2_50, | ||
| 283 | transition_rampdown_short_sharp1_50, | ||
| 284 | transition_rampdown_short_sharp2_50, | ||
| 285 | transition_rampup_long_smooth1_50, | ||
| 286 | transition_rampup_long_smooth2_50, | ||
| 287 | transition_rampup_med_smooth1_50, | ||
| 288 | transition_rampup_med_smooth2_50, | ||
| 289 | transition_rampup_short_smooth1_50, | ||
| 290 | transition_rampup_short_smooth2_50, | ||
| 291 | transition_rampup_long_sharp1_50, | ||
| 292 | transition_rampup_long_sharp2_50, | ||
| 293 | transition_rampup_med_sharp1_50, | ||
| 294 | transition_rampup_med_sharp2_50, | ||
| 295 | transition_rampup_short_sharp1_50, | ||
| 296 | transition_rampup_short_sharp2_50, | ||
| 297 | long_buzz_for_programmatic_stopping, | ||
| 298 | smooth_hum1_50, | ||
| 299 | smooth_hum2_40, | ||
| 300 | smooth_hum3_30, | ||
| 301 | smooth_hum4_20, | ||
| 302 | smooth_hum5_10, | ||
| 303 | drv_effect_max | ||
| 304 | } DRV_EFFECT; | ||
| 305 | |||
| 306 | /* Register bit array unions */ | ||
| 307 | |||
| 308 | typedef union DRVREG_STATUS { /* register 0x00 */ | ||
| 309 | uint8_t Byte; | ||
| 310 | struct { | ||
| 311 | uint8_t OC_DETECT : 1; /* set to 1 when overcurrent event is detected */ | ||
| 312 | uint8_t OVER_TEMP : 1; /* set to 1 when device exceeds temp threshold */ | ||
| 313 | uint8_t FB_STS : 1; /* set to 1 when feedback controller has timed out */ | ||
| 314 | /* auto-calibration routine and diagnostic result | ||
| 315 | * result | auto-calibation | diagnostic | | ||
| 316 | * 0 | passed | actuator func normal | | ||
| 317 | * 1 | failed | actuator func fault* | | ||
| 318 | * * actuator is not present or is shorted, timing out, or giving out–of-range back-EMF */ | ||
| 319 | uint8_t DIAG_RESULT : 1; | ||
| 320 | uint8_t : 1; | ||
| 321 | uint8_t DEVICE_ID : 3; /* Device IDs 3: DRV2605 4: DRV2604 5: DRV2604L 6: DRV2605L */ | ||
| 322 | } Bits; | ||
| 323 | } DRVREG_STATUS; | ||
| 324 | |||
| 325 | typedef union DRVREG_MODE { /* register 0x01 */ | ||
| 326 | uint8_t Byte; | ||
| 327 | struct { | ||
| 328 | uint8_t MODE : 3; /* Mode setting */ | ||
| 329 | uint8_t : 3; | ||
| 330 | uint8_t STANDBY : 1; /* 0:standby 1:ready */ | ||
| 331 | } Bits; | ||
| 332 | } DRVREG_MODE; | ||
| 333 | |||
| 334 | typedef union DRVREG_WAIT { | ||
| 335 | uint8_t Byte; | ||
| 336 | struct { | ||
| 337 | uint8_t WAIT_MODE : 1; /* Set to 1 to interpret as wait for next 7 bits x10ms */ | ||
| 338 | uint8_t WAIT_TIME : 7; | ||
| 339 | } Bits; | ||
| 340 | } DRVREG_WAIT; | ||
| 341 | |||
| 342 | typedef union DRVREG_FBR { /* register 0x1A */ | ||
| 343 | uint8_t Byte; | ||
| 344 | struct { | ||
| 345 | uint8_t BEMF_GAIN : 2; | ||
| 346 | uint8_t LOOP_GAIN : 2; | ||
| 347 | uint8_t BRAKE_FACTOR : 3; | ||
| 348 | uint8_t ERM_LRA : 1; | ||
| 349 | } Bits; | ||
| 350 | } DRVREG_FBR; | ||
| 351 | |||
| 352 | typedef union DRVREG_CTRL1 { /* register 0x1B */ | ||
| 353 | uint8_t Byte; | ||
| 354 | struct { | ||
| 355 | uint8_t C1_DRIVE_TIME : 5; | ||
| 356 | uint8_t C1_AC_COUPLE : 1; | ||
| 357 | uint8_t : 1; | ||
| 358 | uint8_t C1_STARTUP_BOOST : 1; | ||
| 359 | } Bits; | ||
| 360 | } DRVREG_CTRL1; | ||
| 361 | |||
| 362 | typedef union DRVREG_CTRL2 { /* register 0x1C */ | ||
| 363 | uint8_t Byte; | ||
| 364 | struct { | ||
| 365 | uint8_t C2_IDISS_TIME : 2; | ||
| 366 | uint8_t C2_BLANKING_TIME : 2; | ||
| 367 | uint8_t C2_SAMPLE_TIME : 2; | ||
| 368 | uint8_t C2_BRAKE_STAB : 1; | ||
| 369 | uint8_t C2_BIDIR_INPUT : 1; | ||
| 370 | } Bits; | ||
| 371 | } DRVREG_CTRL2; | ||
| 372 | |||
| 373 | typedef union DRVREG_CTRL3 { /* register 0x1D */ | ||
| 374 | uint8_t Byte; | ||
| 375 | struct { | ||
| 376 | uint8_t C3_LRA_OPEN_LOOP : 1; | ||
| 377 | uint8_t C3_N_PWM_ANALOG : 1; | ||
| 378 | uint8_t C3_LRA_DRIVE_MODE : 1; | ||
| 379 | uint8_t C3_DATA_FORMAT_RTO : 1; | ||
| 380 | uint8_t C3_SUPPLY_COMP_DIS : 1; | ||
| 381 | uint8_t C3_ERM_OPEN_LOOP : 1; | ||
| 382 | uint8_t C3_NG_THRESH : 2; | ||
| 383 | } Bits; | ||
| 384 | } DRVREG_CTRL3; | ||
| 385 | |||
| 386 | typedef union DRVREG_CTRL4 { /* register 0x1E */ | ||
| 387 | uint8_t Byte; | ||
| 388 | struct { | ||
| 389 | uint8_t C4_OTP_PROGRAM : 1; | ||
| 390 | uint8_t : 1; | ||
| 391 | uint8_t C4_OTP_STATUS : 1; | ||
| 392 | uint8_t : 1; | ||
| 393 | uint8_t C4_AUTO_CAL_TIME : 2; | ||
| 394 | uint8_t C4_ZC_DET_TIME : 2; | ||
| 395 | } Bits; | ||
| 396 | } DRVREG_CTRL4; | ||
| 397 | |||
| 398 | typedef union DRVREG_CTRL5 { /* register 0x1F */ | ||
| 399 | uint8_t Byte; | ||
| 400 | struct { | ||
| 401 | uint8_t C5_IDISS_TIME : 2; | ||
| 402 | uint8_t C5_BLANKING_TIME : 2; | ||
| 403 | uint8_t C5_PLAYBACK_INTERVAL : 1; | ||
| 404 | uint8_t C5_LRA_AUTO_OPEN_LOOP : 1; | ||
| 405 | uint8_t C5_AUTO_OL_CNT : 2; | ||
| 406 | } Bits; | ||
| 407 | } DRVREG_CTRL5; | ||
diff --git a/keyboards/adpenrose/mine/keymaps/solenoid/rules.mk b/keyboards/adpenrose/mine/keymaps/solenoid/rules.mk index 2a1e874d82..345c10cdd4 100644 --- a/keyboards/adpenrose/mine/keymaps/solenoid/rules.mk +++ b/keyboards/adpenrose/mine/keymaps/solenoid/rules.mk | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | VIA_ENABLE = yes | 1 | VIA_ENABLE = yes |
| 2 | HAPTIC_ENABLE = yes | 2 | HAPTIC_ENABLE = yes |
| 3 | HAPTIC_DRIVER += SOLENOID | 3 | HAPTIC_DRIVER = solenoid |
| 4 | ENCODER_MAP_ENABLE = yes # Encoder mapping functionality \ No newline at end of file | 4 | ENCODER_MAP_ENABLE = yes # Encoder mapping functionality \ No newline at end of file |
diff --git a/keyboards/adpenrose/shisaku/keymaps/solenoid/rules.mk b/keyboards/adpenrose/shisaku/keymaps/solenoid/rules.mk index e13f2bd035..6bec144827 100644 --- a/keyboards/adpenrose/shisaku/keymaps/solenoid/rules.mk +++ b/keyboards/adpenrose/shisaku/keymaps/solenoid/rules.mk | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | VIA_ENABLE = yes | 1 | VIA_ENABLE = yes |
| 2 | LTO_ENABLE = yes | 2 | LTO_ENABLE = yes |
| 3 | HAPTIC_ENABLE = yes | 3 | HAPTIC_ENABLE = yes |
| 4 | HAPTIC_DRIVER += SOLENOID \ No newline at end of file | 4 | HAPTIC_DRIVER = solenoid \ No newline at end of file |
diff --git a/keyboards/ai03/lunar_ii/rules.mk b/keyboards/ai03/lunar_ii/rules.mk index 1448dc35c3..7ad594e1f9 100644 --- a/keyboards/ai03/lunar_ii/rules.mk +++ b/keyboards/ai03/lunar_ii/rules.mk | |||
| @@ -12,4 +12,4 @@ RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow | |||
| 12 | AUDIO_ENABLE = no # Audio output | 12 | AUDIO_ENABLE = no # Audio output |
| 13 | 13 | ||
| 14 | HAPTIC_ENABLE = yes # Enable solenoid support | 14 | HAPTIC_ENABLE = yes # Enable solenoid support |
| 15 | HAPTIC_DRIVER += SOLENOID | 15 | HAPTIC_DRIVER = solenoid |
diff --git a/keyboards/boston_meetup/2019/config.h b/keyboards/boston_meetup/2019/config.h index 4ed063f738..d8888eb92f 100644 --- a/keyboards/boston_meetup/2019/config.h +++ b/keyboards/boston_meetup/2019/config.h | |||
| @@ -48,7 +48,7 @@ | |||
| 48 | #define V_RMS 2.3 | 48 | #define V_RMS 2.3 |
| 49 | #define V_PEAK 3.30 | 49 | #define V_PEAK 3.30 |
| 50 | /* Library Selection */ | 50 | /* Library Selection */ |
| 51 | #define LIB_SELECTION 4 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */ | 51 | #define DRV2605L_LIBRARY 4 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */ |
| 52 | 52 | ||
| 53 | /* default 2V LRA voltage and library */ | 53 | /* default 2V LRA voltage and library */ |
| 54 | #elif FB_ERM_LRA == 1 | 54 | #elif FB_ERM_LRA == 1 |
| @@ -57,7 +57,7 @@ | |||
| 57 | #define V_PEAK 2.85 | 57 | #define V_PEAK 2.85 |
| 58 | #define F_LRA 200 | 58 | #define F_LRA 200 |
| 59 | /* Library Selection */ | 59 | /* Library Selection */ |
| 60 | #define LIB_SELECTION 6 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */ | 60 | #define DRV2605L_LIBRARY 6 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */ |
| 61 | 61 | ||
| 62 | #endif | 62 | #endif |
| 63 | 63 | ||
diff --git a/keyboards/boston_meetup/2019/rules.mk b/keyboards/boston_meetup/2019/rules.mk index b2f1131ffd..777d555b2d 100644 --- a/keyboards/boston_meetup/2019/rules.mk +++ b/keyboards/boston_meetup/2019/rules.mk | |||
| @@ -12,6 +12,6 @@ AUDIO_ENABLE = yes # Audio output | |||
| 12 | RGBLIGHT_ENABLE = no | 12 | RGBLIGHT_ENABLE = no |
| 13 | RGB_MATRIX_ENABLE = no | 13 | RGB_MATRIX_ENABLE = no |
| 14 | HAPTIC_ENABLE = yes | 14 | HAPTIC_ENABLE = yes |
| 15 | HAPTIC_DRIVER = DRV2605L | 15 | HAPTIC_DRIVER = drv2605l |
| 16 | OLED_ENABLE = yes | 16 | OLED_ENABLE = yes |
| 17 | OLED_DRIVER = SSD1306 | 17 | OLED_DRIVER = SSD1306 |
diff --git a/keyboards/buzzard/keymaps/crehmann/config.h b/keyboards/buzzard/keymaps/crehmann/config.h index 181396ad26..ee3192e3fd 100644 --- a/keyboards/buzzard/keymaps/crehmann/config.h +++ b/keyboards/buzzard/keymaps/crehmann/config.h | |||
| @@ -25,8 +25,8 @@ | |||
| 25 | #define NO_HAPTIC_PUNCTUATION | 25 | #define NO_HAPTIC_PUNCTUATION |
| 26 | #define NO_HAPTIC_NAV | 26 | #define NO_HAPTIC_NAV |
| 27 | #define NO_HAPTIC_NUMERIC | 27 | #define NO_HAPTIC_NUMERIC |
| 28 | #define DRV_GREETING alert_750ms | 28 | #define DRV2605L_GREETING alert_750ms |
| 29 | #define DRV_MODE_DEFAULT sharp_tick1 | 29 | #define DRV2605L_DEFAULT_MODE sharp_tick1 |
| 30 | #endif | 30 | #endif |
| 31 | 31 | ||
| 32 | #ifdef PS2_MOUSE_ENABLE | 32 | #ifdef PS2_MOUSE_ENABLE |
diff --git a/keyboards/buzzard/keymaps/crehmann/features/haptic_utils.c b/keyboards/buzzard/keymaps/crehmann/features/haptic_utils.c index 37fa2902c5..8f5aa0e662 100644 --- a/keyboards/buzzard/keymaps/crehmann/features/haptic_utils.c +++ b/keyboards/buzzard/keymaps/crehmann/features/haptic_utils.c | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | #include "haptic_utils.h" | 4 | #include "haptic_utils.h" |
| 5 | 5 | ||
| 6 | #ifdef HAPTIC_ENABLE | 6 | #ifdef HAPTIC_ENABLE |
| 7 | #include "drivers/haptic/DRV2605L.h" | 7 | #include "drivers/haptic/drv2605l.h" |
| 8 | #endif | 8 | #endif |
| 9 | 9 | ||
| 10 | #ifdef HAPTIC_ENABLE | 10 | #ifdef HAPTIC_ENABLE |
| @@ -23,19 +23,19 @@ void process_layer_pulse(layer_state_t state) { | |||
| 23 | #ifdef HAPTIC_ENABLE | 23 | #ifdef HAPTIC_ENABLE |
| 24 | switch (get_highest_layer(state)) { | 24 | switch (get_highest_layer(state)) { |
| 25 | case 1: | 25 | case 1: |
| 26 | DRV_pulse(soft_bump); | 26 | drv2605l_pulse(soft_bump); |
| 27 | break; | 27 | break; |
| 28 | case 2: | 28 | case 2: |
| 29 | DRV_pulse(sh_dblsharp_tick); | 29 | drv2605l_pulse(sh_dblsharp_tick); |
| 30 | break; | 30 | break; |
| 31 | case 3: | 31 | case 3: |
| 32 | DRV_pulse(lg_dblclick_str); | 32 | drv2605l_pulse(lg_dblclick_str); |
| 33 | break; | 33 | break; |
| 34 | case 4: | 34 | case 4: |
| 35 | DRV_pulse(soft_bump); | 35 | drv2605l_pulse(soft_bump); |
| 36 | break; | 36 | break; |
| 37 | case 5: | 37 | case 5: |
| 38 | DRV_pulse(pulsing_sharp); | 38 | drv2605l_pulse(pulsing_sharp); |
| 39 | break; | 39 | break; |
| 40 | } | 40 | } |
| 41 | #endif | 41 | #endif |
diff --git a/keyboards/buzzard/keymaps/crehmann/rules.mk b/keyboards/buzzard/keymaps/crehmann/rules.mk index 484e7d84a6..98a83af549 100644 --- a/keyboards/buzzard/keymaps/crehmann/rules.mk +++ b/keyboards/buzzard/keymaps/crehmann/rules.mk | |||
| @@ -3,7 +3,7 @@ SRC += features/haptic_utils.c | |||
| 3 | OLED_ENABLE = yes | 3 | OLED_ENABLE = yes |
| 4 | 4 | ||
| 5 | HAPTIC_ENABLE = yes | 5 | HAPTIC_ENABLE = yes |
| 6 | HAPTIC_DRIVER = DRV2605L | 6 | HAPTIC_DRIVER = drv2605l |
| 7 | 7 | ||
| 8 | PS2_MOUSE_ENABLE = yes | 8 | PS2_MOUSE_ENABLE = yes |
| 9 | MOUSEKEY_ENABLE = yes | 9 | MOUSEKEY_ENABLE = yes |
diff --git a/keyboards/buzzard/keymaps/default/config.h b/keyboards/buzzard/keymaps/default/config.h index 2a42e17d0c..d5bf3e4dc6 100644 --- a/keyboards/buzzard/keymaps/default/config.h +++ b/keyboards/buzzard/keymaps/default/config.h | |||
| @@ -25,8 +25,8 @@ | |||
| 25 | #define NO_HAPTIC_PUNCTUATION | 25 | #define NO_HAPTIC_PUNCTUATION |
| 26 | #define NO_HAPTIC_NAV | 26 | #define NO_HAPTIC_NAV |
| 27 | #define NO_HAPTIC_NUMERIC | 27 | #define NO_HAPTIC_NUMERIC |
| 28 | #define DRV_GREETING alert_750ms | 28 | #define DRV2605L_GREETING alert_750ms |
| 29 | #define DRV_MODE_DEFAULT sharp_tick1 | 29 | #define DRV2605L_DEFAULT_MODE sharp_tick1 |
| 30 | #endif | 30 | #endif |
| 31 | 31 | ||
| 32 | 32 | ||
diff --git a/keyboards/buzzard/keymaps/default/rules.mk b/keyboards/buzzard/keymaps/default/rules.mk index e8124aebb9..46728f3803 100644 --- a/keyboards/buzzard/keymaps/default/rules.mk +++ b/keyboards/buzzard/keymaps/default/rules.mk | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | OLED_ENABLE = yes # uncomment if you are using an OLED display | 1 | OLED_ENABLE = yes # uncomment if you are using an OLED display |
| 2 | 2 | ||
| 3 | #HAPTIC_ENABLE = yes # uncomment only on the master side if you are using a Pimoroni haptic buzz | 3 | #HAPTIC_ENABLE = yes # uncomment only on the master side if you are using a Pimoroni haptic buzz |
| 4 | #HAPTIC_DRIVER = DRV2605L # uncomment only on the master side if you are using a Pimoroni haptic buzz | 4 | #HAPTIC_DRIVER = drv2605l # uncomment only on the master side if you are using a Pimoroni haptic buzz |
| 5 | 5 | ||
| 6 | #PS2_MOUSE_ENABLE = yes # uncomment only on the master side if you are usin a TrackPoint | 6 | #PS2_MOUSE_ENABLE = yes # uncomment only on the master side if you are usin a TrackPoint |
| 7 | MOUSEKEY_ENABLE = yes \ No newline at end of file | 7 | MOUSEKEY_ENABLE = yes \ No newline at end of file |
diff --git a/keyboards/buzzard/rev1/rev1.c b/keyboards/buzzard/rev1/rev1.c index c6cdc66187..c26e4d5831 100644 --- a/keyboards/buzzard/rev1/rev1.c +++ b/keyboards/buzzard/rev1/rev1.c | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | #include "quantum.h" | 3 | #include "quantum.h" |
| 4 | 4 | ||
| 5 | #ifdef HAPTIC_ENABLE | 5 | #ifdef HAPTIC_ENABLE |
| 6 | #include "drivers/haptic/DRV2605L.h" | 6 | #include "drivers/haptic/drv2605l.h" |
| 7 | #endif | 7 | #endif |
| 8 | 8 | ||
| 9 | #ifdef SWAP_HANDS_ENABLE | 9 | #ifdef SWAP_HANDS_ENABLE |
| @@ -100,27 +100,27 @@ __attribute__((weak)) layer_state_t layer_state_set_user(layer_state_t state) { | |||
| 100 | switch (get_highest_layer(state)) { | 100 | switch (get_highest_layer(state)) { |
| 101 | case 1: | 101 | case 1: |
| 102 | #ifdef HAPTIC_ENABLE | 102 | #ifdef HAPTIC_ENABLE |
| 103 | DRV_pulse(soft_bump); | 103 | drv2605l_pulse(soft_bump); |
| 104 | #endif | 104 | #endif |
| 105 | break; | 105 | break; |
| 106 | case 2: | 106 | case 2: |
| 107 | #ifdef HAPTIC_ENABLE | 107 | #ifdef HAPTIC_ENABLE |
| 108 | DRV_pulse(sh_dblsharp_tick); | 108 | drv2605l_pulse(sh_dblsharp_tick); |
| 109 | #endif | 109 | #endif |
| 110 | break; | 110 | break; |
| 111 | case 3: | 111 | case 3: |
| 112 | #ifdef HAPTIC_ENABLE | 112 | #ifdef HAPTIC_ENABLE |
| 113 | DRV_pulse(lg_dblclick_str); | 113 | drv2605l_pulse(lg_dblclick_str); |
| 114 | #endif | 114 | #endif |
| 115 | break; | 115 | break; |
| 116 | case 4: | 116 | case 4: |
| 117 | #ifdef HAPTIC_ENABLE | 117 | #ifdef HAPTIC_ENABLE |
| 118 | DRV_pulse(soft_bump); | 118 | drv2605l_pulse(soft_bump); |
| 119 | #endif | 119 | #endif |
| 120 | break; | 120 | break; |
| 121 | case 5: | 121 | case 5: |
| 122 | #ifdef HAPTIC_ENABLE | 122 | #ifdef HAPTIC_ENABLE |
| 123 | DRV_pulse(pulsing_sharp); | 123 | drv2605l_pulse(pulsing_sharp); |
| 124 | #endif | 124 | #endif |
| 125 | break; | 125 | break; |
| 126 | } | 126 | } |
diff --git a/keyboards/hadron/ver3/config.h b/keyboards/hadron/ver3/config.h index be315e668a..675bd218f0 100644 --- a/keyboards/hadron/ver3/config.h +++ b/keyboards/hadron/ver3/config.h | |||
| @@ -70,7 +70,7 @@ | |||
| 70 | #define V_RMS 2.3 | 70 | #define V_RMS 2.3 |
| 71 | #define V_PEAK 3.30 | 71 | #define V_PEAK 3.30 |
| 72 | /* Library Selection */ | 72 | /* Library Selection */ |
| 73 | #define LIB_SELECTION 4 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */ | 73 | #define DRV2605L_LIBRARY 4 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */ |
| 74 | 74 | ||
| 75 | /* default 2V LRA voltage and library */ | 75 | /* default 2V LRA voltage and library */ |
| 76 | #elif FB_ERM_LRA == 1 | 76 | #elif FB_ERM_LRA == 1 |
| @@ -79,7 +79,7 @@ | |||
| 79 | #define V_PEAK 2.85 | 79 | #define V_PEAK 2.85 |
| 80 | #define F_LRA 200 | 80 | #define F_LRA 200 |
| 81 | /* Library Selection */ | 81 | /* Library Selection */ |
| 82 | #define LIB_SELECTION 6 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */ | 82 | #define DRV2605L_LIBRARY 6 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */ |
| 83 | 83 | ||
| 84 | #endif | 84 | #endif |
| 85 | 85 | ||
diff --git a/keyboards/hadron/ver3/keymaps/ishtob/config.h b/keyboards/hadron/ver3/keymaps/ishtob/config.h deleted file mode 100644 index 6f70f09bee..0000000000 --- a/keyboards/hadron/ver3/keymaps/ishtob/config.h +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | #pragma once | ||
diff --git a/keyboards/hadron/ver3/keymaps/ishtob/keymap.c b/keyboards/hadron/ver3/keymaps/ishtob/keymap.c index e99ff55caf..a3b522fa04 100644 --- a/keyboards/hadron/ver3/keymaps/ishtob/keymap.c +++ b/keyboards/hadron/ver3/keymaps/ishtob/keymap.c | |||
| @@ -239,12 +239,3 @@ bool music_mask_user(uint16_t keycode) { | |||
| 239 | return true; | 239 | return true; |
| 240 | } | 240 | } |
| 241 | } | 241 | } |
| 242 | |||
| 243 | |||
| 244 | void matrix_init_keymap(void) { | ||
| 245 | } | ||
| 246 | |||
| 247 | |||
| 248 | void matrix_scan_keymap(void) { | ||
| 249 | } | ||
| 250 | |||
diff --git a/keyboards/hadron/ver3/rules.mk b/keyboards/hadron/ver3/rules.mk index 5739e57d19..887fbcbfeb 100644 --- a/keyboards/hadron/ver3/rules.mk +++ b/keyboards/hadron/ver3/rules.mk | |||
| @@ -12,7 +12,7 @@ AUDIO_ENABLE = yes | |||
| 12 | RGBLIGHT_ENABLE = yes | 12 | RGBLIGHT_ENABLE = yes |
| 13 | RGB_MATRIX_ENABLE = no # once arm_rgb is implemented | 13 | RGB_MATRIX_ENABLE = no # once arm_rgb is implemented |
| 14 | HAPTIC_ENABLE = yes | 14 | HAPTIC_ENABLE = yes |
| 15 | HAPTIC_DRIVER = DRV2605L | 15 | HAPTIC_DRIVER = drv2605l |
| 16 | OLED_ENABLE = yes | 16 | OLED_ENABLE = yes |
| 17 | OLED_DRIVER = SSD1306 | 17 | OLED_DRIVER = SSD1306 |
| 18 | ENCODER_ENABLER = yes | 18 | ENCODER_ENABLER = yes |
diff --git a/keyboards/handwired/onekey/keymaps/haptic/rules.mk b/keyboards/handwired/onekey/keymaps/haptic/rules.mk index 802f7e5dde..05201736e6 100644 --- a/keyboards/handwired/onekey/keymaps/haptic/rules.mk +++ b/keyboards/handwired/onekey/keymaps/haptic/rules.mk | |||
| @@ -1,2 +1,2 @@ | |||
| 1 | HAPTIC_ENABLE = yes | 1 | HAPTIC_ENABLE = yes |
| 2 | HAPTIC_DRIVER = SOLENOID | 2 | HAPTIC_DRIVER = solenoid |
diff --git a/keyboards/handwired/swiftrax/bumblebee/keymaps/default/rules.mk b/keyboards/handwired/swiftrax/bumblebee/keymaps/default/rules.mk index 9c6098640a..ef72559a0c 100644 --- a/keyboards/handwired/swiftrax/bumblebee/keymaps/default/rules.mk +++ b/keyboards/handwired/swiftrax/bumblebee/keymaps/default/rules.mk | |||
| @@ -1,2 +1 @@ | |||
| 1 | AUDIO_ENABLE = yes | AUDIO_ENABLE = yes | |
| 2 | HAPTIC_ENABLE += SOLENOID \ No newline at end of file | ||
diff --git a/keyboards/handwired/swiftrax/bumblebee/keymaps/via/rules.mk b/keyboards/handwired/swiftrax/bumblebee/keymaps/via/rules.mk index 8c797e4309..1e79dbce26 100644 --- a/keyboards/handwired/swiftrax/bumblebee/keymaps/via/rules.mk +++ b/keyboards/handwired/swiftrax/bumblebee/keymaps/via/rules.mk | |||
| @@ -1,5 +1,4 @@ | |||
| 1 | VIA_ENABLE = yes | 1 | VIA_ENABLE = yes |
| 2 | #HAPTIC_ENABLE += SOLENOID | ||
| 3 | AUDIO_ENABLE = yes | 2 | AUDIO_ENABLE = yes |
| 4 | #either solenoid or audio not both can be enabled | 3 | #either solenoid or audio not both can be enabled |
| 5 | LTO_ENABLE = yes | 4 | LTO_ENABLE = yes |
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/config.h b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/config.h index a449a126d6..913c613c98 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/config.h +++ b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/config.h | |||
| @@ -32,5 +32,5 @@ | |||
| 32 | 32 | ||
| 33 | 33 | ||
| 34 | #define FB_ERM_LRA 0 | 34 | #define FB_ERM_LRA 0 |
| 35 | #define DRV_GREETING alert_750ms | 35 | #define DRV2605L_GREETING alert_750ms |
| 36 | #define DRV_MODE_DEFAULT buzz | 36 | #define DRV2605L_DEFAULT_MODE buzz |
diff --git a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk index 9f5341e973..1cf7a3fccf 100644 --- a/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk +++ b/keyboards/handwired/tractyl_manuform/5x6_right/keymaps/drashna/rules.mk | |||
| @@ -35,7 +35,7 @@ ifeq ($(strip $(KEYBOARD)), handwired/tractyl_manuform/5x6_right/f411) | |||
| 35 | LTO_SUPPORTED = no | 35 | LTO_SUPPORTED = no |
| 36 | OVERLOAD_FEATURES = yes | 36 | OVERLOAD_FEATURES = yes |
| 37 | HAPTIC_ENABLE = yes | 37 | HAPTIC_ENABLE = yes |
| 38 | HAPTIC_DRIVER = DRV2605L | 38 | HAPTIC_DRIVER = drv2605l |
| 39 | endif | 39 | endif |
| 40 | 40 | ||
| 41 | ifeq ($(strip $(OVERLOAD_FEATURES)), yes) | 41 | ifeq ($(strip $(OVERLOAD_FEATURES)), yes) |
diff --git a/keyboards/hardwareabstraction/handwire/rules.mk b/keyboards/hardwareabstraction/handwire/rules.mk index d782fba2a8..ede296e1e8 100644 --- a/keyboards/hardwareabstraction/handwire/rules.mk +++ b/keyboards/hardwareabstraction/handwire/rules.mk | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | LTO_ENABLE = yes | 1 | LTO_ENABLE = yes |
| 2 | HAPTIC_ENABLE = yes | 2 | HAPTIC_ENABLE = yes |
| 3 | HAPTIC_DRIVER += SOLENOID | 3 | HAPTIC_DRIVER = solenoid |
| 4 | 4 | ||
| 5 | OLED_ENABLE = yes | 5 | OLED_ENABLE = yes |
| 6 | OLED_DRIVER = SSD1306 | 6 | OLED_DRIVER = SSD1306 |
diff --git a/keyboards/hillside/46/0_1/config.h b/keyboards/hillside/46/0_1/config.h index 55395dd407..dc8654b4bb 100644 --- a/keyboards/hillside/46/0_1/config.h +++ b/keyboards/hillside/46/0_1/config.h | |||
| @@ -21,5 +21,5 @@ | |||
| 21 | 21 | ||
| 22 | /* Haptic waveforms */ | 22 | /* Haptic waveforms */ |
| 23 | // Two mild waveforms | 23 | // Two mild waveforms |
| 24 | #define DRV_GREETING alert_750ms | 24 | #define DRV2605L_GREETING alert_750ms |
| 25 | #define DRV_MODE_DEFAULT sharp_tick3_60 | 25 | #define DRV2605L_DEFAULT_MODE sharp_tick3_60 |
diff --git a/keyboards/hillside/46/0_1/rules.mk b/keyboards/hillside/46/0_1/rules.mk index 2501147ea8..3c12e55b58 100644 --- a/keyboards/hillside/46/0_1/rules.mk +++ b/keyboards/hillside/46/0_1/rules.mk | |||
| @@ -5,4 +5,4 @@ LTO_ENABLE = yes # Use link time optimization for smaller firmware | |||
| 5 | # enable it and set its driver here or in your keymap folder | 5 | # enable it and set its driver here or in your keymap folder |
| 6 | # The Pimoroni board's driver is DRV2605L | 6 | # The Pimoroni board's driver is DRV2605L |
| 7 | # HAPTIC_ENABLE = yes # Enable haptic driver | 7 | # HAPTIC_ENABLE = yes # Enable haptic driver |
| 8 | # HAPTIC_DRIVER = DRV2605L | 8 | # HAPTIC_DRIVER = drv2605l |
diff --git a/keyboards/hillside/48/0_1/config.h b/keyboards/hillside/48/0_1/config.h index dc642c1193..3b432cf17b 100644 --- a/keyboards/hillside/48/0_1/config.h +++ b/keyboards/hillside/48/0_1/config.h | |||
| @@ -16,5 +16,5 @@ | |||
| 16 | 16 | ||
| 17 | /* Haptic waveforms */ | 17 | /* Haptic waveforms */ |
| 18 | // Two mild waveforms | 18 | // Two mild waveforms |
| 19 | #define DRV_GREETING alert_750ms | 19 | #define DRV2605L_GREETING alert_750ms |
| 20 | #define DRV_MODE_DEFAULT sharp_tick3_60 | 20 | #define DRV2605L_DEFAULT_MODE sharp_tick3_60 |
diff --git a/keyboards/hillside/48/0_1/rules.mk b/keyboards/hillside/48/0_1/rules.mk index 2501147ea8..3c12e55b58 100644 --- a/keyboards/hillside/48/0_1/rules.mk +++ b/keyboards/hillside/48/0_1/rules.mk | |||
| @@ -5,4 +5,4 @@ LTO_ENABLE = yes # Use link time optimization for smaller firmware | |||
| 5 | # enable it and set its driver here or in your keymap folder | 5 | # enable it and set its driver here or in your keymap folder |
| 6 | # The Pimoroni board's driver is DRV2605L | 6 | # The Pimoroni board's driver is DRV2605L |
| 7 | # HAPTIC_ENABLE = yes # Enable haptic driver | 7 | # HAPTIC_ENABLE = yes # Enable haptic driver |
| 8 | # HAPTIC_DRIVER = DRV2605L | 8 | # HAPTIC_DRIVER = drv2605l |
diff --git a/keyboards/hillside/52/0_1/config.h b/keyboards/hillside/52/0_1/config.h index 55395dd407..dc8654b4bb 100644 --- a/keyboards/hillside/52/0_1/config.h +++ b/keyboards/hillside/52/0_1/config.h | |||
| @@ -21,5 +21,5 @@ | |||
| 21 | 21 | ||
| 22 | /* Haptic waveforms */ | 22 | /* Haptic waveforms */ |
| 23 | // Two mild waveforms | 23 | // Two mild waveforms |
| 24 | #define DRV_GREETING alert_750ms | 24 | #define DRV2605L_GREETING alert_750ms |
| 25 | #define DRV_MODE_DEFAULT sharp_tick3_60 | 25 | #define DRV2605L_DEFAULT_MODE sharp_tick3_60 |
diff --git a/keyboards/hillside/52/0_1/rules.mk b/keyboards/hillside/52/0_1/rules.mk index 2501147ea8..3c12e55b58 100644 --- a/keyboards/hillside/52/0_1/rules.mk +++ b/keyboards/hillside/52/0_1/rules.mk | |||
| @@ -5,4 +5,4 @@ LTO_ENABLE = yes # Use link time optimization for smaller firmware | |||
| 5 | # enable it and set its driver here or in your keymap folder | 5 | # enable it and set its driver here or in your keymap folder |
| 6 | # The Pimoroni board's driver is DRV2605L | 6 | # The Pimoroni board's driver is DRV2605L |
| 7 | # HAPTIC_ENABLE = yes # Enable haptic driver | 7 | # HAPTIC_ENABLE = yes # Enable haptic driver |
| 8 | # HAPTIC_DRIVER = DRV2605L | 8 | # HAPTIC_DRIVER = drv2605l |
diff --git a/keyboards/ibm/model_m_4th_gen/overnumpad_1xb/rules.mk b/keyboards/ibm/model_m_4th_gen/overnumpad_1xb/rules.mk index 225317b367..9131708828 100644 --- a/keyboards/ibm/model_m_4th_gen/overnumpad_1xb/rules.mk +++ b/keyboards/ibm/model_m_4th_gen/overnumpad_1xb/rules.mk | |||
| @@ -14,4 +14,4 @@ AUDIO_ENABLE = no # Audio output | |||
| 14 | KEYBOARD_SHARED_EP = yes # Free up some extra endpoints - needed if console+mouse+extra | 14 | KEYBOARD_SHARED_EP = yes # Free up some extra endpoints - needed if console+mouse+extra |
| 15 | 15 | ||
| 16 | HAPTIC_ENABLE = yes | 16 | HAPTIC_ENABLE = yes |
| 17 | HAPTIC_DRIVER = SOLENOID | 17 | HAPTIC_DRIVER = solenoid |
diff --git a/keyboards/mechwild/clunker/rules.mk b/keyboards/mechwild/clunker/rules.mk index 3e6a4da7db..a521203b32 100644 --- a/keyboards/mechwild/clunker/rules.mk +++ b/keyboards/mechwild/clunker/rules.mk | |||
| @@ -1 +1 @@ | |||
| HAPTIC_DRIVER += SOLENOID | HAPTIC_DRIVER = solenoid | ||
diff --git a/keyboards/pearlboards/atlas/rules.mk b/keyboards/pearlboards/atlas/rules.mk index 15d4f79cde..1dd174f436 100644 --- a/keyboards/pearlboards/atlas/rules.mk +++ b/keyboards/pearlboards/atlas/rules.mk | |||
| @@ -12,6 +12,6 @@ RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow | |||
| 12 | AUDIO_ENABLE = yes # Audio output | 12 | AUDIO_ENABLE = yes # Audio output |
| 13 | ENCODER_ENABLE = yes | 13 | ENCODER_ENABLE = yes |
| 14 | HAPTIC_ENABLE = yes | 14 | HAPTIC_ENABLE = yes |
| 15 | HAPTIC_DRIVER = DRV2605L | 15 | HAPTIC_DRIVER = drv2605l |
| 16 | 16 | ||
| 17 | LTO_ENABLE = yes | 17 | LTO_ENABLE = yes |
diff --git a/keyboards/pearlboards/pearl/rules.mk b/keyboards/pearlboards/pearl/rules.mk index 707e9c9312..83d6c3a33f 100644 --- a/keyboards/pearlboards/pearl/rules.mk +++ b/keyboards/pearlboards/pearl/rules.mk | |||
| @@ -11,6 +11,6 @@ BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | |||
| 11 | RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow | 11 | RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow |
| 12 | AUDIO_ENABLE = yes # Audio output | 12 | AUDIO_ENABLE = yes # Audio output |
| 13 | HAPTIC_ENABLE = yes | 13 | HAPTIC_ENABLE = yes |
| 14 | HAPTIC_DRIVER = DRV2605L | 14 | HAPTIC_DRIVER = drv2605l |
| 15 | 15 | ||
| 16 | LTO_ENABLE = yes | 16 | LTO_ENABLE = yes |
diff --git a/keyboards/pearlboards/zeus/rules.mk b/keyboards/pearlboards/zeus/rules.mk index eeb36fee4e..5cb2d9b649 100644 --- a/keyboards/pearlboards/zeus/rules.mk +++ b/keyboards/pearlboards/zeus/rules.mk | |||
| @@ -12,6 +12,6 @@ RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow | |||
| 12 | AUDIO_ENABLE = yes # Audio output | 12 | AUDIO_ENABLE = yes # Audio output |
| 13 | ENCODER_ENABLE = yes # Rotary encoder | 13 | ENCODER_ENABLE = yes # Rotary encoder |
| 14 | HAPTIC_ENABLE = yes # Rumble feefback | 14 | HAPTIC_ENABLE = yes # Rumble feefback |
| 15 | HAPTIC_DRIVER = DRV2605L # Rumble motor | 15 | HAPTIC_DRIVER = drv2605l # Rumble motor |
| 16 | 16 | ||
| 17 | LTO_ENABLE = yes # Link time optimization | 17 | LTO_ENABLE = yes # Link time optimization |
diff --git a/keyboards/splitkb/zima/config.h b/keyboards/splitkb/zima/config.h index 21fc2a2609..b031fca8dd 100644 --- a/keyboards/splitkb/zima/config.h +++ b/keyboards/splitkb/zima/config.h | |||
| @@ -35,5 +35,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 35 | #define RATED_VOLTAGE 3 | 35 | #define RATED_VOLTAGE 3 |
| 36 | #define V_PEAK 5 | 36 | #define V_PEAK 5 |
| 37 | 37 | ||
| 38 | #define DRV_GREETING alert_750ms | 38 | #define DRV2605L_GREETING alert_750ms |
| 39 | #define DRV_MODE_DEFAULT buzz | 39 | #define DRV2605L_DEFAULT_MODE buzz |
diff --git a/keyboards/splitkb/zima/rules.mk b/keyboards/splitkb/zima/rules.mk index fb9a585656..f491893a43 100644 --- a/keyboards/splitkb/zima/rules.mk +++ b/keyboards/splitkb/zima/rules.mk | |||
| @@ -15,6 +15,6 @@ ENCODER_ENABLE = yes # ENables the use of one or more encoders | |||
| 15 | OLED_ENABLE = yes | 15 | OLED_ENABLE = yes |
| 16 | OLED_DRIVER = SSD1306 # Enables the use of OLED displays | 16 | OLED_DRIVER = SSD1306 # Enables the use of OLED displays |
| 17 | HAPTIC_ENABLE = yes # Supported but not included by defaut | 17 | HAPTIC_ENABLE = yes # Supported but not included by defaut |
| 18 | HAPTIC_DRIVER = DRV2605L | 18 | HAPTIC_DRIVER = drv2605l |
| 19 | 19 | ||
| 20 | LTO_ENABLE = yes | 20 | LTO_ENABLE = yes |
diff --git a/keyboards/unicomp/classic_ultracl_post_2013/overnumpad_1xb/rules.mk b/keyboards/unicomp/classic_ultracl_post_2013/overnumpad_1xb/rules.mk index 225317b367..9131708828 100644 --- a/keyboards/unicomp/classic_ultracl_post_2013/overnumpad_1xb/rules.mk +++ b/keyboards/unicomp/classic_ultracl_post_2013/overnumpad_1xb/rules.mk | |||
| @@ -14,4 +14,4 @@ AUDIO_ENABLE = no # Audio output | |||
| 14 | KEYBOARD_SHARED_EP = yes # Free up some extra endpoints - needed if console+mouse+extra | 14 | KEYBOARD_SHARED_EP = yes # Free up some extra endpoints - needed if console+mouse+extra |
| 15 | 15 | ||
| 16 | HAPTIC_ENABLE = yes | 16 | HAPTIC_ENABLE = yes |
| 17 | HAPTIC_DRIVER = SOLENOID | 17 | HAPTIC_DRIVER = solenoid |
diff --git a/keyboards/unicomp/classic_ultracl_pre_2013/overnumpad_1xb/rules.mk b/keyboards/unicomp/classic_ultracl_pre_2013/overnumpad_1xb/rules.mk index 225317b367..9131708828 100644 --- a/keyboards/unicomp/classic_ultracl_pre_2013/overnumpad_1xb/rules.mk +++ b/keyboards/unicomp/classic_ultracl_pre_2013/overnumpad_1xb/rules.mk | |||
| @@ -14,4 +14,4 @@ AUDIO_ENABLE = no # Audio output | |||
| 14 | KEYBOARD_SHARED_EP = yes # Free up some extra endpoints - needed if console+mouse+extra | 14 | KEYBOARD_SHARED_EP = yes # Free up some extra endpoints - needed if console+mouse+extra |
| 15 | 15 | ||
| 16 | HAPTIC_ENABLE = yes | 16 | HAPTIC_ENABLE = yes |
| 17 | HAPTIC_DRIVER = SOLENOID | 17 | HAPTIC_DRIVER = solenoid |
diff --git a/keyboards/unicomp/pc122/overnumpad_1xb/rules.mk b/keyboards/unicomp/pc122/overnumpad_1xb/rules.mk index 225317b367..9131708828 100644 --- a/keyboards/unicomp/pc122/overnumpad_1xb/rules.mk +++ b/keyboards/unicomp/pc122/overnumpad_1xb/rules.mk | |||
| @@ -14,4 +14,4 @@ AUDIO_ENABLE = no # Audio output | |||
| 14 | KEYBOARD_SHARED_EP = yes # Free up some extra endpoints - needed if console+mouse+extra | 14 | KEYBOARD_SHARED_EP = yes # Free up some extra endpoints - needed if console+mouse+extra |
| 15 | 15 | ||
| 16 | HAPTIC_ENABLE = yes | 16 | HAPTIC_ENABLE = yes |
| 17 | HAPTIC_DRIVER = SOLENOID | 17 | HAPTIC_DRIVER = solenoid |
diff --git a/keyboards/unicomp/spacesaver_m_post_2013/overnumpad_1xb/rules.mk b/keyboards/unicomp/spacesaver_m_post_2013/overnumpad_1xb/rules.mk index 225317b367..9131708828 100644 --- a/keyboards/unicomp/spacesaver_m_post_2013/overnumpad_1xb/rules.mk +++ b/keyboards/unicomp/spacesaver_m_post_2013/overnumpad_1xb/rules.mk | |||
| @@ -14,4 +14,4 @@ AUDIO_ENABLE = no # Audio output | |||
| 14 | KEYBOARD_SHARED_EP = yes # Free up some extra endpoints - needed if console+mouse+extra | 14 | KEYBOARD_SHARED_EP = yes # Free up some extra endpoints - needed if console+mouse+extra |
| 15 | 15 | ||
| 16 | HAPTIC_ENABLE = yes | 16 | HAPTIC_ENABLE = yes |
| 17 | HAPTIC_DRIVER = SOLENOID | 17 | HAPTIC_DRIVER = solenoid |
diff --git a/keyboards/unicomp/spacesaver_m_pre_2013/overnumpad_1xb/rules.mk b/keyboards/unicomp/spacesaver_m_pre_2013/overnumpad_1xb/rules.mk index 225317b367..9131708828 100644 --- a/keyboards/unicomp/spacesaver_m_pre_2013/overnumpad_1xb/rules.mk +++ b/keyboards/unicomp/spacesaver_m_pre_2013/overnumpad_1xb/rules.mk | |||
| @@ -14,4 +14,4 @@ AUDIO_ENABLE = no # Audio output | |||
| 14 | KEYBOARD_SHARED_EP = yes # Free up some extra endpoints - needed if console+mouse+extra | 14 | KEYBOARD_SHARED_EP = yes # Free up some extra endpoints - needed if console+mouse+extra |
| 15 | 15 | ||
| 16 | HAPTIC_ENABLE = yes | 16 | HAPTIC_ENABLE = yes |
| 17 | HAPTIC_DRIVER = SOLENOID | 17 | HAPTIC_DRIVER = solenoid |
diff --git a/keyboards/vertex/angle65/rules.mk b/keyboards/vertex/angle65/rules.mk index 2849e086e8..330f6ff76b 100644 --- a/keyboards/vertex/angle65/rules.mk +++ b/keyboards/vertex/angle65/rules.mk | |||
| @@ -12,4 +12,4 @@ RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow | |||
| 12 | AUDIO_ENABLE = no # Audio output | 12 | AUDIO_ENABLE = no # Audio output |
| 13 | 13 | ||
| 14 | HAPTIC_ENABLE = yes | 14 | HAPTIC_ENABLE = yes |
| 15 | HAPTIC_DRIVER += SOLENOID | 15 | HAPTIC_DRIVER = solenoid |
diff --git a/keyboards/xw60/rules.mk b/keyboards/xw60/rules.mk index 460d3ced43..710fb4ca88 100644 --- a/keyboards/xw60/rules.mk +++ b/keyboards/xw60/rules.mk | |||
| @@ -11,4 +11,4 @@ BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | |||
| 11 | AUDIO_ENABLE = no # Audio output | 11 | AUDIO_ENABLE = no # Audio output |
| 12 | RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. | 12 | RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. |
| 13 | HAPTIC_ENABLE = yes | 13 | HAPTIC_ENABLE = yes |
| 14 | HAPTIC_DRIVER = SOLENOID | 14 | HAPTIC_DRIVER = solenoid |
diff --git a/layouts/community/ortho_4x12/drashna/config.h b/layouts/community/ortho_4x12/drashna/config.h index 8443ff054f..071f7cb55b 100644 --- a/layouts/community/ortho_4x12/drashna/config.h +++ b/layouts/community/ortho_4x12/drashna/config.h | |||
| @@ -115,7 +115,7 @@ | |||
| 115 | # define V_RMS 2.3 | 115 | # define V_RMS 2.3 |
| 116 | # define V_PEAK 3.30 | 116 | # define V_PEAK 3.30 |
| 117 | /* Library Selection */ | 117 | /* Library Selection */ |
| 118 | # define LIB_SELECTION 4 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */ | 118 | # define DRV2605L_LIBRARY 4 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */ |
| 119 | 119 | ||
| 120 | /* default 2V LRA voltage and library */ | 120 | /* default 2V LRA voltage and library */ |
| 121 | #elif FB_ERM_LRA == 1 | 121 | #elif FB_ERM_LRA == 1 |
| @@ -124,7 +124,7 @@ | |||
| 124 | # define V_PEAK 2.85 | 124 | # define V_PEAK 2.85 |
| 125 | # define F_LRA 200 | 125 | # define F_LRA 200 |
| 126 | /* Library Selection */ | 126 | /* Library Selection */ |
| 127 | # define LIB_SELECTION 6 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */ | 127 | # define DRV2605L_LIBRARY 6 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */ |
| 128 | 128 | ||
| 129 | #endif | 129 | #endif |
| 130 | 130 | ||
diff --git a/quantum/haptic.c b/quantum/haptic.c index c151547fca..13b2258eb8 100644 --- a/quantum/haptic.c +++ b/quantum/haptic.c | |||
| @@ -14,17 +14,20 @@ | |||
| 14 | * You should have received a copy of the GNU General Public License | 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | */ | 16 | */ |
| 17 | |||
| 17 | #include "haptic.h" | 18 | #include "haptic.h" |
| 18 | #include "eeconfig.h" | 19 | #include "eeconfig.h" |
| 19 | #include "debug.h" | 20 | #include "debug.h" |
| 20 | #include "usb_device_state.h" | 21 | #include "usb_device_state.h" |
| 21 | #include "gpio.h" | 22 | #include "gpio.h" |
| 22 | #ifdef DRV2605L | 23 | |
| 23 | # include "DRV2605L.h" | 24 | #ifdef HAPTIC_DRV2605L |
| 25 | # include "drv2605l.h" | ||
| 24 | #endif | 26 | #endif |
| 25 | #ifdef SOLENOID_ENABLE | 27 | #ifdef HAPTIC_SOLENOID |
| 26 | # include "solenoid.h" | 28 | # include "solenoid.h" |
| 27 | #endif | 29 | #endif |
| 30 | |||
| 28 | #if defined(SPLIT_KEYBOARD) && defined(SPLIT_HAPTIC_ENABLE) | 31 | #if defined(SPLIT_KEYBOARD) && defined(SPLIT_HAPTIC_ENABLE) |
| 29 | extern uint8_t split_haptic_play; | 32 | extern uint8_t split_haptic_play; |
| 30 | #endif | 33 | #endif |
| @@ -59,11 +62,11 @@ void haptic_init(void) { | |||
| 59 | eeconfig_init(); | 62 | eeconfig_init(); |
| 60 | } | 63 | } |
| 61 | haptic_config.raw = eeconfig_read_haptic(); | 64 | haptic_config.raw = eeconfig_read_haptic(); |
| 62 | #ifdef SOLENOID_ENABLE | 65 | #ifdef HAPTIC_SOLENOID |
| 63 | solenoid_set_dwell(haptic_config.dwell); | 66 | solenoid_set_dwell(haptic_config.dwell); |
| 64 | #endif | 67 | #endif |
| 65 | if ((haptic_config.raw == 0) | 68 | if ((haptic_config.raw == 0) |
| 66 | #ifdef SOLENOID_ENABLE | 69 | #ifdef HAPTIC_SOLENOID |
| 67 | || (haptic_config.dwell == 0) | 70 | || (haptic_config.dwell == 0) |
| 68 | #endif | 71 | #endif |
| 69 | ) { | 72 | ) { |
| @@ -77,12 +80,12 @@ void haptic_init(void) { | |||
| 77 | // This is to execute any side effects of the configuration. | 80 | // This is to execute any side effects of the configuration. |
| 78 | set_haptic_config_enable(haptic_config.enable); | 81 | set_haptic_config_enable(haptic_config.enable); |
| 79 | } | 82 | } |
| 80 | #ifdef SOLENOID_ENABLE | 83 | #ifdef HAPTIC_SOLENOID |
| 81 | solenoid_setup(); | 84 | solenoid_setup(); |
| 82 | dprintf("Solenoid driver initialized\n"); | 85 | dprintf("Solenoid driver initialized\n"); |
| 83 | #endif | 86 | #endif |
| 84 | #ifdef DRV2605L | 87 | #ifdef HAPTIC_DRV2605L |
| 85 | DRV_init(); | 88 | drv2605l_init(); |
| 86 | dprintf("DRV2605 driver initialized\n"); | 89 | dprintf("DRV2605 driver initialized\n"); |
| 87 | #endif | 90 | #endif |
| 88 | eeconfig_debug_haptic(); | 91 | eeconfig_debug_haptic(); |
| @@ -95,7 +98,7 @@ void haptic_init(void) { | |||
| 95 | } | 98 | } |
| 96 | 99 | ||
| 97 | void haptic_task(void) { | 100 | void haptic_task(void) { |
| 98 | #ifdef SOLENOID_ENABLE | 101 | #ifdef HAPTIC_SOLENOID |
| 99 | solenoid_check(); | 102 | solenoid_check(); |
| 100 | #endif | 103 | #endif |
| 101 | } | 104 | } |
| @@ -108,13 +111,13 @@ void eeconfig_debug_haptic(void) { | |||
| 108 | 111 | ||
| 109 | void haptic_enable(void) { | 112 | void haptic_enable(void) { |
| 110 | set_haptic_config_enable(true); | 113 | set_haptic_config_enable(true); |
| 111 | xprintf("haptic_config.enable = %u\n", haptic_config.enable); | 114 | dprintf("haptic_config.enable = %u\n", haptic_config.enable); |
| 112 | eeconfig_update_haptic(haptic_config.raw); | 115 | eeconfig_update_haptic(haptic_config.raw); |
| 113 | } | 116 | } |
| 114 | 117 | ||
| 115 | void haptic_disable(void) { | 118 | void haptic_disable(void) { |
| 116 | set_haptic_config_enable(false); | 119 | set_haptic_config_enable(false); |
| 117 | xprintf("haptic_config.enable = %u\n", haptic_config.enable); | 120 | dprintf("haptic_config.enable = %u\n", haptic_config.enable); |
| 118 | eeconfig_update_haptic(haptic_config.raw); | 121 | eeconfig_update_haptic(haptic_config.raw); |
| 119 | } | 122 | } |
| 120 | 123 | ||
| @@ -130,7 +133,7 @@ void haptic_toggle(void) { | |||
| 130 | void haptic_feedback_toggle(void) { | 133 | void haptic_feedback_toggle(void) { |
| 131 | haptic_config.feedback++; | 134 | haptic_config.feedback++; |
| 132 | if (haptic_config.feedback >= HAPTIC_FEEDBACK_MAX) haptic_config.feedback = KEY_PRESS; | 135 | if (haptic_config.feedback >= HAPTIC_FEEDBACK_MAX) haptic_config.feedback = KEY_PRESS; |
| 133 | xprintf("haptic_config.feedback = %u\n", !haptic_config.feedback); | 136 | dprintf("haptic_config.feedback = %u\n", !haptic_config.feedback); |
| 134 | eeconfig_update_haptic(haptic_config.raw); | 137 | eeconfig_update_haptic(haptic_config.raw); |
| 135 | } | 138 | } |
| 136 | 139 | ||
| @@ -142,7 +145,7 @@ void haptic_buzz_toggle(void) { | |||
| 142 | 145 | ||
| 143 | void haptic_mode_increase(void) { | 146 | void haptic_mode_increase(void) { |
| 144 | uint8_t mode = haptic_config.mode + 1; | 147 | uint8_t mode = haptic_config.mode + 1; |
| 145 | #ifdef DRV2605L | 148 | #ifdef HAPTIC_DRV2605L |
| 146 | if (haptic_config.mode >= drv_effect_max) { | 149 | if (haptic_config.mode >= drv_effect_max) { |
| 147 | mode = 1; | 150 | mode = 1; |
| 148 | } | 151 | } |
| @@ -152,7 +155,7 @@ void haptic_mode_increase(void) { | |||
| 152 | 155 | ||
| 153 | void haptic_mode_decrease(void) { | 156 | void haptic_mode_decrease(void) { |
| 154 | uint8_t mode = haptic_config.mode - 1; | 157 | uint8_t mode = haptic_config.mode - 1; |
| 155 | #ifdef DRV2605L | 158 | #ifdef HAPTIC_DRV2605L |
| 156 | if (haptic_config.mode < 1) { | 159 | if (haptic_config.mode < 1) { |
| 157 | mode = (drv_effect_max - 1); | 160 | mode = (drv_effect_max - 1); |
| 158 | } | 161 | } |
| @@ -161,7 +164,7 @@ void haptic_mode_decrease(void) { | |||
| 161 | } | 164 | } |
| 162 | 165 | ||
| 163 | void haptic_dwell_increase(void) { | 166 | void haptic_dwell_increase(void) { |
| 164 | #ifdef SOLENOID_ENABLE | 167 | #ifdef HAPTIC_SOLENOID |
| 165 | int16_t next_dwell = ((int16_t)haptic_config.dwell) + SOLENOID_DWELL_STEP_SIZE; | 168 | int16_t next_dwell = ((int16_t)haptic_config.dwell) + SOLENOID_DWELL_STEP_SIZE; |
| 166 | if (haptic_config.dwell >= SOLENOID_MAX_DWELL) { | 169 | if (haptic_config.dwell >= SOLENOID_MAX_DWELL) { |
| 167 | // if it's already at max, we wrap back to min | 170 | // if it's already at max, we wrap back to min |
| @@ -178,7 +181,7 @@ void haptic_dwell_increase(void) { | |||
| 178 | } | 181 | } |
| 179 | 182 | ||
| 180 | void haptic_dwell_decrease(void) { | 183 | void haptic_dwell_decrease(void) { |
| 181 | #ifdef SOLENOID_ENABLE | 184 | #ifdef HAPTIC_SOLENOID |
| 182 | int16_t next_dwell = ((int16_t)haptic_config.dwell) - SOLENOID_DWELL_STEP_SIZE; | 185 | int16_t next_dwell = ((int16_t)haptic_config.dwell) - SOLENOID_DWELL_STEP_SIZE; |
| 183 | if (haptic_config.dwell <= SOLENOID_MIN_DWELL) { | 186 | if (haptic_config.dwell <= SOLENOID_MIN_DWELL) { |
| 184 | // if it's already at min, we wrap to max | 187 | // if it's already at min, we wrap to max |
| @@ -196,13 +199,13 @@ void haptic_dwell_decrease(void) { | |||
| 196 | 199 | ||
| 197 | void haptic_reset(void) { | 200 | void haptic_reset(void) { |
| 198 | set_haptic_config_enable(true); | 201 | set_haptic_config_enable(true); |
| 199 | uint8_t feedback = HAPTIC_FEEDBACK_DEFAULT; | 202 | uint8_t feedback = HAPTIC_DEFAULT_FEEDBACK; |
| 200 | haptic_config.feedback = feedback; | 203 | haptic_config.feedback = feedback; |
| 201 | #ifdef DRV2605L | 204 | #ifdef HAPTIC_DRV2605L |
| 202 | uint8_t mode = HAPTIC_MODE_DEFAULT; | 205 | uint8_t mode = HAPTIC_DEFAULT_MODE; |
| 203 | haptic_config.mode = mode; | 206 | haptic_config.mode = mode; |
| 204 | #endif | 207 | #endif |
| 205 | #ifdef SOLENOID_ENABLE | 208 | #ifdef HAPTIC_SOLENOID |
| 206 | uint8_t dwell = SOLENOID_DEFAULT_DWELL; | 209 | uint8_t dwell = SOLENOID_DEFAULT_DWELL; |
| 207 | haptic_config.dwell = dwell; | 210 | haptic_config.dwell = dwell; |
| 208 | haptic_config.buzz = SOLENOID_DEFAULT_BUZZ; | 211 | haptic_config.buzz = SOLENOID_DEFAULT_BUZZ; |
| @@ -213,41 +216,41 @@ void haptic_reset(void) { | |||
| 213 | haptic_config.buzz = 0; | 216 | haptic_config.buzz = 0; |
| 214 | #endif | 217 | #endif |
| 215 | eeconfig_update_haptic(haptic_config.raw); | 218 | eeconfig_update_haptic(haptic_config.raw); |
| 216 | xprintf("haptic_config.feedback = %u\n", haptic_config.feedback); | 219 | dprintf("haptic_config.feedback = %u\n", haptic_config.feedback); |
| 217 | xprintf("haptic_config.mode = %u\n", haptic_config.mode); | 220 | dprintf("haptic_config.mode = %u\n", haptic_config.mode); |
| 218 | } | 221 | } |
| 219 | 222 | ||
| 220 | void haptic_set_feedback(uint8_t feedback) { | 223 | void haptic_set_feedback(uint8_t feedback) { |
| 221 | haptic_config.feedback = feedback; | 224 | haptic_config.feedback = feedback; |
| 222 | eeconfig_update_haptic(haptic_config.raw); | 225 | eeconfig_update_haptic(haptic_config.raw); |
| 223 | xprintf("haptic_config.feedback = %u\n", haptic_config.feedback); | 226 | dprintf("haptic_config.feedback = %u\n", haptic_config.feedback); |
| 224 | } | 227 | } |
| 225 | 228 | ||
| 226 | void haptic_set_mode(uint8_t mode) { | 229 | void haptic_set_mode(uint8_t mode) { |
| 227 | haptic_config.mode = mode; | 230 | haptic_config.mode = mode; |
| 228 | eeconfig_update_haptic(haptic_config.raw); | 231 | eeconfig_update_haptic(haptic_config.raw); |
| 229 | xprintf("haptic_config.mode = %u\n", haptic_config.mode); | 232 | dprintf("haptic_config.mode = %u\n", haptic_config.mode); |
| 230 | } | 233 | } |
| 231 | 234 | ||
| 232 | void haptic_set_amplitude(uint8_t amp) { | 235 | void haptic_set_amplitude(uint8_t amp) { |
| 233 | haptic_config.amplitude = amp; | 236 | haptic_config.amplitude = amp; |
| 234 | eeconfig_update_haptic(haptic_config.raw); | 237 | eeconfig_update_haptic(haptic_config.raw); |
| 235 | xprintf("haptic_config.amplitude = %u\n", haptic_config.amplitude); | 238 | dprintf("haptic_config.amplitude = %u\n", haptic_config.amplitude); |
| 236 | #ifdef DRV2605L | 239 | #ifdef HAPTIC_DRV2605L |
| 237 | DRV_amplitude(amp); | 240 | drv2605l_amplitude(amp); |
| 238 | #endif | 241 | #endif |
| 239 | } | 242 | } |
| 240 | 243 | ||
| 241 | void haptic_set_buzz(uint8_t buzz) { | 244 | void haptic_set_buzz(uint8_t buzz) { |
| 242 | haptic_config.buzz = buzz; | 245 | haptic_config.buzz = buzz; |
| 243 | eeconfig_update_haptic(haptic_config.raw); | 246 | eeconfig_update_haptic(haptic_config.raw); |
| 244 | xprintf("haptic_config.buzz = %u\n", haptic_config.buzz); | 247 | dprintf("haptic_config.buzz = %u\n", haptic_config.buzz); |
| 245 | } | 248 | } |
| 246 | 249 | ||
| 247 | void haptic_set_dwell(uint8_t dwell) { | 250 | void haptic_set_dwell(uint8_t dwell) { |
| 248 | haptic_config.dwell = dwell; | 251 | haptic_config.dwell = dwell; |
| 249 | eeconfig_update_haptic(haptic_config.raw); | 252 | eeconfig_update_haptic(haptic_config.raw); |
| 250 | xprintf("haptic_config.dwell = %u\n", haptic_config.dwell); | 253 | dprintf("haptic_config.dwell = %u\n", haptic_config.dwell); |
| 251 | } | 254 | } |
| 252 | 255 | ||
| 253 | uint8_t haptic_get_enable(void) { | 256 | uint8_t haptic_get_enable(void) { |
| @@ -277,19 +280,19 @@ uint8_t haptic_get_dwell(void) { | |||
| 277 | 280 | ||
| 278 | void haptic_enable_continuous(void) { | 281 | void haptic_enable_continuous(void) { |
| 279 | haptic_config.cont = 1; | 282 | haptic_config.cont = 1; |
| 280 | xprintf("haptic_config.cont = %u\n", haptic_config.cont); | 283 | dprintf("haptic_config.cont = %u\n", haptic_config.cont); |
| 281 | eeconfig_update_haptic(haptic_config.raw); | 284 | eeconfig_update_haptic(haptic_config.raw); |
| 282 | #ifdef DRV2605L | 285 | #ifdef HAPTIC_DRV2605L |
| 283 | DRV_rtp_init(); | 286 | drv2605l_rtp_init(); |
| 284 | #endif | 287 | #endif |
| 285 | } | 288 | } |
| 286 | 289 | ||
| 287 | void haptic_disable_continuous(void) { | 290 | void haptic_disable_continuous(void) { |
| 288 | haptic_config.cont = 0; | 291 | haptic_config.cont = 0; |
| 289 | xprintf("haptic_config.cont = %u\n", haptic_config.cont); | 292 | dprintf("haptic_config.cont = %u\n", haptic_config.cont); |
| 290 | eeconfig_update_haptic(haptic_config.raw); | 293 | eeconfig_update_haptic(haptic_config.raw); |
| 291 | #ifdef DRV2605L | 294 | #ifdef HAPTIC_DRV2605L |
| 292 | DRV_write(DRV_MODE, 0x00); | 295 | drv2605l_write(DRV2605L_REG_MODE, 0x00); |
| 293 | #endif | 296 | #endif |
| 294 | } | 297 | } |
| 295 | 298 | ||
| @@ -318,15 +321,15 @@ void haptic_cont_decrease(void) { | |||
| 318 | } | 321 | } |
| 319 | 322 | ||
| 320 | void haptic_play(void) { | 323 | void haptic_play(void) { |
| 321 | #ifdef DRV2605L | 324 | #ifdef HAPTIC_DRV2605L |
| 322 | uint8_t play_eff = 0; | 325 | uint8_t play_eff = 0; |
| 323 | play_eff = haptic_config.mode; | 326 | play_eff = haptic_config.mode; |
| 324 | DRV_pulse(play_eff); | 327 | drv2605l_pulse(play_eff); |
| 325 | # if defined(SPLIT_KEYBOARD) && defined(SPLIT_HAPTIC_ENABLE) | 328 | # if defined(SPLIT_KEYBOARD) && defined(SPLIT_HAPTIC_ENABLE) |
| 326 | split_haptic_play = haptic_config.mode; | 329 | split_haptic_play = haptic_config.mode; |
| 327 | # endif | 330 | # endif |
| 328 | #endif | 331 | #endif |
| 329 | #ifdef SOLENOID_ENABLE | 332 | #ifdef HAPTIC_SOLENOID |
| 330 | solenoid_fire_handler(); | 333 | solenoid_fire_handler(); |
| 331 | # if defined(SPLIT_KEYBOARD) && defined(SPLIT_HAPTIC_ENABLE) | 334 | # if defined(SPLIT_KEYBOARD) && defined(SPLIT_HAPTIC_ENABLE) |
| 332 | split_haptic_play = 1; | 335 | split_haptic_play = 1; |
| @@ -335,7 +338,7 @@ void haptic_play(void) { | |||
| 335 | } | 338 | } |
| 336 | 339 | ||
| 337 | void haptic_shutdown(void) { | 340 | void haptic_shutdown(void) { |
| 338 | #ifdef SOLENOID_ENABLE | 341 | #ifdef HAPTIC_SOLENOID |
| 339 | solenoid_shutdown(); | 342 | solenoid_shutdown(); |
| 340 | #endif | 343 | #endif |
| 341 | } | 344 | } |
diff --git a/quantum/haptic.h b/quantum/haptic.h index 71d95cc61b..5bd1a71916 100644 --- a/quantum/haptic.h +++ b/quantum/haptic.h | |||
| @@ -16,14 +16,15 @@ | |||
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | #pragma once | 18 | #pragma once |
| 19 | |||
| 19 | #include <stdint.h> | 20 | #include <stdint.h> |
| 20 | #include <stdbool.h> | 21 | #include <stdbool.h> |
| 21 | 22 | ||
| 22 | #ifndef HAPTIC_FEEDBACK_DEFAULT | 23 | #ifndef HAPTIC_DEFAULT_FEEDBACK |
| 23 | # define HAPTIC_FEEDBACK_DEFAULT 0 | 24 | # define HAPTIC_DEFAULT_FEEDBACK 0 |
| 24 | #endif | 25 | #endif |
| 25 | #ifndef HAPTIC_MODE_DEFAULT | 26 | #ifndef HAPTIC_DEFAULT_MODE |
| 26 | # define HAPTIC_MODE_DEFAULT DRV_MODE_DEFAULT | 27 | # define HAPTIC_DEFAULT_MODE DRV2605L_DEFAULT_MODE |
| 27 | #endif | 28 | #endif |
| 28 | 29 | ||
| 29 | /* EEPROM config settings */ | 30 | /* EEPROM config settings */ |
diff --git a/quantum/process_keycode/process_space_cadet.c b/quantum/process_keycode/process_space_cadet.c index 4d9f01077e..f948ad6238 100644 --- a/quantum/process_keycode/process_space_cadet.c +++ b/quantum/process_keycode/process_space_cadet.c | |||
| @@ -13,10 +13,13 @@ | |||
| 13 | * You should have received a copy of the GNU General Public License | 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | 15 | */ |
| 16 | |||
| 16 | #include "process_space_cadet.h" | 17 | #include "process_space_cadet.h" |
| 17 | #include "keycodes.h" | 18 | #include "keycodes.h" |
| 18 | #include "timer.h" | 19 | #include "timer.h" |
| 20 | #include "action.h" | ||
| 19 | #include "action_tapping.h" | 21 | #include "action_tapping.h" |
| 22 | #include "action_util.h" | ||
| 20 | 23 | ||
| 21 | // ********** OBSOLETE DEFINES, STOP USING! (pls?) ********** | 24 | // ********** OBSOLETE DEFINES, STOP USING! (pls?) ********** |
| 22 | // Shift / paren setup | 25 | // Shift / paren setup |
diff --git a/quantum/split_common/split_util.c b/quantum/split_common/split_util.c index 87838c3195..fca95e0847 100644 --- a/quantum/split_common/split_util.c +++ b/quantum/split_common/split_util.c | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | #include "wait.h" | 21 | #include "wait.h" |
| 22 | #include "debug.h" | 22 | #include "debug.h" |
| 23 | #include "usb_util.h" | 23 | #include "usb_util.h" |
| 24 | #include "bootloader.h" | ||
| 24 | 25 | ||
| 25 | #ifdef EE_HANDS | 26 | #ifdef EE_HANDS |
| 26 | # include "eeconfig.h" | 27 | # include "eeconfig.h" |
diff --git a/users/ishtob/ishtob.h b/users/ishtob/ishtob.h index fd9e19c809..fcc2e2b847 100644 --- a/users/ishtob/ishtob.h +++ b/users/ishtob/ishtob.h | |||
| @@ -36,7 +36,7 @@ enum userspace_keycodes { | |||
| 36 | #define _FNLAYER 6 | 36 | #define _FNLAYER 6 |
| 37 | #define _NUMLAY 7 | 37 | #define _NUMLAY 7 |
| 38 | #define _MOUSECURSOR 8 | 38 | #define _MOUSECURSOR 8 |
| 39 | #define _ADJUST 16 | 39 | #define _ADJUST 9 |
| 40 | 40 | ||
| 41 | 41 | ||
| 42 | 42 | ||
