From 8ccbbde881a7bd176ee64db3b11a6336d3b17a84 Mon Sep 17 00:00:00 2001 From: tmk Date: Fri, 15 Jan 2016 16:00:56 +0900 Subject: [PATCH] core: Add macro commands SM(), RM() and CM() --- tmk_core/doc/keymap.md | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/tmk_core/doc/keymap.md b/tmk_core/doc/keymap.md index d4a129b2..566936c6 100644 --- a/tmk_core/doc/keymap.md +++ b/tmk_core/doc/keymap.md @@ -368,17 +368,37 @@ Default Layer also has bitwise operations, they are executed when key is release MACRO( I(255), T(H), T(E), T(L), T(L), W(255), T(O), END ) #### 2.3.1 Macro Commands +- **MACRO()** +- **MACRO_NONE** + - **I()** change interval of stroke. - **D()** press key - **U()** release key - **T()** type key(press and release) - **W()** wait +- **SM()** store modifier state +- **RM()** restore modifier state +- **CM()** clear modifier state - **END** end mark #### 2.3.2 Examples +***TBD*** + + const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) + { + switch (id) { + case HELLO: + return (record->event.pressed ? + MACRO( I(0), T(H), T(E), T(L), T(L), W(255), T(O), END ) : + MACRO_NONE ); + case ALT_TAB: + return (record->event.pressed ? + MACRO( D(LALT), D(TAB), END ) : + MACRO( U(TAB), END )); + } + return MACRO_NONE; + } -***TODO: sample implementation*** -See `keyboard/hhkb/keymap.c` for sample. -- 2.39.3