Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align haptic feedback keycode names #18964

Merged
merged 1 commit into from
Nov 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 52 additions & 13 deletions data/constants/keycodes/keycodes_0.0.1_quantum.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -214,55 +214,94 @@

"0x7C40": {
"group": "quantum",
"key": "HPT_ON"
"key": "QK_HAPTIC_ON",
"aliases": [
"HF_ON"
]
},
"0x7C41": {
"group": "quantum",
"key": "HPT_OFF"
"key": "QK_HAPTIC_OFF",
"aliases": [
"HF_OFF"
]
},
"0x7C42": {
"group": "quantum",
"key": "HPT_TOG"
"key": "QK_HAPTIC_TOGGLE",
"aliases": [
"HF_TOGG"
]
},
"0x7C43": {
"group": "quantum",
"key": "HPT_RST"
"key": "QK_HAPTIC_RESET",
"aliases": [
"HF_RST"
]
},
"0x7C44": {
"group": "quantum",
"key": "HPT_FBK"
"key": "QK_HAPTIC_FEEDBACK_TOGGLE",
"aliases": [
"HF_FDBK"
]
},
"0x7C45": {
"group": "quantum",
"key": "HPT_BUZ"
"key": "QK_HAPTIC_BUZZ_TOGGLE",
"aliases": [
"HF_BUZZ"
]
},
"0x7C46": {
"group": "quantum",
"key": "HPT_MODI"
"key": "QK_HAPTIC_MODE_NEXT",
"aliases": [
"HF_NEXT"
]
},
"0x7C47": {
"group": "quantum",
"key": "HPT_MODD"
"key": "QK_HAPTIC_MODE_PREVIOUS",
"aliases": [
"HF_PREV"
]
},
"0x7C48": {
"group": "quantum",
"key": "HPT_CONT"
"key": "QK_HAPTIC_CONTINUOUS_TOGGLE",
"aliases": [
"HF_CONT"
]
},
"0x7C49": {
"group": "quantum",
"key": "HPT_CONI"
"key": "QK_HAPTIC_CONTINUOUS_UP",
"aliases": [
"HF_CONU"
]
},
"0x7C4A": {
"group": "quantum",
"key": "HPT_COND"
"key": "QK_HAPTIC_CONTINUOUS_DOWN",
"aliases": [
"HF_COND"
]
},
"0x7C4B": {
"group": "quantum",
"key": "HPT_DWLI"
"key": "QK_HAPTIC_DWELL_UP",
"aliases": [
"HF_DWLU"
]
},
"0x7C4C": {
"group": "quantum",
"key": "HPT_DWLD"
"key": "QK_HAPTIC_DWELL_DOWN",
"aliases": [
"HF_DWLD"
]
},

