From e4d2ba9a4d98a8ff7327156ff45cc6339cb40c95 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Mon, 7 Nov 2022 02:43:53 +0000 Subject: [PATCH] Align haptic feedback keycode names (#18964) --- .../keycodes/keycodes_0.0.1_quantum.hjson | 65 +++++++++++++++---- docs/feature_haptic_feedback.md | 36 +++++----- quantum/keycodes.h | 39 +++++++---- quantum/process_keycode/process_haptic.c | 26 ++++---- quantum/quantum_keycodes_legacy.h | 14 ++++ 5 files changed, 123 insertions(+), 57 deletions(-) diff --git a/data/constants/keycodes/keycodes_0.0.1_quantum.hjson b/data/constants/keycodes/keycodes_0.0.1_quantum.hjson index e3db45be71c..a4b60cfc61f 100644 --- a/data/constants/keycodes/keycodes_0.0.1_quantum.hjson +++ b/data/constants/keycodes/keycodes_0.0.1_quantum.hjson @@ -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": { diff --git a/docs/feature_haptic_feedback.md b/docs/feature_haptic_feedback.md index f4546b6914c..b456bad736f 100644 --- a/docs/feature_haptic_feedback.md +++ b/docs/feature_haptic_feedback.md @@ -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 @@ -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. | @@ -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 diff --git a/quantum/keycodes.h b/quantum/keycodes.h index deb35652623..2b812615195 100644 --- a/quantum/keycodes.h +++ b/quantum/keycodes.h @@ -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, @@ -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, diff --git a/quantum/process_keycode/process_haptic.c b/quantum/process_keycode/process_haptic.c index 0f07f9ac751..21d4c5ce304 100644 --- a/quantum/process_keycode/process_haptic.c +++ b/quantum/process_keycode/process_haptic.c @@ -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; } diff --git a/quantum/quantum_keycodes_legacy.h b/quantum/quantum_keycodes_legacy.h index 04bf6875617..305b89a569d 100644 --- a/quantum/quantum_keycodes_legacy.h +++ b/quantum/quantum_keycodes_legacy.h @@ -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.")