diff options
| author | skullY <skullydazed@gmail.com> | 2017-06-09 11:47:38 -0700 |
|---|---|---|
| committer | skullY <skullydazed@gmail.com> | 2017-06-09 11:47:53 -0700 |
| commit | 767bcac23c6ea990881ed4dad8818a51e399b081 (patch) | |
| tree | 2a2b3f2762ba9597e2cbd9f8227fe7c00da8ad85 /docs/FAQ-Keymap.md | |
| parent | d2aec1625d17b77e989aa33c4270a102947642dd (diff) | |
| download | qmk_firmware-767bcac23c6ea990881ed4dad8818a51e399b081.tar.gz qmk_firmware-767bcac23c6ea990881ed4dad8818a51e399b081.zip | |
Clean up and improve the macro documentation
Diffstat (limited to 'docs/FAQ-Keymap.md')
| -rw-r--r-- | docs/FAQ-Keymap.md | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/docs/FAQ-Keymap.md b/docs/FAQ-Keymap.md index 7c73f571f..623726ab2 100644 --- a/docs/FAQ-Keymap.md +++ b/docs/FAQ-Keymap.md | |||
| @@ -111,7 +111,6 @@ https://github.com/tekezo/Karabiner/issues/403 | |||
| 111 | 111 | ||
| 112 | ## Esc and `~ on a key | 112 | ## Esc and `~ on a key |
| 113 | 113 | ||
| 114 | |||
| 115 | You can define FC660 and Poker style ESC with `ACTION_LAYER_MODS`. | 114 | You can define FC660 and Poker style ESC with `ACTION_LAYER_MODS`. |
| 116 | https://github.com/tmk/tmk_core/blob/master/doc/keymap.md#35-momentary-switching-with-modifiers | 115 | https://github.com/tmk/tmk_core/blob/master/doc/keymap.md#35-momentary-switching-with-modifiers |
| 117 | 116 | ||
| @@ -245,4 +244,22 @@ without weak mods, | |||
| 245 | here real_mods lost state for 'physical left shift'. | 244 | here real_mods lost state for 'physical left shift'. |
| 246 | 245 | ||
| 247 | weak_mods is ORed with real_mods when keyboard report is sent. | 246 | weak_mods is ORed with real_mods when keyboard report is sent. |
| 248 | https://github.com/tmk/tmk_core/blob/master/common/action_util.c#L57 \ No newline at end of file | 247 | https://github.com/tmk/tmk_core/blob/master/common/action_util.c#L57 |
| 248 | |||
| 249 | ## Timer functionality | ||
| 250 | |||
| 251 | It's possible to start timers and read values for time-specific events - here's an example: | ||
| 252 | |||
| 253 | ```c | ||
| 254 | static uint16_t key_timer; | ||
| 255 | key_timer = timer_read(); | ||
| 256 | |||
| 257 | if (timer_elapsed(key_timer) < 100) { | ||
| 258 | // do something if less than 100ms have passed | ||
| 259 | } else { | ||
| 260 | // do something if 100ms or more have passed | ||
| 261 | } | ||
| 262 | ``` | ||
| 263 | |||
| 264 | It's best to declare the `static uint16_t key_timer;` at the top of the file, outside of any code blocks you're using it in. | ||
| 265 | |||