"0x7C50": {
Expand Down
36 changes: 18 additions & 18 deletions docs/feature_haptic_feedback.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@ The following `config.h` settings are available for all types of haptic feedback

Not all keycodes below will work depending on which haptic mechanism you have chosen.

| Name | Description |
|-----------|-------------------------------------------------------|
|`HPT_ON` | Turn haptic feedback on |
|`HPT_OFF` | Turn haptic feedback off |
|`HPT_TOG` | Toggle haptic feedback on/off |
|`HPT_RST` | Reset haptic feedback config to default |
|`HPT_FBK` | Toggle feedback to occur on keypress, release or both |
|`HPT_BUZ` | Toggle solenoid buzz on/off |
|`HPT_MODI` | Go to next DRV2605L waveform |
|`HPT_MODD` | Go to previous DRV2605L waveform |
|`HPT_CONT` | Toggle continuous haptic mode on/off |
|`HPT_CONI` | Increase DRV2605L continous haptic strength |
|`HPT_COND` | Decrease DRV2605L continous haptic strength |
|`HPT_DWLI` | Increase Solenoid dwell time |
|`HPT_DWLD` | Decrease Solenoid dwell time |
| Key | Aliases | Description |
|-----------------------------|---------|-------------------------------------------------------|
|`QK_HAPTIC_ON` |`HF_ON` | Turn haptic feedback on |
|`QK_HAPTIC_OFF` |`HF_OFF` | Turn haptic feedback off |
|`QK_HAPTIC_TOGGLE` |`HF_TOGG`| Toggle haptic feedback on/off |
|`QK_HAPTIC_RESET` |`HF_RST` | Reset haptic feedback config to default |
|`QK_HAPTIC_FEEDBACK_TOGGLE` |`HF_FDBK`| Toggle feedback to occur on keypress, release or both |
|`QK_HAPTIC_BUZZ_TOGGLE` |`HF_BUZZ`| Toggle solenoid buzz on/off |
|`QK_HAPTIC_MODE_NEXT` |`HF_NEXT`| Go to next DRV2605L waveform |
|`QK_HAPTIC_MODE_PREVIOUS` |`HF_PREV`| Go to previous DRV2605L waveform |
|`QK_HAPTIC_CONTINUOUS_TOGGLE`|`HF_CONT`| Toggle continuous haptic mode on/off |
|`QK_HAPTIC_CONTINUOUS_UP` |`HF_CONU`| Increase DRV2605L continous haptic strength |
|`QK_HAPTIC_CONTINUOUS_DOWN` |`HF_COND`| Decrease DRV2605L continous haptic strength |
|`QK_HAPTIC_DWELL_UP` |`HF_DWLU`| Increase Solenoid dwell time |
|`QK_HAPTIC_DWELL_DOWN` |`HF_DWLD`| Decrease Solenoid dwell time |

### Solenoids

Expand All @@ -68,8 +68,8 @@ For relay switches, the hardware may already contain all of that ciruitry, and j
|`SOLENOID_DEFAULT_DWELL` | `12` ms |Configures the default dwell time for the switch. |
|`SOLENOID_MIN_DWELL` | `4` ms |Sets the lower limit for the dwell. |
|`SOLENOID_MAX_DWELL` | `100` ms |Sets the upper limit for the dwell. |
|`SOLENOID_DWELL_STEP_SIZE` | `1` ms |The step size to use when `HPT_DWL*` keycodes are sent. |
|`SOLENOID_DEFAULT_BUZZ` | `0` (disabled) |On HPT_RST buzz is set "on" if this is "1" |
|`SOLENOID_DWELL_STEP_SIZE` | `1` ms |The step size to use when `HF_DWL*` keycodes are sent. |
|`SOLENOID_DEFAULT_BUZZ` | `0` (disabled) |On `HF_RST` buzz is set "on" if this is "1" |
|`SOLENOID_BUZZ_ACTUATED` | `SOLENOID_MIN_DWELL` |Actuated-time when the switch is in buzz mode. |
|`SOLENOID_BUZZ_NONACTUATED` | `SOLENOID_MIN_DWELL` |Non-Actuated-time when the switch is in buzz mode. |

Expand Down Expand Up @@ -178,7 +178,7 @@ If haptic feedback is enabled, the keyboard will vibrate to a specific sequence
```
#define DRV_MODE_DEFAULT *sequence name or number*
```
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.
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.

### DRV2605L Continuous Haptic Mode

Expand Down
39 changes: 26 additions & 13 deletions quantum/keycodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -673,19 +673,19 @@ enum qk_keycode_defines {
QK_UNICODE_MODE_BSD = 0x7C35,
QK_UNICODE_MODE_WINCOMPOSE = 0x7C36,
QK_UNICODE_MODE_EMACS = 0x7C37,
HPT_ON = 0x7C40,
HPT_OFF = 0x7C41,
HPT_TOG = 0x7C42,
HPT_RST = 0x7C43,
HPT_FBK = 0x7C44,
HPT_BUZ = 0x7C45,
HPT_MODI = 0x7C46,
HPT_MODD = 0x7C47,
HPT_CONT = 0x7C48,
HPT_CONI = 0x7C49,
HPT_COND = 0x7C4A,
HPT_DWLI = 0x7C4B,
HPT_DWLD = 0x7C4C,
QK_HAPTIC_ON = 0x7C40,
QK_HAPTIC_OFF = 0x7C41,
QK_HAPTIC_TOGGLE = 0x7C42,
QK_HAPTIC_RESET = 0x7C43,
QK_HAPTIC_FEEDBACK_TOGGLE = 0x7C44,
QK_HAPTIC_BUZZ_TOGGLE = 0x7C45,
QK_HAPTIC_MODE_NEXT = 0x7C46,
QK_HAPTIC_MODE_PREVIOUS = 0x7C47,
QK_HAPTIC_CONTINUOUS_TOGGLE = 0x7C48,
QK_HAPTIC_CONTINUOUS_UP = 0x7C49,
QK_HAPTIC_CONTINUOUS_DOWN = 0x7C4A,
QK_HAPTIC_DWELL_UP = 0x7C4B,
QK_HAPTIC_DWELL_DOWN = 0x7C4C,
QK_COMBO_ON = 0x7C50,
QK_COMBO_OFF = 0x7C51,
QK_COMBO_TOGGLE = 0x7C52,
Expand Down Expand Up @@ -1229,6 +1229,19 @@ enum qk_keycode_defines {
UC_BSD = QK_UNICODE_MODE_BSD,
UC_WINC = QK_UNICODE_MODE_WINCOMPOSE,
UC_EMAC = QK_UNICODE_MODE_EMACS,
HF_ON = QK_HAPTIC_ON,
HF_OFF = QK_HAPTIC_OFF,
HF_TOGG = QK_HAPTIC_TOGGLE,
HF_RST = QK_HAPTIC_RESET,
HF_FDBK = QK_HAPTIC_FEEDBACK_TOGGLE,
HF_BUZZ = QK_HAPTIC_BUZZ_TOGGLE,
HF_NEXT = QK_HAPTIC_MODE_NEXT,
HF_PREV = QK_HAPTIC_MODE_PREVIOUS,
HF_CONT = QK_HAPTIC_CONTINUOUS_TOGGLE,
HF_CONU = QK_HAPTIC_CONTINUOUS_UP,
HF_COND = QK_HAPTIC_CONTINUOUS_DOWN,
HF_DWLU = QK_HAPTIC_DWELL_UP,
HF_DWLD = QK_HAPTIC_DWELL_DOWN,
CM_ON = QK_COMBO_ON,
CM_OFF = QK_COMBO_OFF,
CM_TOGG = QK_COMBO_TOGGLE,
Expand Down
26 changes: 13 additions & 13 deletions quantum/process_keycode/process_haptic.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,43 +87,43 @@ __attribute__((weak)) bool get_haptic_enabled_key(uint16_t keycode, keyrecord_t
bool process_haptic(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
switch (keycode) {
case HPT_ON:
case QK_HAPTIC_ON:
haptic_enable();
break;
case HPT_OFF:
case QK_HAPTIC_OFF:
haptic_disable();
break;
case HPT_TOG:
case QK_HAPTIC_TOGGLE:
haptic_toggle();
break;
case HPT_RST:
case QK_HAPTIC_RESET:
haptic_reset();
break;
case HPT_FBK:
case QK_HAPTIC_FEEDBACK_TOGGLE:
haptic_feedback_toggle();
break;
case HPT_BUZ:
case QK_HAPTIC_BUZZ_TOGGLE:
haptic_buzz_toggle();
break;
case HPT_MODI:
case QK_HAPTIC_MODE_NEXT:
haptic_mode_increase();
break;
case HPT_MODD:
case QK_HAPTIC_MODE_PREVIOUS:
haptic_mode_decrease();
break;
case HPT_DWLI:
case QK_HAPTIC_DWELL_UP:
haptic_dwell_increase();
break;
case HPT_DWLD:
case QK_HAPTIC_DWELL_DOWN:
haptic_dwell_decrease();
break;
case HPT_CONT:
case QK_HAPTIC_CONTINUOUS_TOGGLE:
haptic_toggle_continuous();
break;
case HPT_CONI:
case QK_HAPTIC_CONTINUOUS_UP:
haptic_cont_increase();
break;
case HPT_COND:
case QK_HAPTIC_CONTINUOUS_DOWN:
haptic_cont_decrease();
break;
}
Expand Down
14 changes: 14 additions & 0 deletions quantum/quantum_keycodes_legacy.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,20 @@
#define MI_BENDD QK_MIDI_PITCH_BEND_DOWN
#define MI_BENDU QK_MIDI_PITCH_BEND_UP

#define HPT_ON QK_HAPTIC_ON
#define HPT_OFF QK_HAPTIC_OFF
#define HPT_TOG QK_HAPTIC_TOGGLE
#define HPT_RST QK_HAPTIC_RESET
#define HPT_FBK QK_HAPTIC_FEEDBACK_TOGGLE
#define HPT_BUZ QK_HAPTIC_BUZZ_TOGGLE
#define HPT_MODI QK_HAPTIC_MODE_NEXT
#define HPT_MODD QK_HAPTIC_MODE_PREVIOUS
#define HPT_CONT QK_HAPTIC_CONTINUOUS_TOGGLE
#define HPT_CONI QK_HAPTIC_CONTINUOUS_UP
#define HPT_COND QK_HAPTIC_CONTINUOUS_DOWN
#define HPT_DWLI QK_HAPTIC_DWELL_UP
#define HPT_DWLD QK_HAPTIC_DWELL_DOWN

#define TERM_ON _Static_assert(false, "The Terminal feature has been removed from QMK. Please remove use of TERM_ON/TERM_OFF from your keymap.")
#define TERM_OFF _Static_assert(false, "The Terminal feature has been removed from QMK.. Please remove use of TERM_ON/TERM_OFF from your keymap.")
// #define RESET _Static_assert(false, "The RESET keycode has been removed from QMK.. Please remove use from your keymap.")