aboutsummaryrefslogtreecommitdiff
path: root/readme.md
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2016-08-17 21:17:30 -0400
committerGitHub <noreply@github.com>2016-08-17 21:17:30 -0400
commit8144ce8852f690d5772d80ed2b96ae4af201e266 (patch)
tree6289282c87832f271650fdf0ff359c954ab882e5 /readme.md
parent39a95897bcb5f7b1a9b05c8ade416e7c9566857a (diff)
parent950755edaf766a420376f8d11ac47ab087e7fa99 (diff)
downloadqmk_firmware-8144ce8852f690d5772d80ed2b96ae4af201e266.tar.gz
qmk_firmware-8144ce8852f690d5772d80ed2b96ae4af201e266.zip
Merge pull request #648 from Vifon/dynamic_macros
Implement the dynamic macros that are recorded in runtime
Diffstat (limited to 'readme.md')
-rw-r--r--readme.md43
1 files changed, 43 insertions, 0 deletions
diff --git a/readme.md b/readme.md
index 8c07a5d1f..119995a5c 100644
--- a/readme.md
+++ b/readme.md
@@ -695,6 +695,49 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
695 695
696And then, to assign this macro to a key on your keyboard layout, you just use `M(0)` on the key you want to press for copy/paste. 696And then, to assign this macro to a key on your keyboard layout, you just use `M(0)` on the key you want to press for copy/paste.
697 697
698## Dynamic macros: record and replay macros in runtime
699
700In addition to the static macros described above, you may enable the dynamic macros which you may record while writing. They are forgotten as soon as the keyboard is unplugged. Only two such macros may be stored at the same time, with the total length of 128 keypresses.
701
702To enable them, first add a new element to the `planck_keycodes` enum -- `DYNAMIC_MACRO_RANGE`:
703
704 enum planck_keycodes {
705 QWERTY = SAFE_RANGE,
706 COLEMAK,
707 DVORAK,
708 PLOVER,
709 LOWER,
710 RAISE,
711 BACKLIT,
712 EXT_PLV,
713 DYNAMIC_MACRO_RANGE,
714 };
715
716Afterwards create a new layer called `_DYN`:
717
718 #define _DYN 6 /* almost any other free number should be ok */
719
720Below these two modifications include the `dynamic_macro.h` header:
721
722 #include "dynamic_macro.h"`
723
724Then define the `_DYN` layer with the following keys: `DYN_REC_START1`, `DYN_REC_PLAY1`,`DYN_REC_START2` and `DYN_REC_PLAY2`. It may also contain other keys, it doesn't matter apart from the fact that you won't be able to record these keys in the dynamic macros.
725
726 [_DYN]= {
727 {_______, DYN_REC_START1, DYN_MACRO_PLAY1, _______, _______, _______, _______, _______, _______, _______, _______, _______},
728 {_______, DYN_REC_START2, DYN_MACRO_PLAY2, _______, _______, _______, _______, _______, _______, _______, _______, _______},
729 {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
730 {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
731 },
732
733Add the following code to the very beginning of your `process_record_user()` function:
734
735 if (!process_record_dynamic_macro(keycode, record)) {
736 return false;
737 }
738
739The usage should be pretty self-explanatory. For the details, please read the comments in the `dynamic_macro.h` header.
740
698## Additional keycode aliases for software-implemented layouts (Colemak, Dvorak, etc) 741## Additional keycode aliases for software-implemented layouts (Colemak, Dvorak, etc)
699 742
700Everything is assuming you're in Qwerty (in software) by default, but there is built-in support for using a Colemak or Dvorak layout by including this at the top of your keymap: 743Everything is assuming you're in Qwerty (in software) by default, but there is built-in support for using a Colemak or Dvorak layout by including this at the top of your keymap: