haptic: further naming cleanups (#21682)
This commit is contained in:
parent
c9fa2006d9
commit
0b802defd4
@ -94,29 +94,29 @@ This driver supports 2 different feedback motors. Set the following in your `con
|
|||||||
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.
|
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.
|
||||||
|
|
||||||
```c
|
```c
|
||||||
#define FB_ERM_LRA 0
|
#define DRV2605L_FB_ERM_LRA 0
|
||||||
#define FB_BRAKEFACTOR 3 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */
|
#define DRV2605L_FB_BRAKEFACTOR 3 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */
|
||||||
#define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
|
#define DRV2605L_FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
|
||||||
|
|
||||||
/* Please refer to your datasheet for the optimal setting for your specific motor. */
|
/* Please refer to your datasheet for the optimal setting for your specific motor. */
|
||||||
#define RATED_VOLTAGE 3
|
#define DRV2605L_RATED_VOLTAGE 3
|
||||||
#define V_PEAK 5
|
#define DRV2605L_V_PEAK 5
|
||||||
```
|
```
|
||||||
##### LRA
|
##### LRA
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
```c
|
```c
|
||||||
#define FB_ERM_LRA 1
|
#define DRV2605L_FB_ERM_LRA 1
|
||||||
#define FB_BRAKEFACTOR 3 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */
|
#define DRV2605L_FB_BRAKEFACTOR 3 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */
|
||||||
#define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
|
#define DRV2605L_FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
|
||||||
|
|
||||||
/* Please refer to your datasheet for the optimal setting for your specific motor. */
|
/* Please refer to your datasheet for the optimal setting for your specific motor. */
|
||||||
#define RATED_VOLTAGE 2
|
#define DRV2605L_RATED_VOLTAGE 2
|
||||||
#define V_PEAK 2.8
|
#define DRV2605L_V_PEAK 2.8
|
||||||
#define V_RMS 2.0
|
#define DRV2605L_V_RMS 2.0
|
||||||
#define V_PEAK 2.1
|
#define DRV2605L_V_PEAK 2.1
|
||||||
#define F_LRA 205 /* resonance freq */
|
#define DRV2605L_F_LRA 205 /* resonance freq */
|
||||||
```
|
```
|
||||||
|
|
||||||
#### DRV2605L waveform library
|
#### DRV2605L waveform library
|
||||||
|
@ -41,58 +41,58 @@ void drv2605l_init(void) {
|
|||||||
|
|
||||||
// drv2605l_write(DRV2605L_REG_FEEDBACK_CTRL,0xB6);
|
// drv2605l_write(DRV2605L_REG_FEEDBACK_CTRL,0xB6);
|
||||||
|
|
||||||
#if FB_ERM_LRA == 0
|
#if DRV2605L_FB_ERM_LRA == 0
|
||||||
/* ERM settings */
|
/* ERM settings */
|
||||||
drv2605l_write(DRV2605L_REG_RATED_VOLTAGE, (RATED_VOLTAGE / 21.33) * 1000);
|
drv2605l_write(DRV2605L_REG_RATED_VOLTAGE, (DRV2605L_RATED_VOLTAGE / 21.33) * 1000);
|
||||||
# if ERM_OPEN_LOOP == 0
|
# if DRV2605L_ERM_OPEN_LOOP == 0
|
||||||
drv2605l_write(DRV2605L_REG_OVERDRIVE_CLAMP_VOLTAGE, (((V_PEAK * (DRIVE_TIME + BLANKING_TIME + IDISS_TIME)) / 0.02133) / (DRIVE_TIME - 0.0003)));
|
drv2605l_write(DRV2605L_REG_OVERDRIVE_CLAMP_VOLTAGE, (((DRV2605L_V_PEAK * (DRV2605L_DRIVE_TIME + DRV2605L_BLANKING_TIME + DRV2605L_IDISS_TIME)) / 0.02133) / (DRV2605L_DRIVE_TIME - 0.0003)));
|
||||||
# elif ERM_OPEN_LOOP == 1
|
# elif DRV2605L_ERM_OPEN_LOOP == 1
|
||||||
drv2605l_write(DRV2605L_REG_OVERDRIVE_CLAMP_VOLTAGE, (V_PEAK / 0.02196));
|
drv2605l_write(DRV2605L_REG_OVERDRIVE_CLAMP_VOLTAGE, (DRV2605L_V_PEAK / 0.02196));
|
||||||
# endif
|
# endif
|
||||||
#elif FB_ERM_LRA == 1
|
#elif DRV2605L_FB_ERM_LRA == 1
|
||||||
drv2605l_write(DRV2605L_REG_RATED_VOLTAGE, ((V_RMS * sqrt(1 - ((4 * ((150 + (SAMPLE_TIME * 50)) * 0.000001)) + 0.0003) * F_LRA) / 0.02071)));
|
drv2605l_write(DRV2605L_REG_RATED_VOLTAGE, ((DRV2605L_V_RMS * sqrt(1 - ((4 * ((150 + (DRV2605L_SAMPLE_TIME * 50)) * 0.000001)) + 0.0003) * DRV2605L_F_LRA) / 0.02071)));
|
||||||
# if LRA_OPEN_LOOP == 0
|
# if DRV2605L_LRA_OPEN_LOOP == 0
|
||||||
drv2605l_write(DRV2605L_REG_OVERDRIVE_CLAMP_VOLTAGE, ((V_PEAK / sqrt(1 - (F_LRA * 0.0008)) / 0.02133)));
|
drv2605l_write(DRV2605L_REG_OVERDRIVE_CLAMP_VOLTAGE, ((DRV2605L_V_PEAK / sqrt(1 - (DRV2605L_F_LRA * 0.0008)) / 0.02133)));
|
||||||
# elif LRA_OPEN_LOOP == 1
|
# elif DRV2605L_LRA_OPEN_LOOP == 1
|
||||||
drv2605l_write(DRV2605L_REG_OVERDRIVE_CLAMP_VOLTAGE, (V_PEAK / 0.02196));
|
drv2605l_write(DRV2605L_REG_OVERDRIVE_CLAMP_VOLTAGE, (DRV2605L_V_PEAK / 0.02196));
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DRVREG_FBR FB_SET;
|
drv2605l_reg_feedback_ctrl_t reg_feedback_ctrl;
|
||||||
FB_SET.Bits.ERM_LRA = FB_ERM_LRA;
|
reg_feedback_ctrl.bits.ERM_LRA = DRV2605L_FB_ERM_LRA;
|
||||||
FB_SET.Bits.BRAKE_FACTOR = FB_BRAKEFACTOR;
|
reg_feedback_ctrl.bits.BRAKE_FACTOR = DRV2605L_FB_BRAKEFACTOR;
|
||||||
FB_SET.Bits.LOOP_GAIN = FB_LOOPGAIN;
|
reg_feedback_ctrl.bits.LOOP_GAIN = DRV2605L_FB_LOOPGAIN;
|
||||||
FB_SET.Bits.BEMF_GAIN = 0; /* auto-calibration populates this field*/
|
reg_feedback_ctrl.bits.BEMF_GAIN = 0; /* auto-calibration populates this field*/
|
||||||
drv2605l_write(DRV2605L_REG_FEEDBACK_CTRL, (uint8_t)FB_SET.Byte);
|
drv2605l_write(DRV2605L_REG_FEEDBACK_CTRL, (uint8_t)reg_feedback_ctrl.raw);
|
||||||
|
|
||||||
DRVREG_CTRL1 C1_SET;
|
drv2605l_reg_ctrl1_t reg_ctrl1;
|
||||||
C1_SET.Bits.C1_DRIVE_TIME = DRIVE_TIME;
|
reg_ctrl1.bits.C1_DRIVE_TIME = DRV2605L_DRIVE_TIME;
|
||||||
C1_SET.Bits.C1_AC_COUPLE = AC_COUPLE;
|
reg_ctrl1.bits.C1_AC_COUPLE = DRV2605L_AC_COUPLE;
|
||||||
C1_SET.Bits.C1_STARTUP_BOOST = STARTUP_BOOST;
|
reg_ctrl1.bits.C1_STARTUP_BOOST = DRV2605L_STARTUP_BOOST;
|
||||||
drv2605l_write(DRV2605L_REG_CTRL1, (uint8_t)C1_SET.Byte);
|
drv2605l_write(DRV2605L_REG_CTRL1, (uint8_t)reg_ctrl1.raw);
|
||||||
|
|
||||||
DRVREG_CTRL2 C2_SET;
|
drv2605l_reg_ctrl2_t reg_ctrl2;
|
||||||
C2_SET.Bits.C2_BIDIR_INPUT = BIDIR_INPUT;
|
reg_ctrl2.bits.C2_BIDIR_INPUT = DRV2605L_BIDIR_INPUT;
|
||||||
C2_SET.Bits.C2_BRAKE_STAB = BRAKE_STAB;
|
reg_ctrl2.bits.C2_BRAKE_STAB = DRV2605L_BRAKE_STAB;
|
||||||
C2_SET.Bits.C2_SAMPLE_TIME = SAMPLE_TIME;
|
reg_ctrl2.bits.C2_SAMPLE_TIME = DRV2605L_SAMPLE_TIME;
|
||||||
C2_SET.Bits.C2_BLANKING_TIME = BLANKING_TIME;
|
reg_ctrl2.bits.C2_BLANKING_TIME = DRV2605L_BLANKING_TIME;
|
||||||
C2_SET.Bits.C2_IDISS_TIME = IDISS_TIME;
|
reg_ctrl2.bits.C2_IDISS_TIME = DRV2605L_IDISS_TIME;
|
||||||
drv2605l_write(DRV2605L_REG_CTRL2, (uint8_t)C2_SET.Byte);
|
drv2605l_write(DRV2605L_REG_CTRL2, (uint8_t)reg_ctrl2.raw);
|
||||||
|
|
||||||
DRVREG_CTRL3 C3_SET;
|
drv2605l_reg_ctrl3_t reg_ctrl3;
|
||||||
C3_SET.Bits.C3_LRA_OPEN_LOOP = LRA_OPEN_LOOP;
|
reg_ctrl3.bits.C3_LRA_OPEN_LOOP = DRV2605L_LRA_OPEN_LOOP;
|
||||||
C3_SET.Bits.C3_N_PWM_ANALOG = N_PWM_ANALOG;
|
reg_ctrl3.bits.C3_N_PWM_ANALOG = DRV2605L_N_PWM_ANALOG;
|
||||||
C3_SET.Bits.C3_LRA_DRIVE_MODE = LRA_DRIVE_MODE;
|
reg_ctrl3.bits.C3_LRA_DRIVE_MODE = DRV2605L_LRA_DRIVE_MODE;
|
||||||
C3_SET.Bits.C3_DATA_FORMAT_RTO = DATA_FORMAT_RTO;
|
reg_ctrl3.bits.C3_DATA_FORMAT_RTO = DRV2605L_DATA_FORMAT_RTO;
|
||||||
C3_SET.Bits.C3_SUPPLY_COMP_DIS = SUPPLY_COMP_DIS;
|
reg_ctrl3.bits.C3_SUPPLY_COMP_DIS = DRV2605L_SUPPLY_COMP_DIS;
|
||||||
C3_SET.Bits.C3_ERM_OPEN_LOOP = ERM_OPEN_LOOP;
|
reg_ctrl3.bits.C3_ERM_OPEN_LOOP = DRV2605L_ERM_OPEN_LOOP;
|
||||||
C3_SET.Bits.C3_NG_THRESH = NG_THRESH;
|
reg_ctrl3.bits.C3_NG_THRESH = DRV2605L_NG_THRESH;
|
||||||
drv2605l_write(DRV2605L_REG_CTRL3, (uint8_t)C3_SET.Byte);
|
drv2605l_write(DRV2605L_REG_CTRL3, (uint8_t)reg_ctrl3.raw);
|
||||||
|
|
||||||
DRVREG_CTRL4 C4_SET;
|
drv2605l_reg_ctrl4_t reg_ctrl4;
|
||||||
C4_SET.Bits.C4_ZC_DET_TIME = ZC_DET_TIME;
|
reg_ctrl4.bits.C4_ZC_DET_TIME = DRV2605L_ZC_DET_TIME;
|
||||||
C4_SET.Bits.C4_AUTO_CAL_TIME = AUTO_CAL_TIME;
|
reg_ctrl4.bits.C4_AUTO_CAL_TIME = DRV2605L_AUTO_CAL_TIME;
|
||||||
drv2605l_write(DRV2605L_REG_CTRL4, (uint8_t)C4_SET.Byte);
|
drv2605l_write(DRV2605L_REG_CTRL4, (uint8_t)reg_ctrl4.raw);
|
||||||
|
|
||||||
drv2605l_write(DRV2605L_REG_LIBRARY_SELECTION, DRV2605L_LIBRARY);
|
drv2605l_write(DRV2605L_REG_LIBRARY_SELECTION, DRV2605L_LIBRARY);
|
||||||
|
|
||||||
|
@ -22,42 +22,42 @@
|
|||||||
/* Initialization settings
|
/* Initialization settings
|
||||||
|
|
||||||
* Feedback Control Settings */
|
* Feedback Control Settings */
|
||||||
#ifndef FB_ERM_LRA
|
#ifndef DRV2605L_FB_ERM_LRA
|
||||||
# define FB_ERM_LRA 1 /* For ERM:0 or LRA:1*/
|
# define DRV2605L_FB_ERM_LRA 1 /* For ERM:0 or LRA:1*/
|
||||||
#endif
|
#endif
|
||||||
#ifndef FB_BRAKEFACTOR
|
#ifndef DRV2605L_FB_BRAKEFACTOR
|
||||||
# define FB_BRAKEFACTOR 3 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */
|
# define DRV2605L_FB_BRAKEFACTOR 3 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */
|
||||||
#endif
|
#endif
|
||||||
#ifndef FB_LOOPGAIN
|
#ifndef DRV2605L_FB_LOOPGAIN
|
||||||
# define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
|
# define DRV2605L_FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* LRA specific settings */
|
/* LRA specific settings */
|
||||||
#if FB_ERM_LRA == 1
|
#if DRV2605L_FB_ERM_LRA == 1
|
||||||
# ifndef V_RMS
|
# ifndef DRV2605L_V_RMS
|
||||||
# define V_RMS 2.0
|
# define DRV2605L_V_RMS 2.0
|
||||||
# endif
|
# endif
|
||||||
# ifndef V_PEAK
|
# ifndef DRV2605L_V_PEAK
|
||||||
# define V_PEAK 2.1
|
# define DRV2605L_V_PEAK 2.1
|
||||||
# endif
|
# endif
|
||||||
# ifndef F_LRA
|
# ifndef DRV2605L_F_LRA
|
||||||
# define F_LRA 205
|
# define DRV2605L_F_LRA 205
|
||||||
# endif
|
# endif
|
||||||
# ifndef RATED_VOLTAGE
|
# ifndef DRV2605L_RATED_VOLTAGE
|
||||||
# define RATED_VOLTAGE 2 /* 2v as safe range in case device voltage is not set */
|
# define DRV2605L_RATED_VOLTAGE 2 /* 2v as safe range in case device voltage is not set */
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef RATED_VOLTAGE
|
#ifndef DRV2605L_RATED_VOLTAGE
|
||||||
# define RATED_VOLTAGE 2 /* 2v as safe range in case device voltage is not set */
|
# define DRV2605L_RATED_VOLTAGE 2 /* 2v as safe range in case device voltage is not set */
|
||||||
#endif
|
#endif
|
||||||
#ifndef V_PEAK
|
#ifndef DRV2605L_V_PEAK
|
||||||
# define V_PEAK 2.8
|
# define DRV2605L_V_PEAK 2.8
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Library Selection */
|
/* Library Selection */
|
||||||
#ifndef DRV2605L_LIBRARY
|
#ifndef DRV2605L_LIBRARY
|
||||||
# if FB_ERM_LRA == 1
|
# if DRV2605L_FB_ERM_LRA == 1
|
||||||
# define DRV2605L_LIBRARY 6 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */
|
# define DRV2605L_LIBRARY 6 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */
|
||||||
# else
|
# else
|
||||||
# define DRV2605L_LIBRARY 1
|
# define DRV2605L_LIBRARY 1
|
||||||
@ -65,69 +65,69 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DRV2605L_GREETING
|
#ifndef DRV2605L_GREETING
|
||||||
# define DRV2605L_GREETING alert_750ms
|
# define DRV2605L_GREETING DRV2605L_EFFECT_750_MS_ALERT_100
|
||||||
#endif
|
#endif
|
||||||
#ifndef DRV2605L_DEFAULT_MODE
|
#ifndef DRV2605L_DEFAULT_MODE
|
||||||
# define DRV2605L_DEFAULT_MODE strong_click1
|
# define DRV2605L_DEFAULT_MODE DRV2605L_EFFECT_STRONG_CLICK_1_100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Control 1 register settings */
|
/* Control 1 register settings */
|
||||||
#ifndef DRIVE_TIME
|
#ifndef DRV2605L_DRIVE_TIME
|
||||||
# define DRIVE_TIME 25
|
# define DRV2605L_DRIVE_TIME 25
|
||||||
#endif
|
#endif
|
||||||
#ifndef AC_COUPLE
|
#ifndef DRV2605L_AC_COUPLE
|
||||||
# define AC_COUPLE 0
|
# define DRV2605L_AC_COUPLE 0
|
||||||
#endif
|
#endif
|
||||||
#ifndef STARTUP_BOOST
|
#ifndef DRV2605L_STARTUP_BOOST
|
||||||
# define STARTUP_BOOST 1
|
# define DRV2605L_STARTUP_BOOST 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Control 2 Settings */
|
/* Control 2 Settings */
|
||||||
#ifndef BIDIR_INPUT
|
#ifndef DRV2605L_BIDIR_INPUT
|
||||||
# define BIDIR_INPUT 1
|
# define DRV2605L_BIDIR_INPUT 1
|
||||||
#endif
|
#endif
|
||||||
#ifndef BRAKE_STAB
|
#ifndef DRV2605L_BRAKE_STAB
|
||||||
# define BRAKE_STAB 1 /* Loopgain is reduced when braking is almost complete to improve stability */
|
# define DRV2605L_BRAKE_STAB 1 /* Loopgain is reduced when braking is almost complete to improve stability */
|
||||||
#endif
|
#endif
|
||||||
#ifndef SAMPLE_TIME
|
#ifndef DRV2605L_SAMPLE_TIME
|
||||||
# define SAMPLE_TIME 3
|
# define DRV2605L_SAMPLE_TIME 3
|
||||||
#endif
|
#endif
|
||||||
#ifndef BLANKING_TIME
|
#ifndef DRV2605L_BLANKING_TIME
|
||||||
# define BLANKING_TIME 1
|
# define DRV2605L_BLANKING_TIME 1
|
||||||
#endif
|
#endif
|
||||||
#ifndef IDISS_TIME
|
#ifndef DRV2605L_IDISS_TIME
|
||||||
# define IDISS_TIME 1
|
# define DRV2605L_IDISS_TIME 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Control 3 settings */
|
/* Control 3 settings */
|
||||||
#ifndef NG_THRESH
|
#ifndef DRV2605L_NG_THRESH
|
||||||
# define NG_THRESH 2
|
# define DRV2605L_NG_THRESH 2
|
||||||
#endif
|
#endif
|
||||||
#ifndef ERM_OPEN_LOOP
|
#ifndef DRV2605L_ERM_OPEN_LOOP
|
||||||
# define ERM_OPEN_LOOP 1
|
# define DRV2605L_ERM_OPEN_LOOP 1
|
||||||
#endif
|
#endif
|
||||||
#ifndef SUPPLY_COMP_DIS
|
#ifndef DRV2605L_SUPPLY_COMP_DIS
|
||||||
# define SUPPLY_COMP_DIS 0
|
# define DRV2605L_SUPPLY_COMP_DIS 0
|
||||||
#endif
|
#endif
|
||||||
#ifndef DATA_FORMAT_RTO
|
#ifndef DRV2605L_DATA_FORMAT_RTO
|
||||||
# define DATA_FORMAT_RTO 0
|
# define DRV2605L_DATA_FORMAT_RTO 0
|
||||||
#endif
|
#endif
|
||||||
#ifndef LRA_DRIVE_MODE
|
#ifndef DRV2605L_LRA_DRIVE_MODE
|
||||||
# define LRA_DRIVE_MODE 0
|
# define DRV2605L_LRA_DRIVE_MODE 0
|
||||||
#endif
|
#endif
|
||||||
#ifndef N_PWM_ANALOG
|
#ifndef DRV2605L_N_PWM_ANALOG
|
||||||
# define N_PWM_ANALOG 0
|
# define DRV2605L_N_PWM_ANALOG 0
|
||||||
#endif
|
#endif
|
||||||
#ifndef LRA_OPEN_LOOP
|
#ifndef DRV2605L_LRA_OPEN_LOOP
|
||||||
# define LRA_OPEN_LOOP 0
|
# define DRV2605L_LRA_OPEN_LOOP 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Control 4 settings */
|
/* Control 4 settings */
|
||||||
#ifndef ZC_DET_TIME
|
#ifndef DRV2605L_ZC_DET_TIME
|
||||||
# define ZC_DET_TIME 0
|
# define DRV2605L_ZC_DET_TIME 0
|
||||||
#endif
|
#endif
|
||||||
#ifndef AUTO_CAL_TIME
|
#ifndef DRV2605L_AUTO_CAL_TIME
|
||||||
# define AUTO_CAL_TIME 3
|
# define DRV2605L_AUTO_CAL_TIME 3
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DRV2605L_I2C_ADDRESS 0x5A
|
#define DRV2605L_I2C_ADDRESS 0x5A
|
||||||
@ -175,203 +175,169 @@ void drv2605l_rtp_init(void);
|
|||||||
void drv2605l_amplitude(const uint8_t amplitude);
|
void drv2605l_amplitude(const uint8_t amplitude);
|
||||||
void drv2605l_pulse(const uint8_t sequence);
|
void drv2605l_pulse(const uint8_t sequence);
|
||||||
|
|
||||||
typedef enum DRV_EFFECT {
|
typedef enum drv2605l_effect_t {
|
||||||
clear_sequence,
|
DRV2605L_EFFECT_CLEAR_SEQUENCE,
|
||||||
strong_click,
|
DRV2605L_EFFECT_STRONG_CLICK_100,
|
||||||
strong_click_60,
|
DRV2605L_EFFECT_STRONG_CLICK_60,
|
||||||
strong_click_30,
|
DRV2605L_EFFECT_STRONG_CLICK_30,
|
||||||
sharp_click,
|
DRV2605L_EFFECT_SHARP_CLICK_100,
|
||||||
sharp_click_60,
|
DRV2605L_EFFECT_SHARP_CLICK_60,
|
||||||
sharp_click_30,
|
DRV2605L_EFFECT_SHARP_CLICK_30,
|
||||||
soft_bump,
|
DRV2605L_EFFECT_SOFT_BUMP_100,
|
||||||
soft_bump_60,
|
DRV2605L_EFFECT_SOFT_BUMP_60,
|
||||||
soft_bump_30,
|
DRV2605L_EFFECT_SOFT_BUMP_30,
|
||||||
dbl_click,
|
DRV2605L_EFFECT_DOUBLE_CLICK_100,
|
||||||
dbl_click_60,
|
DRV2605L_EFFECT_DOUBLE_CLICK_60,
|
||||||
trp_click,
|
DRV2605L_EFFECT_TRIPLE_CLICK_100,
|
||||||
soft_fuzz,
|
DRV2605L_EFFECT_SOFT_FUZZ_60,
|
||||||
strong_buzz,
|
DRV2605L_EFFECT_STRONG_BUZZ_100,
|
||||||
alert_750ms,
|
DRV2605L_EFFECT_750_MS_ALERT_100,
|
||||||
alert_1000ms,
|
DRV2605L_EFFECT_1000_MS_ALERT_100,
|
||||||
strong_click1,
|
DRV2605L_EFFECT_STRONG_CLICK_1_100,
|
||||||
strong_click2_80,
|
DRV2605L_EFFECT_STRONG_CLICK_2_80,
|
||||||
strong_click3_60,
|
DRV2605L_EFFECT_STRONG_CLICK_3_60,
|
||||||
strong_click4_30,
|
DRV2605L_EFFECT_STRONG_CLICK_4_30,
|
||||||
medium_click1,
|
DRV2605L_EFFECT_MEDIUM_CLICK_1_100,
|
||||||
medium_click2_80,
|
DRV2605L_EFFECT_MEDIUM_CLICK_2_80,
|
||||||
medium_click3_60,
|
DRV2605L_EFFECT_MEDIUM_CLICK_3_60,
|
||||||
sharp_tick1,
|
DRV2605L_EFFECT_SHARP_TICK_1_100,
|
||||||
sharp_tick2_80,
|
DRV2605L_EFFECT_SHARP_TICK_2_80,
|
||||||
sharp_tick3_60,
|
DRV2605L_EFFECT_SHARP_TICK_3_60,
|
||||||
sh_dblclick_str,
|
DRV2605L_EFFECT_SHORT_DOUBLE_CLICK_STRONG_1_100,
|
||||||
sh_dblclick_str_80,
|
DRV2605L_EFFECT_SHORT_DOUBLE_CLICK_STRONG_2_80,
|
||||||
sh_dblclick_str_60,
|
DRV2605L_EFFECT_SHORT_DOUBLE_CLICK_STRONG_3_60,
|
||||||
sh_dblclick_str_30,
|
DRV2605L_EFFECT_SHORT_DOUBLE_CLICK_STRONG_4_30,
|
||||||
sh_dblclick_med,
|
DRV2605L_EFFECT_SHORT_DOUBLE_CLICK_MEDIUM_1_100,
|
||||||
sh_dblclick_med_80,
|
DRV2605L_EFFECT_SHORT_DOUBLE_CLICK_MEDIUM_2_80,
|
||||||
sh_dblclick_med_60,
|
DRV2605L_EFFECT_SHORT_DOUBLE_CLICK_MEDIUM_3_60,
|
||||||
sh_dblsharp_tick,
|
DRV2605L_EFFECT_SHORT_DOUBLE_SHARP_TICK_1_100,
|
||||||
sh_dblsharp_tick_80,
|
DRV2605L_EFFECT_SHORT_DOUBLE_SHARP_TICK_2_80,
|
||||||
sh_dblsharp_tick_60,
|
DRV2605L_EFFECT_SHORT_DOUBLE_SHARP_TICK_3_60,
|
||||||
lg_dblclick_str,
|
DRV2605L_EFFECT_LONG_DOUBLE_SHARP_CLICK_STRONG_1_100,
|
||||||
lg_dblclick_str_80,
|
DRV2605L_EFFECT_LONG_DOUBLE_SHARP_CLICK_STRONG_2_80,
|
||||||
lg_dblclick_str_60,
|
DRV2605L_EFFECT_LONG_DOUBLE_SHARP_CLICK_STRONG_3_60,
|
||||||
lg_dblclick_str_30,
|
DRV2605L_EFFECT_LONG_DOUBLE_SHARP_CLICK_STRONG_4_30,
|
||||||
lg_dblclick_med,
|
DRV2605L_EFFECT_LONG_DOUBLE_SHARP_CLICK_MEDIUM_1_100,
|
||||||
lg_dblclick_med_80,
|
DRV2605L_EFFECT_LONG_DOUBLE_SHARP_CLICK_MEDIUM_2_80,
|
||||||
lg_dblclick_med_60,
|
DRV2605L_EFFECT_LONG_DOUBLE_SHARP_CLICK_MEDIUM_3_60,
|
||||||
lg_dblsharp_tick,
|
DRV2605L_EFFECT_LONG_DOUBLE_SHARP_TICK_1_100,
|
||||||
lg_dblsharp_tick_80,
|
DRV2605L_EFFECT_LONG_DOUBLE_SHARP_TICK_2_80,
|
||||||
lg_dblsharp_tick_60,
|
DRV2605L_EFFECT_LONG_DOUBLE_SHARP_TICK_3_60,
|
||||||
buzz,
|
DRV2605L_EFFECT_BUZZ_1_100,
|
||||||
buzz_80,
|
DRV2605L_EFFECT_BUZZ_2_80,
|
||||||
buzz_60,
|
DRV2605L_EFFECT_BUZZ_3_60,
|
||||||
buzz_40,
|
DRV2605L_EFFECT_BUZZ_4_40,
|
||||||
buzz_20,
|
DRV2605L_EFFECT_BUZZ_5_20,
|
||||||
pulsing_strong,
|
DRV2605L_EFFECT_PULSING_STRONG_1_100,
|
||||||
pulsing_strong_80,
|
DRV2605L_EFFECT_PULSING_STRONG_2_60,
|
||||||
pulsing_medium,
|
DRV2605L_EFFECT_PULSING_MEDIUM_1_100,
|
||||||
pulsing_medium_80,
|
DRV2605L_EFFECT_PULSING_MEDIUM_2_60,
|
||||||
pulsing_sharp,
|
DRV2605L_EFFECT_PULSING_SHARP_1_100,
|
||||||
pulsing_sharp_80,
|
DRV2605L_EFFECT_PULSING_SHARP_2_60,
|
||||||
transition_click,
|
DRV2605L_EFFECT_TRANSITION_CLICK_1_100,
|
||||||
transition_click_80,
|
DRV2605L_EFFECT_TRANSITION_CLICK_2_80,
|
||||||
transition_click_60,
|
DRV2605L_EFFECT_TRANSITION_CLICK_3_60,
|
||||||
transition_click_40,
|
DRV2605L_EFFECT_TRANSITION_CLICK_4_40,
|
||||||
transition_click_20,
|
DRV2605L_EFFECT_TRANSITION_CLICK_5_20,
|
||||||
transition_click_10,
|
DRV2605L_EFFECT_TRANSITION_CLICK_6_10,
|
||||||
transition_hum,
|
DRV2605L_EFFECT_TRANSITION_HUM_1_100,
|
||||||
transition_hum_80,
|
DRV2605L_EFFECT_TRANSITION_HUM_2_80,
|
||||||
transition_hum_60,
|
DRV2605L_EFFECT_TRANSITION_HUM_3_60,
|
||||||
transition_hum_40,
|
DRV2605L_EFFECT_TRANSITION_HUM_4_40,
|
||||||
transition_hum_20,
|
DRV2605L_EFFECT_TRANSITION_HUM_5_20,
|
||||||
transition_hum_10,
|
DRV2605L_EFFECT_TRANSITION_HUM_6_10,
|
||||||
transition_rampdown_long_smooth1,
|
DRV2605L_EFFECT_TRANSITION_RAMP_DOWN_LONG_SMOOTH_1_100,
|
||||||
transition_rampdown_long_smooth2,
|
DRV2605L_EFFECT_TRANSITION_RAMP_DOWN_LONG_SMOOTH_2_100,
|
||||||
transition_rampdown_med_smooth1,
|
DRV2605L_EFFECT_TRANSITION_RAMP_DOWN_MEDIUM_SMOOTH_1_100,
|
||||||
transition_rampdown_med_smooth2,
|
DRV2605L_EFFECT_TRANSITION_RAMP_DOWN_MEDIUM_SMOOTH_2_100,
|
||||||
transition_rampdown_short_smooth1,
|
DRV2605L_EFFECT_TRANSITION_RAMP_DOWN_SHORT_SMOOTH_1_100,
|
||||||
transition_rampdown_short_smooth2,
|
DRV2605L_EFFECT_TRANSITION_RAMP_DOWN_SHORT_SMOOTH_2_100,
|
||||||
transition_rampdown_long_sharp1,
|
DRV2605L_EFFECT_TRANSITION_RAMP_DOWN_LONG_SHARP_1_100,
|
||||||
transition_rampdown_long_sharp2,
|
DRV2605L_EFFECT_TRANSITION_RAMP_DOWN_LONG_SHARP_2_100,
|
||||||
transition_rampdown_med_sharp1,
|
DRV2605L_EFFECT_TRANSITION_RAMP_DOWN_MEDIUM_SHARP_1_100,
|
||||||
transition_rampdown_med_sharp2,
|
DRV2605L_EFFECT_TRANSITION_RAMP_DOWN_MEDIUM_SHARP_2_100,
|
||||||
transition_rampdown_short_sharp1,
|
DRV2605L_EFFECT_TRANSITION_RAMP_DOWN_SHORT_SHARP_1_100,
|
||||||
transition_rampdown_short_sharp2,
|
DRV2605L_EFFECT_TRANSITION_RAMP_DOWN_SHORT_SHARP_2_100,
|
||||||
transition_rampup_long_smooth1,
|
DRV2605L_EFFECT_TRANSITION_RAMP_UP_LONG_SMOOTH_1_100,
|
||||||
transition_rampup_long_smooth2,
|
DRV2605L_EFFECT_TRANSITION_RAMP_UP_LONG_SMOOTH_2_100,
|
||||||
transition_rampup_med_smooth1,
|
DRV2605L_EFFECT_TRANSITION_RAMP_UP_MEDIUM_SMOOTH_1_100,
|
||||||
transition_rampup_med_smooth2,
|
DRV2605L_EFFECT_TRANSITION_RAMP_UP_MEDIUM_SMOOTH_2_100,
|
||||||
transition_rampup_short_smooth1,
|
DRV2605L_EFFECT_TRANSITION_RAMP_UP_SHORT_SMOOTH_1_100,
|
||||||
transition_rampup_short_smooth2,
|
DRV2605L_EFFECT_TRANSITION_RAMP_UP_SHORT_SMOOTH_2_100,
|
||||||
transition_rampup_long_sharp1,
|
DRV2605L_EFFECT_TRANSITION_RAMP_UP_LONG_SHARP_1_100,
|
||||||
transition_rampup_long_sharp2,
|
DRV2605L_EFFECT_TRANSITION_RAMP_UP_LONG_SHARP_2_100,
|
||||||
transition_rampup_med_sharp1,
|
DRV2605L_EFFECT_TRANSITION_RAMP_UP_MEDIUM_SHARP_1_100,
|
||||||
transition_rampup_med_sharp2,
|
DRV2605L_EFFECT_TRANSITION_RAMP_UP_MEDIUM_SHARP_2_100,
|
||||||
transition_rampup_short_sharp1,
|
DRV2605L_EFFECT_TRANSITION_RAMP_UP_SHORT_SHARP_1_100,
|
||||||
transition_rampup_short_sharp2,
|
DRV2605L_EFFECT_TRANSITION_RAMP_UP_SHORT_SHARP_2_100,
|
||||||
transition_rampdown_long_smooth1_50,
|
DRV2605L_EFFECT_TRANSITION_RAMP_DOWN_LONG_SMOOTH_1_50,
|
||||||
transition_rampdown_long_smooth2_50,
|
DRV2605L_EFFECT_TRANSITION_RAMP_DOWN_LONG_SMOOTH_2_50,
|
||||||
transition_rampdown_med_smooth1_50,
|
DRV2605L_EFFECT_TRANSITION_RAMP_DOWN_MEDIUM_SMOOTH_1_50,
|
||||||
transition_rampdown_med_smooth2_50,
|
DRV2605L_EFFECT_TRANSITION_RAMP_DOWN_MEDIUM_SMOOTH_2_50,
|
||||||
transition_rampdown_short_smooth1_50,
|
DRV2605L_EFFECT_TRANSITION_RAMP_DOWN_SHORT_SMOOTH_1_50,
|
||||||
transition_rampdown_short_smooth2_50,
|
DRV2605L_EFFECT_TRANSITION_RAMP_DOWN_SHORT_SMOOTH_2_50,
|
||||||
transition_rampdown_long_sharp1_50,
|
DRV2605L_EFFECT_TRANSITION_RAMP_DOWN_LONG_SHARP_1_50,
|
||||||
transition_rampdown_long_sharp2_50,
|
DRV2605L_EFFECT_TRANSITION_RAMP_DOWN_LONG_SHARP_2_50,
|
||||||
transition_rampdown_med_sharp1_50,
|
DRV2605L_EFFECT_TRANSITION_RAMP_DOWN_MEDIUM_SHARP_1_50,
|
||||||
transition_rampdown_med_sharp2_50,
|
DRV2605L_EFFECT_TRANSITION_RAMP_DOWN_MEDIUM_SHARP_2_50,
|
||||||
transition_rampdown_short_sharp1_50,
|
DRV2605L_EFFECT_TRANSITION_RAMP_DOWN_SHORT_SHARP_1_50,
|
||||||
transition_rampdown_short_sharp2_50,
|
DRV2605L_EFFECT_TRANSITION_RAMP_DOWN_SHORT_SHARP_2_50,
|
||||||
transition_rampup_long_smooth1_50,
|
DRV2605L_EFFECT_TRANSITION_RAMP_UP_LONG_SMOOTH_1_50,
|
||||||
transition_rampup_long_smooth2_50,
|
DRV2605L_EFFECT_TRANSITION_RAMP_UP_LONG_SMOOTH_2_50,
|
||||||
transition_rampup_med_smooth1_50,
|
DRV2605L_EFFECT_TRANSITION_RAMP_UP_MEDIUM_SMOOTH_1_50,
|
||||||
transition_rampup_med_smooth2_50,
|
DRV2605L_EFFECT_TRANSITION_RAMP_UP_MEDIUM_SMOOTH_2_50,
|
||||||
transition_rampup_short_smooth1_50,
|
DRV2605L_EFFECT_TRANSITION_RAMP_UP_SHORT_SMOOTH_1_50,
|
||||||
transition_rampup_short_smooth2_50,
|
DRV2605L_EFFECT_TRANSITION_RAMP_UP_SHORT_SMOOTH_2_50,
|
||||||
transition_rampup_long_sharp1_50,
|
DRV2605L_EFFECT_TRANSITION_RAMP_UP_LONG_SHARP_1_50,
|
||||||
transition_rampup_long_sharp2_50,
|
DRV2605L_EFFECT_TRANSITION_RAMP_UP_LONG_SHARP_2_50,
|
||||||
transition_rampup_med_sharp1_50,
|
DRV2605L_EFFECT_TRANSITION_RAMP_UP_MEDIUM_SHARP_1_50,
|
||||||
transition_rampup_med_sharp2_50,
|
DRV2605L_EFFECT_TRANSITION_RAMP_UP_MEDIUM_SHARP_2_50,
|
||||||
transition_rampup_short_sharp1_50,
|
DRV2605L_EFFECT_TRANSITION_RAMP_UP_SHORT_SHARP_1_50,
|
||||||
transition_rampup_short_sharp2_50,
|
DRV2605L_EFFECT_TRANSITION_RAMP_UP_SHORT_SHARP_2_50,
|
||||||
long_buzz_for_programmatic_stopping,
|
DRV2605L_EFFECT_LONG_BUZZ_FOR_PROGRAMMATIC_STOPPING,
|
||||||
smooth_hum1_50,
|
DRV2605L_EFFECT_SMOOTH_HUM_1_50,
|
||||||
smooth_hum2_40,
|
DRV2605L_EFFECT_SMOOTH_HUM_2_40,
|
||||||
smooth_hum3_30,
|
DRV2605L_EFFECT_SMOOTH_HUM_3_30,
|
||||||
smooth_hum4_20,
|
DRV2605L_EFFECT_SMOOTH_HUM_4_20,
|
||||||
smooth_hum5_10,
|
DRV2605L_EFFECT_SMOOTH_HUM_5_10,
|
||||||
drv_effect_max
|
DRV2605L_EFFECT_COUNT
|
||||||
} DRV_EFFECT;
|
} drv2605l_effect_t;
|
||||||
|
|
||||||
/* Register bit array unions */
|
/* Register bit array unions */
|
||||||
|
|
||||||
typedef union DRVREG_STATUS { /* register 0x00 */
|
typedef union { /* register 0x1A */
|
||||||
uint8_t Byte;
|
uint8_t raw;
|
||||||
struct {
|
|
||||||
uint8_t OC_DETECT : 1; /* set to 1 when overcurrent event is detected */
|
|
||||||
uint8_t OVER_TEMP : 1; /* set to 1 when device exceeds temp threshold */
|
|
||||||
uint8_t FB_STS : 1; /* set to 1 when feedback controller has timed out */
|
|
||||||
/* auto-calibration routine and diagnostic result
|
|
||||||
* result | auto-calibation | diagnostic |
|
|
||||||
* 0 | passed | actuator func normal |
|
|
||||||
* 1 | failed | actuator func fault* |
|
|
||||||
* * actuator is not present or is shorted, timing out, or giving out–of-range back-EMF */
|
|
||||||
uint8_t DIAG_RESULT : 1;
|
|
||||||
uint8_t : 1;
|
|
||||||
uint8_t DEVICE_ID : 3; /* Device IDs 3: DRV2605 4: DRV2604 5: DRV2604L 6: DRV2605L */
|
|
||||||
} Bits;
|
|
||||||
} DRVREG_STATUS;
|
|
||||||
|
|
||||||
typedef union DRVREG_MODE { /* register 0x01 */
|
|
||||||
uint8_t Byte;
|
|
||||||
struct {
|
|
||||||
uint8_t MODE : 3; /* Mode setting */
|
|
||||||
uint8_t : 3;
|
|
||||||
uint8_t STANDBY : 1; /* 0:standby 1:ready */
|
|
||||||
} Bits;
|
|
||||||
} DRVREG_MODE;
|
|
||||||
|
|
||||||
typedef union DRVREG_WAIT {
|
|
||||||
uint8_t Byte;
|
|
||||||
struct {
|
|
||||||
uint8_t WAIT_MODE : 1; /* Set to 1 to interpret as wait for next 7 bits x10ms */
|
|
||||||
uint8_t WAIT_TIME : 7;
|
|
||||||
} Bits;
|
|
||||||
} DRVREG_WAIT;
|
|
||||||
|
|
||||||
typedef union DRVREG_FBR { /* register 0x1A */
|
|
||||||
uint8_t Byte;
|
|
||||||
struct {
|
struct {
|
||||||
uint8_t BEMF_GAIN : 2;
|
uint8_t BEMF_GAIN : 2;
|
||||||
uint8_t LOOP_GAIN : 2;
|
uint8_t LOOP_GAIN : 2;
|
||||||
uint8_t BRAKE_FACTOR : 3;
|
uint8_t BRAKE_FACTOR : 3;
|
||||||
uint8_t ERM_LRA : 1;
|
uint8_t ERM_LRA : 1;
|
||||||
} Bits;
|
} bits;
|
||||||
} DRVREG_FBR;
|
} drv2605l_reg_feedback_ctrl_t;
|
||||||
|
|
||||||
typedef union DRVREG_CTRL1 { /* register 0x1B */
|
typedef union { /* register 0x1B */
|
||||||
uint8_t Byte;
|
uint8_t raw;
|
||||||
struct {
|
struct {
|
||||||
uint8_t C1_DRIVE_TIME : 5;
|
uint8_t C1_DRIVE_TIME : 5;
|
||||||
uint8_t C1_AC_COUPLE : 1;
|
uint8_t C1_AC_COUPLE : 1;
|
||||||
uint8_t : 1;
|
uint8_t : 1;
|
||||||
uint8_t C1_STARTUP_BOOST : 1;
|
uint8_t C1_STARTUP_BOOST : 1;
|
||||||
} Bits;
|
} bits;
|
||||||
} DRVREG_CTRL1;
|
} drv2605l_reg_ctrl1_t;
|
||||||
|
|
||||||
typedef union DRVREG_CTRL2 { /* register 0x1C */
|
typedef union { /* register 0x1C */
|
||||||
uint8_t Byte;
|
uint8_t raw;
|
||||||
struct {
|
struct {
|
||||||
uint8_t C2_IDISS_TIME : 2;
|
uint8_t C2_IDISS_TIME : 2;
|
||||||
uint8_t C2_BLANKING_TIME : 2;
|
uint8_t C2_BLANKING_TIME : 2;
|
||||||
uint8_t C2_SAMPLE_TIME : 2;
|
uint8_t C2_SAMPLE_TIME : 2;
|
||||||
uint8_t C2_BRAKE_STAB : 1;
|
uint8_t C2_BRAKE_STAB : 1;
|
||||||
uint8_t C2_BIDIR_INPUT : 1;
|
uint8_t C2_BIDIR_INPUT : 1;
|
||||||
} Bits;
|
} bits;
|
||||||
} DRVREG_CTRL2;
|
} drv2605l_reg_ctrl2_t;
|
||||||
|
|
||||||
typedef union DRVREG_CTRL3 { /* register 0x1D */
|
typedef union { /* register 0x1D */
|
||||||
uint8_t Byte;
|
uint8_t raw;
|
||||||
struct {
|
struct {
|
||||||
uint8_t C3_LRA_OPEN_LOOP : 1;
|
uint8_t C3_LRA_OPEN_LOOP : 1;
|
||||||
uint8_t C3_N_PWM_ANALOG : 1;
|
uint8_t C3_N_PWM_ANALOG : 1;
|
||||||
@ -380,11 +346,11 @@ typedef union DRVREG_CTRL3 { /* register 0x1D */
|
|||||||
uint8_t C3_SUPPLY_COMP_DIS : 1;
|
uint8_t C3_SUPPLY_COMP_DIS : 1;
|
||||||
uint8_t C3_ERM_OPEN_LOOP : 1;
|
uint8_t C3_ERM_OPEN_LOOP : 1;
|
||||||
uint8_t C3_NG_THRESH : 2;
|
uint8_t C3_NG_THRESH : 2;
|
||||||
} Bits;
|
} bits;
|
||||||
} DRVREG_CTRL3;
|
} drv2605l_reg_ctrl3_t;
|
||||||
|
|
||||||
typedef union DRVREG_CTRL4 { /* register 0x1E */
|
typedef union { /* register 0x1E */
|
||||||
uint8_t Byte;
|
uint8_t raw;
|
||||||
struct {
|
struct {
|
||||||
uint8_t C4_OTP_PROGRAM : 1;
|
uint8_t C4_OTP_PROGRAM : 1;
|
||||||
uint8_t : 1;
|
uint8_t : 1;
|
||||||
@ -392,16 +358,5 @@ typedef union DRVREG_CTRL4 { /* register 0x1E */
|
|||||||
uint8_t : 1;
|
uint8_t : 1;
|
||||||
uint8_t C4_AUTO_CAL_TIME : 2;
|
uint8_t C4_AUTO_CAL_TIME : 2;
|
||||||
uint8_t C4_ZC_DET_TIME : 2;
|
uint8_t C4_ZC_DET_TIME : 2;
|
||||||
} Bits;
|
} bits;
|
||||||
} DRVREG_CTRL4;
|
} drv2605l_reg_ctrl4_t;
|
||||||
|
|
||||||
typedef union DRVREG_CTRL5 { /* register 0x1F */
|
|
||||||
uint8_t Byte;
|
|
||||||
struct {
|
|
||||||
uint8_t C5_IDISS_TIME : 2;
|
|
||||||
uint8_t C5_BLANKING_TIME : 2;
|
|
||||||
uint8_t C5_PLAYBACK_INTERVAL : 1;
|
|
||||||
uint8_t C5_LRA_AUTO_OPEN_LOOP : 1;
|
|
||||||
uint8_t C5_AUTO_OL_CNT : 2;
|
|
||||||
} Bits;
|
|
||||||
} DRVREG_CTRL5;
|
|
||||||
|
@ -38,52 +38,52 @@
|
|||||||
|
|
||||||
/* Haptic Driver initialization settings
|
/* Haptic Driver initialization settings
|
||||||
* Feedback Control Settings */
|
* Feedback Control Settings */
|
||||||
#define FB_ERM_LRA 1 /* For ERM:0 or LRA:1*/
|
#define DRV2605L_FB_ERM_LRA 1 /* For ERM:0 or LRA:1*/
|
||||||
#define FB_BRAKEFACTOR 6 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */
|
#define DRV2605L_FB_BRAKEFACTOR 6 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */
|
||||||
#define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
|
#define DRV2605L_FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
|
||||||
|
|
||||||
/* default 3V ERM vibration motor voltage and library*/
|
/* default 3V ERM vibration motor voltage and library*/
|
||||||
#if FB_ERM_LRA == 0
|
#if DRV2605L_FB_ERM_LRA == 0
|
||||||
#define RATED_VOLTAGE 3
|
#define DRV2605L_RATED_VOLTAGE 3
|
||||||
#define V_RMS 2.3
|
#define DRV2605L_V_RMS 2.3
|
||||||
#define V_PEAK 3.30
|
#define DRV2605L_V_PEAK 3.30
|
||||||
/* Library Selection */
|
/* Library Selection */
|
||||||
#define DRV2605L_LIBRARY 4 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */
|
#define DRV2605L_LIBRARY 4 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */
|
||||||
|
|
||||||
/* default 2V LRA voltage and library */
|
/* default 2V LRA voltage and library */
|
||||||
#elif FB_ERM_LRA == 1
|
#elif DRV2605L_FB_ERM_LRA == 1
|
||||||
#define RATED_VOLTAGE 2
|
#define DRV2605L_RATED_VOLTAGE 2
|
||||||
#define V_RMS 2.0
|
#define DRV2605L_V_RMS 2.0
|
||||||
#define V_PEAK 2.85
|
#define DRV2605L_V_PEAK 2.85
|
||||||
#define F_LRA 200
|
#define DRV2605L_F_LRA 200
|
||||||
/* Library Selection */
|
/* Library Selection */
|
||||||
#define DRV2605L_LIBRARY 6 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */
|
#define DRV2605L_LIBRARY 6 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Control 1 register settings */
|
/* Control 1 register settings */
|
||||||
#define DRIVE_TIME 25
|
#define DRV2605L_DRIVE_TIME 25
|
||||||
#define AC_COUPLE 0
|
#define DRV2605L_AC_COUPLE 0
|
||||||
#define STARTUP_BOOST 1
|
#define DRV2605L_STARTUP_BOOST 1
|
||||||
|
|
||||||
/* Control 2 Settings */
|
/* Control 2 Settings */
|
||||||
#define BIDIR_INPUT 1
|
#define DRV2605L_BIDIR_INPUT 1
|
||||||
#define BRAKE_STAB 1 /* Loopgain is reduced when braking is almost complete to improve stability */
|
#define DRV2605L_BRAKE_STAB 1 /* Loopgain is reduced when braking is almost complete to improve stability */
|
||||||
#define SAMPLE_TIME 3
|
#define DRV2605L_SAMPLE_TIME 3
|
||||||
#define BLANKING_TIME 1
|
#define DRV2605L_BLANKING_TIME 1
|
||||||
#define IDISS_TIME 1
|
#define DRV2605L_IDISS_TIME 1
|
||||||
|
|
||||||
/* Control 3 settings */
|
/* Control 3 settings */
|
||||||
#define NG_THRESH 2
|
#define DRV2605L_NG_THRESH 2
|
||||||
#define ERM_OPEN_LOOP 1
|
#define DRV2605L_ERM_OPEN_LOOP 1
|
||||||
#define SUPPLY_COMP_DIS 0
|
#define DRV2605L_SUPPLY_COMP_DIS 0
|
||||||
#define DATA_FORMAT_RTO 0
|
#define DRV2605L_DATA_FORMAT_RTO 0
|
||||||
#define LRA_DRIVE_MODE 0
|
#define DRV2605L_LRA_DRIVE_MODE 0
|
||||||
#define N_PWM_ANALOG 0
|
#define DRV2605L_N_PWM_ANALOG 0
|
||||||
#define LRA_OPEN_LOOP 0
|
#define DRV2605L_LRA_OPEN_LOOP 0
|
||||||
/* Control 4 settings */
|
/* Control 4 settings */
|
||||||
#define ZC_DET_TIME 0
|
#define DRV2605L_ZC_DET_TIME 0
|
||||||
#define AUTO_CAL_TIME 3
|
#define DRV2605L_AUTO_CAL_TIME 3
|
||||||
|
|
||||||
#define RGBLIGHT_EFFECT_BREATHING
|
#define RGBLIGHT_EFFECT_BREATHING
|
||||||
#define RGBLIGHT_EFFECT_RAINBOW_MOOD
|
#define RGBLIGHT_EFFECT_RAINBOW_MOOD
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
#define NO_HAPTIC_PUNCTUATION
|
#define NO_HAPTIC_PUNCTUATION
|
||||||
#define NO_HAPTIC_NAV
|
#define NO_HAPTIC_NAV
|
||||||
#define NO_HAPTIC_NUMERIC
|
#define NO_HAPTIC_NUMERIC
|
||||||
#define DRV2605L_GREETING alert_750ms
|
#define DRV2605L_GREETING DRV2605L_EFFECT_750_MS_ALERT_100
|
||||||
#define DRV2605L_DEFAULT_MODE sharp_tick1
|
#define DRV2605L_DEFAULT_MODE DRV2605L_EFFECT_SHARP_TICK_1_100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PS2_MOUSE_ENABLE
|
#ifdef PS2_MOUSE_ENABLE
|
||||||
|
@ -23,19 +23,19 @@ void process_layer_pulse(layer_state_t state) {
|
|||||||
#ifdef HAPTIC_ENABLE
|
#ifdef HAPTIC_ENABLE
|
||||||
switch (get_highest_layer(state)) {
|
switch (get_highest_layer(state)) {
|
||||||
case 1:
|
case 1:
|
||||||
drv2605l_pulse(soft_bump);
|
drv2605l_pulse(DRV2605L_EFFECT_SOFT_BUMP_100);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
drv2605l_pulse(sh_dblsharp_tick);
|
drv2605l_pulse(DRV2605L_EFFECT_SHORT_DOUBLE_SHARP_TICK_1_100);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
drv2605l_pulse(lg_dblclick_str);
|
drv2605l_pulse(DRV2605L_EFFECT_LONG_DOUBLE_SHARP_CLICK_STRONG_1_100);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
drv2605l_pulse(soft_bump);
|
drv2605l_pulse(DRV2605L_EFFECT_SOFT_BUMP_100);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
drv2605l_pulse(pulsing_sharp);
|
drv2605l_pulse(DRV2605L_EFFECT_PULSING_SHARP_1_100);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
#define NO_HAPTIC_PUNCTUATION
|
#define NO_HAPTIC_PUNCTUATION
|
||||||
#define NO_HAPTIC_NAV
|
#define NO_HAPTIC_NAV
|
||||||
#define NO_HAPTIC_NUMERIC
|
#define NO_HAPTIC_NUMERIC
|
||||||
#define DRV2605L_GREETING alert_750ms
|
#define DRV2605L_GREETING DRV2605L_EFFECT_750_MS_ALERT_100
|
||||||
#define DRV2605L_DEFAULT_MODE sharp_tick1
|
#define DRV2605L_DEFAULT_MODE DRV2605L_EFFECT_SHARP_TICK_1_100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -100,27 +100,27 @@ __attribute__((weak)) layer_state_t layer_state_set_user(layer_state_t state) {
|
|||||||
switch (get_highest_layer(state)) {
|
switch (get_highest_layer(state)) {
|
||||||
case 1:
|
case 1:
|
||||||
#ifdef HAPTIC_ENABLE
|
#ifdef HAPTIC_ENABLE
|
||||||
drv2605l_pulse(soft_bump);
|
drv2605l_pulse(DRV2605L_EFFECT_SOFT_BUMP_100);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
#ifdef HAPTIC_ENABLE
|
#ifdef HAPTIC_ENABLE
|
||||||
drv2605l_pulse(sh_dblsharp_tick);
|
drv2605l_pulse(DRV2605L_EFFECT_SHORT_DOUBLE_SHARP_TICK_1_100);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
#ifdef HAPTIC_ENABLE
|
#ifdef HAPTIC_ENABLE
|
||||||
drv2605l_pulse(lg_dblclick_str);
|
drv2605l_pulse(DRV2605L_EFFECT_LONG_DOUBLE_SHARP_CLICK_STRONG_1_100);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
#ifdef HAPTIC_ENABLE
|
#ifdef HAPTIC_ENABLE
|
||||||
drv2605l_pulse(soft_bump);
|
drv2605l_pulse(DRV2605L_EFFECT_SOFT_BUMP_100);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
#ifdef HAPTIC_ENABLE
|
#ifdef HAPTIC_ENABLE
|
||||||
drv2605l_pulse(pulsing_sharp);
|
drv2605l_pulse(DRV2605L_EFFECT_PULSING_SHARP_1_100);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -60,52 +60,52 @@
|
|||||||
|
|
||||||
/* Haptic Driver initialization settings
|
/* Haptic Driver initialization settings
|
||||||
* Feedback Control Settings */
|
* Feedback Control Settings */
|
||||||
#define FB_ERM_LRA 1 /* For ERM:0 or LRA:1*/
|
#define DRV2605L_FB_ERM_LRA 1 /* For ERM:0 or LRA:1*/
|
||||||
#define FB_BRAKEFACTOR 6 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */
|
#define DRV2605L_FB_BRAKEFACTOR 6 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */
|
||||||
#define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
|
#define DRV2605L_FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
|
||||||
|
|
||||||
/* default 3V ERM vibration motor voltage and library*/
|
/* default 3V ERM vibration motor voltage and library*/
|
||||||
#if FB_ERM_LRA == 0
|
#if DRV2605L_FB_ERM_LRA == 0
|
||||||
#define RATED_VOLTAGE 3
|
#define DRV2605L_RATED_VOLTAGE 3
|
||||||
#define V_RMS 2.3
|
#define DRV2605L_V_RMS 2.3
|
||||||
#define V_PEAK 3.30
|
#define DRV2605L_V_PEAK 3.30
|
||||||
/* Library Selection */
|
/* Library Selection */
|
||||||
#define DRV2605L_LIBRARY 4 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */
|
#define DRV2605L_LIBRARY 4 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */
|
||||||
|
|
||||||
/* default 2V LRA voltage and library */
|
/* default 2V LRA voltage and library */
|
||||||
#elif FB_ERM_LRA == 1
|
#elif DRV2605L_FB_ERM_LRA == 1
|
||||||
#define RATED_VOLTAGE 2
|
#define DRV2605L_RATED_VOLTAGE 2
|
||||||
#define V_RMS 2.0
|
#define DRV2605L_V_RMS 2.0
|
||||||
#define V_PEAK 2.85
|
#define DRV2605L_V_PEAK 2.85
|
||||||
#define F_LRA 200
|
#define DRV2605L_F_LRA 200
|
||||||
/* Library Selection */
|
/* Library Selection */
|
||||||
#define DRV2605L_LIBRARY 6 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */
|
#define DRV2605L_LIBRARY 6 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Control 1 register settings */
|
/* Control 1 register settings */
|
||||||
#define DRIVE_TIME 25
|
#define DRV2605L_DRIVE_TIME 25
|
||||||
#define AC_COUPLE 0
|
#define DRV2605L_AC_COUPLE 0
|
||||||
#define STARTUP_BOOST 1
|
#define DRV2605L_STARTUP_BOOST 1
|
||||||
|
|
||||||
/* Control 2 Settings */
|
/* Control 2 Settings */
|
||||||
#define BIDIR_INPUT 1
|
#define DRV2605L_BIDIR_INPUT 1
|
||||||
#define BRAKE_STAB 1 /* Loopgain is reduced when braking is almost complete to improve stability */
|
#define DRV2605L_BRAKE_STAB 1 /* Loopgain is reduced when braking is almost complete to improve stability */
|
||||||
#define SAMPLE_TIME 3
|
#define DRV2605L_SAMPLE_TIME 3
|
||||||
#define BLANKING_TIME 1
|
#define DRV2605L_BLANKING_TIME 1
|
||||||
#define IDISS_TIME 1
|
#define DRV2605L_IDISS_TIME 1
|
||||||
|
|
||||||
/* Control 3 settings */
|
/* Control 3 settings */
|
||||||
#define NG_THRESH 2
|
#define DRV2605L_NG_THRESH 2
|
||||||
#define ERM_OPEN_LOOP 1
|
#define DRV2605L_ERM_OPEN_LOOP 1
|
||||||
#define SUPPLY_COMP_DIS 0
|
#define DRV2605L_SUPPLY_COMP_DIS 0
|
||||||
#define DATA_FORMAT_RTO 0
|
#define DRV2605L_DATA_FORMAT_RTO 0
|
||||||
#define LRA_DRIVE_MODE 0
|
#define DRV2605L_LRA_DRIVE_MODE 0
|
||||||
#define N_PWM_ANALOG 0
|
#define DRV2605L_N_PWM_ANALOG 0
|
||||||
#define LRA_OPEN_LOOP 0
|
#define DRV2605L_LRA_OPEN_LOOP 0
|
||||||
/* Control 4 settings */
|
/* Control 4 settings */
|
||||||
#define ZC_DET_TIME 0
|
#define DRV2605L_ZC_DET_TIME 0
|
||||||
#define AUTO_CAL_TIME 3
|
#define DRV2605L_AUTO_CAL_TIME 3
|
||||||
|
|
||||||
#define RGBLIGHT_EFFECT_BREATHING
|
#define RGBLIGHT_EFFECT_BREATHING
|
||||||
#define RGBLIGHT_EFFECT_RAINBOW_MOOD
|
#define RGBLIGHT_EFFECT_RAINBOW_MOOD
|
||||||
|
@ -17,13 +17,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#include QMK_KEYBOARD_H
|
#include QMK_KEYBOARD_H
|
||||||
|
|
||||||
#define SOLENOID_DEFAULT_BUZZ 1
|
#define SOLENOID_DEFAULT_BUZZ 1
|
||||||
#define FB_ERM_LRA 0
|
#define DRV2605L_FB_ERM_LRA 0
|
||||||
#define FB_BRAKEFACTOR 3 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */
|
#define DRV2605L_FB_BRAKEFACTOR 3 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */
|
||||||
#define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
|
#define DRV2605L_FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
|
||||||
|
|
||||||
/* Please refer to your datasheet for the optimal setting for your specific motor. */
|
/* Please refer to your datasheet for the optimal setting for your specific motor. */
|
||||||
#define RATED_VOLTAGE 3
|
#define DRV2605L_RATED_VOLTAGE 3
|
||||||
#define V_PEAK 5
|
#define DRV2605L_V_PEAK 5
|
||||||
|
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
[0] = LAYOUT_all(
|
[0] = LAYOUT_all(
|
||||||
|
@ -17,13 +17,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#include QMK_KEYBOARD_H
|
#include QMK_KEYBOARD_H
|
||||||
|
|
||||||
#define SOLENOID_DEFAULT_BUZZ 1
|
#define SOLENOID_DEFAULT_BUZZ 1
|
||||||
#define FB_ERM_LRA 0
|
#define DRV2605L_FB_ERM_LRA 0
|
||||||
#define FB_BRAKEFACTOR 3 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */
|
#define DRV2605L_FB_BRAKEFACTOR 3 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */
|
||||||
#define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
|
#define DRV2605L_FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
|
||||||
|
|
||||||
/* Please refer to your datasheet for the optimal setting for your specific motor. */
|
/* Please refer to your datasheet for the optimal setting for your specific motor. */
|
||||||
#define RATED_VOLTAGE 3
|
#define DRV2605L_RATED_VOLTAGE 3
|
||||||
#define V_PEAK 5
|
#define DRV2605L_V_PEAK 5
|
||||||
|
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
[0] = LAYOUT_all(
|
[0] = LAYOUT_all(
|
||||||
|
@ -31,6 +31,6 @@
|
|||||||
#define BOOTMAGIC_LITE_EEPROM_COLUMN_RIGHT 5
|
#define BOOTMAGIC_LITE_EEPROM_COLUMN_RIGHT 5
|
||||||
|
|
||||||
|
|
||||||
#define FB_ERM_LRA 0
|
#define DRV2605L_FB_ERM_LRA 0
|
||||||
#define DRV2605L_GREETING alert_750ms
|
#define DRV2605L_GREETING DRV2605L_EFFECT_750_MS_ALERT_100
|
||||||
#define DRV2605L_DEFAULT_MODE buzz
|
#define DRV2605L_DEFAULT_MODE DRV2605L_EFFECT_BUZZ_1_100
|
||||||
|
@ -10,16 +10,16 @@
|
|||||||
|
|
||||||
/* Haptic hardware */
|
/* Haptic hardware */
|
||||||
// The Pimoroni is the likely hardware, for which these settings work
|
// The Pimoroni is the likely hardware, for which these settings work
|
||||||
#define FB_ERM_LRA 1
|
#define DRV2605L_FB_ERM_LRA 1
|
||||||
#define FB_BRAKEFACTOR 3 /* 1x:0, 2x:1, 3x:2, 4x:3, 6:4, 8:5, 16:6, Disable:7 */
|
#define DRV2605L_FB_BRAKEFACTOR 3 /* 1x:0, 2x:1, 3x:2, 4x:3, 6:4, 8:5, 16:6, Disable:7 */
|
||||||
#define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
|
#define DRV2605L_FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
|
||||||
/* Please refer to your datasheet for optimal setting for your specific motor.*/
|
/* Please refer to your datasheet for optimal setting for your specific motor.*/
|
||||||
#define RATED_VOLTAGE 2
|
#define DRV2605L_RATED_VOLTAGE 2
|
||||||
#define V_PEAK 2.8
|
#define DRV2605L_V_PEAK 2.8
|
||||||
#define V_RMS 2.0
|
#define DRV2605L_V_RMS 2.0
|
||||||
#define F_LRA 205 /* resonance freq */
|
#define DRV2605L_F_LRA 205 /* resonance freq */
|
||||||
|
|
||||||
/* Haptic waveforms */
|
/* Haptic waveforms */
|
||||||
// Two mild waveforms
|
// Two mild waveforms
|
||||||
#define DRV2605L_GREETING alert_750ms
|
#define DRV2605L_GREETING DRV2605L_EFFECT_750_MS_ALERT_100
|
||||||
#define DRV2605L_DEFAULT_MODE sharp_tick3_60
|
#define DRV2605L_DEFAULT_MODE DRV2605L_EFFECT_SHARP_TICK_3_60
|
||||||
|
@ -5,16 +5,16 @@
|
|||||||
|
|
||||||
/* Haptic hardware */
|
/* Haptic hardware */
|
||||||
// The Pimoroni is the likely hardware, for which these settings work
|
// The Pimoroni is the likely hardware, for which these settings work
|
||||||
#define FB_ERM_LRA 1
|
#define DRV2605L_FB_ERM_LRA 1
|
||||||
#define FB_BRAKEFACTOR 3 /* 1x:0, 2x:1, 3x:2, 4x:3, 6:4, 8:5, 16:6, Disable:7 */
|
#define DRV2605L_FB_BRAKEFACTOR 3 /* 1x:0, 2x:1, 3x:2, 4x:3, 6:4, 8:5, 16:6, Disable:7 */
|
||||||
#define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
|
#define DRV2605L_FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
|
||||||
/* Please refer to your datasheet for optimal setting for your specific motor.*/
|
/* Please refer to your datasheet for optimal setting for your specific motor.*/
|
||||||
#define RATED_VOLTAGE 2
|
#define DRV2605L_RATED_VOLTAGE 2
|
||||||
#define V_PEAK 2.8
|
#define DRV2605L_V_PEAK 2.8
|
||||||
#define V_RMS 2.0
|
#define DRV2605L_V_RMS 2.0
|
||||||
#define F_LRA 205 /* resonance freq */
|
#define DRV2605L_F_LRA 205 /* resonance freq */
|
||||||
|
|
||||||
/* Haptic waveforms */
|
/* Haptic waveforms */
|
||||||
// Two mild waveforms
|
// Two mild waveforms
|
||||||
#define DRV2605L_GREETING alert_750ms
|
#define DRV2605L_GREETING DRV2605L_EFFECT_750_MS_ALERT_100
|
||||||
#define DRV2605L_DEFAULT_MODE sharp_tick3_60
|
#define DRV2605L_DEFAULT_MODE DRV2605L_EFFECT_SHARP_TICK_3_60
|
||||||
|
@ -10,16 +10,16 @@
|
|||||||
|
|
||||||
/* Haptic hardware */
|
/* Haptic hardware */
|
||||||
// The Pimoroni is the likely hardware, for which these settings work
|
// The Pimoroni is the likely hardware, for which these settings work
|
||||||
#define FB_ERM_LRA 1
|
#define DRV2605L_FB_ERM_LRA 1
|
||||||
#define FB_BRAKEFACTOR 3 /* 1x:0, 2x:1, 3x:2, 4x:3, 6:4, 8:5, 16:6, Disable:7 */
|
#define DRV2605L_FB_BRAKEFACTOR 3 /* 1x:0, 2x:1, 3x:2, 4x:3, 6:4, 8:5, 16:6, Disable:7 */
|
||||||
#define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
|
#define DRV2605L_FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
|
||||||
/* Please refer to your datasheet for optimal setting for your specific motor.*/
|
/* Please refer to your datasheet for optimal setting for your specific motor.*/
|
||||||
#define RATED_VOLTAGE 2
|
#define DRV2605L_RATED_VOLTAGE 2
|
||||||
#define V_PEAK 2.8
|
#define DRV2605L_V_PEAK 2.8
|
||||||
#define V_RMS 2.0
|
#define DRV2605L_V_RMS 2.0
|
||||||
#define F_LRA 205 /* resonance freq */
|
#define DRV2605L_F_LRA 205 /* resonance freq */
|
||||||
|
|
||||||
/* Haptic waveforms */
|
/* Haptic waveforms */
|
||||||
// Two mild waveforms
|
// Two mild waveforms
|
||||||
#define DRV2605L_GREETING alert_750ms
|
#define DRV2605L_GREETING DRV2605L_EFFECT_750_MS_ALERT_100
|
||||||
#define DRV2605L_DEFAULT_MODE sharp_tick3_60
|
#define DRV2605L_DEFAULT_MODE DRV2605L_EFFECT_SHARP_TICK_3_60
|
||||||
|
@ -22,12 +22,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define AUDIO_PIN C6
|
#define AUDIO_PIN C6
|
||||||
|
|
||||||
/* Haptic feedback */
|
/* Haptic feedback */
|
||||||
#define FB_ERM_LRA 0
|
#define DRV2605L_FB_ERM_LRA 0
|
||||||
#define FB_BRAKEFACTOR 3 // For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7
|
#define DRV2605L_FB_BRAKEFACTOR 3 // For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7
|
||||||
#define FB_LOOPGAIN 3 // For Low:0, Medium:1, High:2, Very High:3
|
#define DRV2605L_FB_LOOPGAIN 3 // For Low:0, Medium:1, High:2, Very High:3
|
||||||
/* Motor settings */
|
/* Motor settings */
|
||||||
#define RATED_VOLTAGE 3
|
#define DRV2605L_RATED_VOLTAGE 3
|
||||||
#define V_PEAK 5
|
#define DRV2605L_V_PEAK 5
|
||||||
|
|
||||||
/*== all animations enabled ==*/
|
/*== all animations enabled ==*/
|
||||||
#define RGBLIGHT_EFFECT_ALTERNATING
|
#define RGBLIGHT_EFFECT_ALTERNATING
|
||||||
|
@ -22,12 +22,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define AUDIO_PIN C6
|
#define AUDIO_PIN C6
|
||||||
|
|
||||||
/* Haptic feedback */
|
/* Haptic feedback */
|
||||||
#define FB_ERM_LRA 0
|
#define DRV2605L_FB_ERM_LRA 0
|
||||||
#define FB_BRAKEFACTOR 3 // For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7
|
#define DRV2605L_FB_BRAKEFACTOR 3 // For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7
|
||||||
#define FB_LOOPGAIN 1 // For Low:0, Medium:1, High:2, Very High:3
|
#define DRV2605L_FB_LOOPGAIN 1 // For Low:0, Medium:1, High:2, Very High:3
|
||||||
/* Motor settings */
|
/* Motor settings */
|
||||||
#define RATED_VOLTAGE 3
|
#define DRV2605L_RATED_VOLTAGE 3
|
||||||
#define V_PEAK 5
|
#define DRV2605L_V_PEAK 5
|
||||||
|
|
||||||
/*== all animations enabled ==*/
|
/*== all animations enabled ==*/
|
||||||
#define RGBLIGHT_EFFECT_ALTERNATING
|
#define RGBLIGHT_EFFECT_ALTERNATING
|
||||||
|
@ -26,12 +26,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Haptic feedback */
|
/* Haptic feedback */
|
||||||
#define FB_ERM_LRA 0
|
#define DRV2605L_FB_ERM_LRA 0
|
||||||
#define FB_BRAKEFACTOR 1 // For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7
|
#define DRV2605L_FB_BRAKEFACTOR 1 // For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7
|
||||||
#define FB_LOOPGAIN 3 // For Low:0, Medium:1, High:2, Very High:3
|
#define DRV2605L_FB_LOOPGAIN 3 // For Low:0, Medium:1, High:2, Very High:3
|
||||||
/* Motor settings */
|
/* Motor settings */
|
||||||
#define RATED_VOLTAGE 2
|
#define DRV2605L_RATED_VOLTAGE 2
|
||||||
#define V_PEAK 5
|
#define DRV2605L_V_PEAK 5
|
||||||
|
|
||||||
/*== all animations enabled ==*/
|
/*== all animations enabled ==*/
|
||||||
#define RGBLIGHT_EFFECT_ALTERNATING
|
#define RGBLIGHT_EFFECT_ALTERNATING
|
||||||
|
@ -27,13 +27,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define RGBLIGHT_EFFECT_STATIC_GRADIENT
|
#define RGBLIGHT_EFFECT_STATIC_GRADIENT
|
||||||
#define RGBLIGHT_EFFECT_TWINKLE
|
#define RGBLIGHT_EFFECT_TWINKLE
|
||||||
|
|
||||||
#define FB_ERM_LRA 0
|
#define DRV2605L_FB_ERM_LRA 0
|
||||||
#define FB_BRAKEFACTOR 3 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */
|
#define DRV2605L_FB_BRAKEFACTOR 3 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */
|
||||||
#define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
|
#define DRV2605L_FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
|
||||||
|
|
||||||
/* Please refer to your datasheet for the optimal setting for your specific motor. */
|
/* Please refer to your datasheet for the optimal setting for your specific motor. */
|
||||||
#define RATED_VOLTAGE 3
|
#define DRV2605L_RATED_VOLTAGE 3
|
||||||
#define V_PEAK 5
|
#define DRV2605L_V_PEAK 5
|
||||||
|
|
||||||
#define DRV2605L_GREETING alert_750ms
|
#define DRV2605L_GREETING DRV2605L_EFFECT_750_MS_ALERT_100
|
||||||
#define DRV2605L_DEFAULT_MODE buzz
|
#define DRV2605L_DEFAULT_MODE DRV2605L_EFFECT_BUZZ_1_100
|
||||||
|
@ -105,49 +105,49 @@
|
|||||||
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
|
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
|
||||||
//#define MIDI_TONE_KEYCODE_OCTAVES 2
|
//#define MIDI_TONE_KEYCODE_OCTAVES 2
|
||||||
|
|
||||||
#define FB_ERM_LRA 1 /* For ERM:0 or LRA:1*/
|
#define DRV2605L_FB_ERM_LRA 1 /* For ERM:0 or LRA:1*/
|
||||||
#define FB_BRAKEFACTOR 6 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */
|
#define DRV2605L_FB_BRAKEFACTOR 6 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */
|
||||||
#define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
|
#define DRV2605L_FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
|
||||||
|
|
||||||
/* default 3V ERM vibration motor voltage and library*/
|
/* default 3V ERM vibration motor voltage and library*/
|
||||||
#if FB_ERM_LRA == 0
|
#if DRV2605L_FB_ERM_LRA == 0
|
||||||
# define RATED_VOLTAGE 3
|
# define DRV2605L_RATED_VOLTAGE 3
|
||||||
# define V_RMS 2.3
|
# define DRV2605L_V_RMS 2.3
|
||||||
# define V_PEAK 3.30
|
# define DRV2605L_V_PEAK 3.30
|
||||||
/* Library Selection */
|
/* Library Selection */
|
||||||
# define DRV2605L_LIBRARY 4 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */
|
# define DRV2605L_LIBRARY 4 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */
|
||||||
|
|
||||||
/* default 2V LRA voltage and library */
|
/* default 2V LRA voltage and library */
|
||||||
#elif FB_ERM_LRA == 1
|
#elif DRV2605L_FB_ERM_LRA == 1
|
||||||
# define RATED_VOLTAGE 2
|
# define DRV2605L_RATED_VOLTAGE 2
|
||||||
# define V_RMS 2.0
|
# define DRV2605L_V_RMS 2.0
|
||||||
# define V_PEAK 2.85
|
# define DRV2605L_V_PEAK 2.85
|
||||||
# define F_LRA 200
|
# define DRV2605L_F_LRA 200
|
||||||
/* Library Selection */
|
/* Library Selection */
|
||||||
# define DRV2605L_LIBRARY 6 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */
|
# define DRV2605L_LIBRARY 6 /* For Empty:0' TS2200 library A to D:1-5, LRA Library: 6 */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Control 1 register settings */
|
/* Control 1 register settings */
|
||||||
#define DRIVE_TIME 25
|
#define DRV2605L_DRIVE_TIME 25
|
||||||
#define AC_COUPLE 0
|
#define DRV2605L_AC_COUPLE 0
|
||||||
#define STARTUP_BOOST 1
|
#define DRV2605L_STARTUP_BOOST 1
|
||||||
|
|
||||||
/* Control 2 Settings */
|
/* Control 2 Settings */
|
||||||
#define BIDIR_INPUT 1
|
#define DRV2605L_BIDIR_INPUT 1
|
||||||
#define BRAKE_STAB 1 /* Loopgain is reduced when braking is almost complete to improve stability */
|
#define DRV2605L_BRAKE_STAB 1 /* Loopgain is reduced when braking is almost complete to improve stability */
|
||||||
#define SAMPLE_TIME 3
|
#define DRV2605L_SAMPLE_TIME 3
|
||||||
#define BLANKING_TIME 1
|
#define DRV2605L_BLANKING_TIME 1
|
||||||
#define IDISS_TIME 1
|
#define DRV2605L_IDISS_TIME 1
|
||||||
|
|
||||||
/* Control 3 settings */
|
/* Control 3 settings */
|
||||||
#define NG_THRESH 2
|
#define DRV2605L_NG_THRESH 2
|
||||||
#define ERM_OPEN_LOOP 1
|
#define DRV2605L_ERM_OPEN_LOOP 1
|
||||||
#define SUPPLY_COMP_DIS 0
|
#define DRV2605L_SUPPLY_COMP_DIS 0
|
||||||
#define DATA_FORMAT_RTO 0
|
#define DRV2605L_DATA_FORMAT_RTO 0
|
||||||
#define LRA_DRIVE_MODE 0
|
#define DRV2605L_LRA_DRIVE_MODE 0
|
||||||
#define N_PWM_ANALOG 0
|
#define DRV2605L_N_PWM_ANALOG 0
|
||||||
#define LRA_OPEN_LOOP 0
|
#define DRV2605L_LRA_OPEN_LOOP 0
|
||||||
/* Control 4 settings */
|
/* Control 4 settings */
|
||||||
#define ZC_DET_TIME 0
|
#define DRV2605L_ZC_DET_TIME 0
|
||||||
#define AUTO_CAL_TIME 3
|
#define DRV2605L_AUTO_CAL_TIME 3
|
||||||
|
@ -146,7 +146,7 @@ void haptic_buzz_toggle(void) {
|
|||||||
void haptic_mode_increase(void) {
|
void haptic_mode_increase(void) {
|
||||||
uint8_t mode = haptic_config.mode + 1;
|
uint8_t mode = haptic_config.mode + 1;
|
||||||
#ifdef HAPTIC_DRV2605L
|
#ifdef HAPTIC_DRV2605L
|
||||||
if (haptic_config.mode >= drv_effect_max) {
|
if (haptic_config.mode >= DRV2605L_EFFECT_COUNT) {
|
||||||
mode = 1;
|
mode = 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -157,7 +157,7 @@ void haptic_mode_decrease(void) {
|
|||||||
uint8_t mode = haptic_config.mode - 1;
|
uint8_t mode = haptic_config.mode - 1;
|
||||||
#ifdef HAPTIC_DRV2605L
|
#ifdef HAPTIC_DRV2605L
|
||||||
if (haptic_config.mode < 1) {
|
if (haptic_config.mode < 1) {
|
||||||
mode = (drv_effect_max - 1);
|
mode = (DRV2605L_EFFECT_COUNT - 1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
haptic_set_mode(mode);
|
haptic_set_mode(mode);
|
||||||
|
Loading…
Reference in New Issue
Block a user