summaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2022-11-04 10:01:06 +1100
committerGitHub <noreply@github.com>2022-11-03 23:01:06 +0000
commitfe18df9d4186c7f2c97a2bfccf3cc0e11615c728 (patch)
tree28b2cab02cfccbb5c268b33df5595934a1620d2f /quantum
parent3de296f42014c489682730d9ab554d25ba8953a4 (diff)
Normalise Dynamic Macro keycodes (#18939)
* `DYN_REC_START1` -> `QK_DYNAMIC_MACRO_RECORD_START_1` * `DYN_REC_START2` -> `QK_DYNAMIC_MACRO_RECORD_START_2` * `DYN_MACRO_PLAY1` -> `QK_DYNAMIC_MACRO_PLAY_1` * `DYN_MACRO_PLAY2` -> `QK_DYNAMIC_MACRO_PLAY_2` * `DYN_REC_STOP` -> `QK_DYNAMIC_MACRO_RECORD_STOP` * Update docs
Diffstat (limited to 'quantum')
-rw-r--r--quantum/dynamic_macro.h16
-rw-r--r--quantum/process_keycode/process_dynamic_macro.c26
-rw-r--r--quantum/quantum_keycodes.h20
-rw-r--r--quantum/quantum_keycodes_legacy.h6
4 files changed, 37 insertions, 31 deletions
diff --git a/quantum/dynamic_macro.h b/quantum/dynamic_macro.h
index fe9de6fa65..64c532e6ce 100644
--- a/quantum/dynamic_macro.h
+++ b/quantum/dynamic_macro.h
@@ -129,7 +129,7 @@ void dynamic_macro_record_end(keyrecord_t *macro_buffer, keyrecord_t *macro_poin
dynamic_macro_led_blink();
/* Do not save the keys being held when stopping the recording,
- * i.e. the keys used to access the layer DYN_REC_STOP is on.
+ * i.e. the keys used to access the layer DM_RSTP is on.
*/
while (macro_pointer != macro_buffer && (macro_pointer - direction)->event.pressed) {
dprintln("dynamic macro: trimming a trailing key-down event");
@@ -202,18 +202,18 @@ bool process_record_dynamic_macro(uint16_t keycode, keyrecord_t *record) {
/* No macro recording in progress. */
if (!record->event.pressed) {
switch (keycode) {
- case DYN_REC_START1:
+ case QK_DYNAMIC_MACRO_RECORD_START_1:
dynamic_macro_record_start(&macro_pointer, macro_buffer);
macro_id = 1;
return false;
- case DYN_REC_START2:
+ case QK_DYNAMIC_MACRO_RECORD_START_2:
dynamic_macro_record_start(&macro_pointer, r_macro_buffer);
macro_id = 2;
return false;
- case DYN_MACRO_PLAY1:
+ case QK_DYNAMIC_MACRO_PLAY_1:
dynamic_macro_play(macro_buffer, macro_end, +1);
return false;
- case DYN_MACRO_PLAY2:
+ case QK_DYNAMIC_MACRO_PLAY_2:
dynamic_macro_play(r_macro_buffer, r_macro_end, -1);
return false;
}
@@ -221,7 +221,7 @@ bool process_record_dynamic_macro(uint16_t keycode, keyrecord_t *record) {
} else {
/* A macro is being recorded right now. */
switch (keycode) {
- case DYN_REC_STOP:
+ case QK_DYNAMIC_MACRO_RECORD_STOP:
/* Stop the macro recording. */
if (record->event.pressed) { /* Ignore the initial release
* just after the recoding
@@ -237,8 +237,8 @@ bool process_record_dynamic_macro(uint16_t keycode, keyrecord_t *record) {
macro_id = 0;
}
return false;
- case DYN_MACRO_PLAY1:
- case DYN_MACRO_PLAY2:
+ case QK_DYNAMIC_MACRO_PLAY_1:
+ case QK_DYNAMIC_MACRO_PLAY_2:
dprintln("dynamic macro: ignoring macro play key while recording");
return false;
default:
diff --git a/quantum/process_keycode/process_dynamic_macro.c b/quantum/process_keycode/process_dynamic_macro.c
index 41207092a9..c2e7e7716f 100644
--- a/quantum/process_keycode/process_dynamic_macro.c
+++ b/quantum/process_keycode/process_dynamic_macro.c
@@ -139,7 +139,7 @@ void dynamic_macro_record_end(keyrecord_t *macro_buffer, keyrecord_t *macro_poin
dynamic_macro_record_end_user(direction);
/* Do not save the keys being held when stopping the recording,
- * i.e. the keys used to access the layer DYN_REC_STOP is on.
+ * i.e. the keys used to access the layer DM_RSTP is on.
*/
while (macro_pointer != macro_buffer && (macro_pointer - direction)->event.pressed) {
dprintln("dynamic macro: trimming a trailing key-down event");
@@ -212,18 +212,18 @@ bool process_dynamic_macro(uint16_t keycode, keyrecord_t *record) {
/* No macro recording in progress. */
if (!record->event.pressed) {
switch (keycode) {
- case DYN_REC_START1:
+ case QK_DYNAMIC_MACRO_RECORD_START_1:
dynamic_macro_record_start(&macro_pointer, macro_buffer);
macro_id = 1;
return false;
- case DYN_REC_START2:
+ case QK_DYNAMIC_MACRO_RECORD_START_2:
dynamic_macro_record_start(&macro_pointer, r_macro_buffer);
macro_id = 2;
return false;
- case DYN_MACRO_PLAY1:
+ case QK_DYNAMIC_MACRO_PLAY_1:
dynamic_macro_play(macro_buffer, macro_end, +1);
return false;
- case DYN_MACRO_PLAY2:
+ case QK_DYNAMIC_MACRO_PLAY_2:
dynamic_macro_play(r_macro_buffer, r_macro_end, -1);
return false;
}
@@ -231,13 +231,13 @@ bool process_dynamic_macro(uint16_t keycode, keyrecord_t *record) {
} else {
/* A macro is being recorded right now. */
switch (keycode) {
- case DYN_REC_START1:
- case DYN_REC_START2:
- case DYN_REC_STOP:
+ case QK_DYNAMIC_MACRO_RECORD_START_1:
+ case QK_DYNAMIC_MACRO_RECORD_START_2:
+ case QK_DYNAMIC_MACRO_RECORD_STOP:
/* Stop the macro recording. */
- if (record->event.pressed ^ (keycode != DYN_REC_STOP)) { /* Ignore the initial release
- * just after the recording
- * starts for DYN_REC_STOP. */
+ if (record->event.pressed ^ (keycode != QK_DYNAMIC_MACRO_RECORD_STOP)) { /* Ignore the initial release
+ * just after the recording
+ * starts for DM_RSTP. */
switch (macro_id) {
case 1:
dynamic_macro_record_end(macro_buffer, macro_pointer, +1, &macro_end);
@@ -250,8 +250,8 @@ bool process_dynamic_macro(uint16_t keycode, keyrecord_t *record) {
}
return false;
#ifdef DYNAMIC_MACRO_NO_NESTING
- case DYN_MACRO_PLAY1:
- case DYN_MACRO_PLAY2:
+ case QK_DYNAMIC_MACRO_PLAY_1:
+ case QK_DYNAMIC_MACRO_PLAY_2:
dprintln("dynamic macro: ignoring macro play key while recording");
return false;
#endif
diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h
index 2f9e211cc1..2df733fe1f 100644
--- a/quantum/quantum_keycodes.h
+++ b/quantum/quantum_keycodes.h
@@ -424,11 +424,11 @@ enum quantum_keycodes {
MAGIC_EE_HANDS_RIGHT, // 5D03
// Dynamic Macros
- DYN_REC_START1, // 5D04
- DYN_REC_START2, // 5D05
- DYN_REC_STOP, // 5D06
- DYN_MACRO_PLAY1, // 5D07
- DYN_MACRO_PLAY2, // 5D08
+ QK_DYNAMIC_MACRO_RECORD_START_1, // 5D04
+ QK_DYNAMIC_MACRO_RECORD_START_2, // 5D05
+ QK_DYNAMIC_MACRO_RECORD_STOP, // 5D06
+ QK_DYNAMIC_MACRO_PLAY_1, // 5D07
+ QK_DYNAMIC_MACRO_PLAY_2, // 5D08
// Joystick
QK_JOYSTICK_BUTTON_0, // 5D09
@@ -906,11 +906,11 @@ enum quantum_keycodes {
#define MIDI_CHANNEL_MAX MI_CH16
// Dynamic Macros aliases
-#define DM_REC1 DYN_REC_START1
-#define DM_REC2 DYN_REC_START2
-#define DM_RSTP DYN_REC_STOP
-#define DM_PLY1 DYN_MACRO_PLAY1
-#define DM_PLY2 DYN_MACRO_PLAY2
+#define DM_REC1 QK_DYNAMIC_MACRO_RECORD_START_1
+#define DM_REC2 QK_DYNAMIC_MACRO_RECORD_START_2
+#define DM_RSTP QK_DYNAMIC_MACRO_RECORD_STOP
+#define DM_PLY1 QK_DYNAMIC_MACRO_PLAY_1
+#define DM_PLY2 QK_DYNAMIC_MACRO_PLAY_2
// Joystick aliases
#define JS_0 QK_JOYSTICK_BUTTON_0
diff --git a/quantum/quantum_keycodes_legacy.h b/quantum/quantum_keycodes_legacy.h
index 68771baece..8f325251bc 100644
--- a/quantum/quantum_keycodes_legacy.h
+++ b/quantum/quantum_keycodes_legacy.h
@@ -38,6 +38,12 @@
#define UC_M_WC QK_UNICODE_MODE_WINCOMPOSE
#define UC_M_EM QK_UNICODE_MODE_EMACS
+#define DYN_REC_START1 QK_DYNAMIC_MACRO_RECORD_START_1
+#define DYN_REC_START2 QK_DYNAMIC_MACRO_RECORD_START_2
+#define DYN_REC_STOP QK_DYNAMIC_MACRO_RECORD_STOP
+#define DYN_MACRO_PLAY1 QK_DYNAMIC_MACRO_PLAY_1
+#define DYN_MACRO_PLAY2 QK_DYNAMIC_MACRO_PLAY_2
+
#define PROGRAMMABLE_BUTTON_1 QK_PROGRAMMABLE_BUTTON_1
#define PROGRAMMABLE_BUTTON_2 QK_PROGRAMMABLE_BUTTON_2
#define PROGRAMMABLE_BUTTON_3 QK_PROGRAMMABLE_BUTTON_3