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.