You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

165 lines
12 KiB

2020 November 28 Breaking Changes Update (#11053) * Branch point for 2020 November 28 Breaking Change * Remove matrix_col_t to allow MATRIX_ROWS > 32 (#10183) * Add support for soft serial to ATmega32U2 (#10204) * Change MIDI velocity implementation to allow direct control of velocity value (#9940) * Add ability to build a subset of all keyboards based on platform. * Actually use eeprom_driver_init(). * Make bootloader_jump weak for ChibiOS. (#10417) * Joystick 16-bit support (#10439) * Per-encoder resolutions (#10259) * Share button state from mousekey to pointing_device (#10179) * Add hotfix for chibios keyboards not wake (#10088) * Add advanced/efficient RGB Matrix Indicators (#8564) * Naming change. * Support for STM32 GPIOF,G,H,I,J,K (#10206) * Add milc as a dependency and remove the installed milc (#10563) * ChibiOS upgrade: early init conversions (#10214) * ChibiOS upgrade: configuration file migrator (#9952) * Haptic and solenoid cleanup (#9700) * XD75 cleanup (#10524) * OLED display update interval support (#10388) * Add definition based on currently-selected serial driver. (#10716) * New feature: Retro Tapping per key (#10622) * Allow for modification of output RGB values when using rgblight/rgb_matrix. (#10638) * Add housekeeping task callbacks so that keyboards/keymaps are capable of executing code for each main loop iteration. (#10530) * Rescale both ChibiOS and AVR backlighting. * Reduce Helix keyboard build variation (#8669) * Minor change to behavior allowing display updates to continue between task ticks (#10750) * Some GPIO manipulations in matrix.c change to atomic. (#10491) * qmk cformat (#10767) * [Keyboard] Update the Speedo firmware for v3.0 (#10657) * Maartenwut/Maarten namechange to evyd13/Evy (#10274) * [quantum] combine repeated lines of code (#10837) * Add step sequencer feature (#9703) * aeboards/ext65 refactor (#10820) * Refactor xelus/dawn60 for Rev2 later (#10584) * add DEBUG_MATRIX_SCAN_RATE_ENABLE to common_features.mk (#10824) * [Core] Added `add_oneshot_mods` & `del_oneshot_mods` (#10549) * update chibios os usb for the otg driver (#8893) * Remove HD44780 References, Part 4 (#10735) * [Keyboard] Add Valor FRL TKL (+refactor) (#10512) * Fix cursor position bug in oled_write_raw functions (#10800) * Fixup version.h writing when using SKIP_VERSION=yes (#10972) * Allow for certain code in the codebase assuming length of string. (#10974) * Add AT90USB support for serial.c (#10706) * Auto shift: support repeats and early registration (#9826) * Rename ledmatrix.h to match .c file (#7949) * Split RGB_MATRIX_ENABLE into _ENABLE and _DRIVER (#10231) * Split LED_MATRIX_ENABLE into _ENABLE and _DRIVER (#10840) * Merge point for 2020 Nov 28 Breaking Change
3 years ago
  1. # Haptic Feedback
  2. ## Haptic feedback rules.mk options
  3. The following options are currently available for haptic feedback in `rules.mk`:
  4. `HAPTIC_ENABLE += DRV2605L`
  5. `HAPTIC_ENABLE += SOLENOID`
  6. ## Known Supported Hardware
  7. | Name | Description |
  8. |--------------------|-------------------------------------------------|
  9. | [LV061228B-L65-A](https://www.digikey.com/product-detail/en/jinlong-machinery-electronics-inc/LV061228B-L65-A/1670-1050-ND/7732325) | z-axis 2v LRA |
  10. | [Mini Motor Disc](https://www.adafruit.com/product/1201) | small 2-5v ERM |
  11. ## Haptic Keycodes
  12. Not all keycodes below will work depending on which haptic mechanism you have chosen.
  13. | Name | Description |
  14. |-----------|-------------------------------------------------------|
  15. |`HPT_ON` | Turn haptic feedback on |
  16. |`HPT_OFF` | Turn haptic feedback off |
  17. |`HPT_TOG` | Toggle haptic feedback on/off |
  18. |`HPT_RST` | Reset haptic feedback config to default |
  19. |`HPT_FBK` | Toggle feedback to occur on keypress, release or both |
  20. |`HPT_BUZ` | Toggle solenoid buzz on/off |
  21. |`HPT_MODI` | Go to next DRV2605L waveform |
  22. |`HPT_MODD` | Go to previous DRV2605L waveform |
  23. |`HPT_CONT` | Toggle continuous haptic mode on/off |
  24. |`HPT_CONI` | Increase DRV2605L continous haptic strength |
  25. |`HPT_COND` | Decrease DRV2605L continous haptic strength |
  26. |`HPT_DWLI` | Increase Solenoid dwell time |
  27. |`HPT_DWLD` | Decrease Solenoid dwell time |
  28. ### Solenoids
  29. First you will need a build a circuit to drive the solenoid through a mosfet as most MCU will not be able to provide the current needed to drive the coil in the solenoid.
  30. [Wiring diagram provided by Adafruit](https://playground.arduino.cc/uploads/Learning/solenoid_driver.pdf)
  31. | Settings | Default | Description |
  32. |----------------------------|----------------------|-------------------------------------------------------|
  33. |`SOLENOID_PIN` | *Not defined* |Configures the pin that the Solenoid is connected to. |
  34. |`SOLENOID_DEFAULT_DWELL` | `12` ms |Configures the default dwell time for the solenoid. |
  35. |`SOLENOID_MIN_DWELL` | `4` ms |Sets the lower limit for the dwell. |
  36. |`SOLENOID_MAX_DWELL` | `100` ms |Sets the upper limit for the dwell. |
  37. |`SOLENOID_DWELL_STEP_SIZE` | `1` ms |The step size to use when `HPT_DWL*` keycodes are sent |
  38. |`SOLENOID_DEFAULT_BUZZ` | `0` (disabled) |On HPT_RST buzz is set "on" if this is "1" |
  39. |`SOLENOID_BUZZ_ACTUATED` | `SOLENOID_MIN_DWELL` |Actuated-time when the solenoid is in buzz mode |
  40. |`SOLENOID_BUZZ_NONACTUATED` | `SOLENOID_MIN_DWELL` |Non-Actuated-time when the solenoid is in buzz mode |
  41. * If solenoid buzz is off, then dwell time is how long the "plunger" stays activated. The dwell time changes how the solenoid sounds.
  42. * If solenoid buzz is on, then dwell time sets the length of the buzz, while `SOLENOID_BUZZ_ACTUATED` and `SOLENOID_BUZZ_NONACTUATED` set the (non-)actuation times withing the buzz period.
  43. * With the current implementation, for any of the above time settings, the precision of these settings may be affected by how fast the keyboard is able to scan the matrix.
  44. Therefore, if the keyboards scanning routine is slow, it may be preferable to set `SOLENOID_DWELL_STEP_SIZE` to a value slightly smaller than the time it takes to scan the keyboard.
  45. Beware that some pins may be powered during bootloader (ie. A13 on the STM32F303 chip) and will result in the solenoid kept in the on state through the whole flashing process. This may overheat and damage the solenoid. If you find that the pin the solenoid is connected to is triggering the solenoid during bootloader/DFU, select another pin.
  46. ### DRV2605L
  47. DRV2605L is controlled over i2c protocol, and has to be connected to the SDA and SCL pins, these varies depending on the MCU in use.
  48. #### Feedback motor setup
  49. This driver supports 2 different feedback motors. Set the following in your `config.h` based on which motor you have selected.
  50. ##### ERM
  51. 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.
  52. ```
  53. #define FB_ERM_LRA 0
  54. #define FB_BRAKEFACTOR 3 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */
  55. #define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
  56. /* Please refer to your datasheet for the optimal setting for your specific motor. */
  57. #define RATED_VOLTAGE 3
  58. #define V_PEAK 5
  59. ```
  60. ##### LRA
  61. 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.
  62. ```
  63. #define FB_ERM_LRA 1
  64. #define FB_BRAKEFACTOR 3 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */
  65. #define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
  66. /* Please refer to your datasheet for the optimal setting for your specific motor. */
  67. #define RATED_VOLTAGE 2
  68. #define V_PEAK 2.8
  69. #define V_RMS 2.0
  70. #define V_PEAK 2.1
  71. #define F_LRA 205 /* resonance freq */
  72. ```
  73. #### DRV2605L waveform library
  74. DRV2605L comes with preloaded library of various waveform sequences that can be called and played. If writing a macro, these waveforms can be played using `DRV_pulse(*sequence name or number*)`
  75. List of waveform sequences from the datasheet:
  76. |seq# | Sequence name |seq# | Sequence name |seq# |Sequence name |
  77. |-----|---------------------|-----|-----------------------------------|-----|--------------------------------------|
  78. | 1 | strong_click | 43 | lg_dblclick_med_60 | 85 | transition_rampup_med_smooth2 |
  79. | 2 | strong_click_60 | 44 | lg_dblsharp_tick | 86 | transition_rampup_short_smooth1 |
  80. | 3 | strong_click_30 | 45 | lg_dblsharp_tick_80 | 87 | transition_rampup_short_smooth2 |
  81. | 4 | sharp_click | 46 | lg_dblsharp_tick_60 | 88 | transition_rampup_long_sharp1 |
  82. | 5 | sharp_click_60 | 47 | buzz | 89 | transition_rampup_long_sharp2 |
  83. | 6 | sharp_click_30 | 48 | buzz_80 | 90 | transition_rampup_med_sharp1 |
  84. | 7 | soft_bump | 49 | buzz_60 | 91 | transition_rampup_med_sharp2 |
  85. | 8 | soft_bump_60 | 50 | buzz_40 | 92 | transition_rampup_short_sharp1 |
  86. | 9 | soft_bump_30 | 51 | buzz_20 | 93 | transition_rampup_short_sharp2 |
  87. | 10 | dbl_click | 52 | pulsing_strong | 94 | transition_rampdown_long_smooth1_50 |
  88. | 11 | dbl_click_60 | 53 | pulsing_strong_80 | 95 | transition_rampdown_long_smooth2_50 |
  89. | 12 | trp_click | 54 | pulsing_medium | 96 | transition_rampdown_med_smooth1_50 |
  90. | 13 | soft_fuzz | 55 | pulsing_medium_80 | 97 | transition_rampdown_med_smooth2_50 |
  91. | 14 | strong_buzz | 56 | pulsing_sharp | 98 | transition_rampdown_short_smooth1_50 |
  92. | 15 | alert_750ms | 57 | pulsing_sharp_80 | 99 | transition_rampdown_short_smooth2_50 |
  93. | 16 | alert_1000ms | 58 | transition_click | 100 | transition_rampdown_long_sharp1_50 |
  94. | 17 | strong_click1 | 59 | transition_click_80 | 101 | transition_rampdown_long_sharp2_50 |
  95. | 18 | strong_click2_80 | 60 | transition_click_60 | 102 | transition_rampdown_med_sharp1_50 |
  96. | 19 | strong_click3_60 | 61 | transition_click_40 | 103 | transition_rampdown_med_sharp2_50 |
  97. | 20 | strong_click4_30 | 62 | transition_click_20 | 104 | transition_rampdown_short_sharp1_50 |
  98. | 21 | medium_click1 | 63 | transition_click_10 | 105 | transition_rampdown_short_sharp2_50 |
  99. | 22 | medium_click2_80 | 64 | transition_hum | 106 | transition_rampup_long_smooth1_50 |
  100. | 23 | medium_click3_60 | 65 | transition_hum_80 | 107 | transition_rampup_long_smooth2_50 |
  101. | 24 | sharp_tick1 | 66 | transition_hum_60 | 108 | transition_rampup_med_smooth1_50 |
  102. | 25 | sharp_tick2_80 | 67 | transition_hum_40 | 109 | transition_rampup_med_smooth2_50 |
  103. | 26 | sharp_tick3_60 | 68 | transition_hum_20 | 110 | transition_rampup_short_smooth1_50 |
  104. | 27 | sh_dblclick_str | 69 | transition_hum_10 | 111 | transition_rampup_short_smooth2_50 |
  105. | 28 | sh_dblclick_str_80 | 70 | transition_rampdown_long_smooth1 | 112 | transition_rampup_long_sharp1_50 |
  106. | 29 | sh_dblclick_str_60 | 71 | transition_rampdown_long_smooth2 | 113 | transition_rampup_long_sharp2_50 |
  107. | 30 | sh_dblclick_str_30 | 72 | transition_rampdown_med_smooth1 | 114 | transition_rampup_med_sharp1_50 |
  108. | 31 | sh_dblclick_med | 73 | transition_rampdown_med_smooth2 | 115 | transition_rampup_med_sharp2_50 |
  109. | 32 | sh_dblclick_med_80 | 74 | transition_rampdown_short_smooth1 | 116 | transition_rampup_short_sharp1_50 |
  110. | 33 | sh_dblclick_med_60 | 75 | transition_rampdown_short_smooth2 | 117 | transition_rampup_short_sharp2_50 |
  111. | 34 | sh_dblsharp_tick | 76 | transition_rampdown_long_sharp1 | 118 | long_buzz_for_programmatic_stopping |
  112. | 35 | sh_dblsharp_tick_80 | 77 | transition_rampdown_long_sharp2 | 119 | smooth_hum1_50 |
  113. | 36 | sh_dblsharp_tick_60 | 78 | transition_rampdown_med_sharp1 | 120 | smooth_hum2_40 |
  114. | 37 | lg_dblclick_str | 79 | transition_rampdown_med_sharp2 | 121 | smooth_hum3_30 |
  115. | 38 | lg_dblclick_str_80 | 80 | transition_rampdown_short_sharp1 | 122 | smooth_hum4_20 |
  116. | 39 | lg_dblclick_str_60 | 81 | transition_rampdown_short_sharp2 | 123 | smooth_hum5_10 |
  117. | 40 | lg_dblclick_str_30 | 82 | transition_rampup_long_smooth1 | | |
  118. | 41 | lg_dblclick_med | 83 | transition_rampup_long_smooth2 | | |
  119. | 42 | lg_dblclick_med_80 | 84 | transition_rampup_med_smooth1 | | |
  120. ### Optional DRV2605L defines
  121. ```
  122. #define DRV_GREETING *sequence name or number*
  123. ```
  124. If haptic feedback is enabled, the keyboard will vibrate to a specific sqeuence during startup. That can be selected using the following define:
  125. ```
  126. #define DRV_MODE_DEFAULT *sequence name or number*
  127. ```
  128. This will set what sequence HPT_RST will set as the active mode. If not defined, mode will be set to 1 when HPT_RST is pressed.
  129. ### DRV2605L Continuous Haptic Mode
  130. This mode sets continuous haptic feedback with the option to increase or decrease strength.