summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2018-12-01 08:21:06 -0800
committerMechMerlin <30334081+mechmerlin@users.noreply.github.com>2018-12-01 08:21:06 -0800
commit75a51659abfbc68874f2e9326f0adf1258fc5458 (patch)
tree217221b3cd4eec84a416f781c32e401bcbe6f896 /docs
parent5803012eda70d2ad85434e53820f2c93c310f92e (diff)
Add tap_random_base64 and software timer info to Useful Functions doc (#4360)
* Update docs * Add security caveat Co-Authored-By: drashna <drashna@live.com> * Wordsmithing Co-Authored-By: drashna <drashna@live.com> * Update docs/ref_functions.md Co-Authored-By: drashna <drashna@live.com>
Diffstat (limited to 'docs')
-rw-r--r--docs/faq_keymap.md17
-rw-r--r--docs/ref_functions.md21
2 files changed, 21 insertions, 17 deletions
diff --git a/docs/faq_keymap.md b/docs/faq_keymap.md
index 4e842d363c..ae01e93878 100644
--- a/docs/faq_keymap.md
+++ b/docs/faq_keymap.md
@@ -211,20 +211,3 @@ here real_mods lost state for 'physical left shift'.
weak_mods is ORed with real_mods when keyboard report is sent.
https://github.com/tmk/tmk_core/blob/master/common/action_util.c#L57
-
-## Timer Functionality
-
-It's possible to start timers and read values for time-specific events - here's an example:
-
-```c
-static uint16_t key_timer;
-key_timer = timer_read();
-
-if (timer_elapsed(key_timer) < 100) {
- // do something if less than 100ms have passed
-} else {
- // do something if 100ms or more have passed
-}
-```
-
-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.
diff --git a/docs/ref_functions.md b/docs/ref_functions.md
index 9b5be7a883..174d9a95a6 100644
--- a/docs/ref_functions.md
+++ b/docs/ref_functions.md
@@ -96,3 +96,24 @@ And to do so, add `reset_keyboard()` to your function or macro, and this will re
If you're having issues with Audio, RGB Underglow, backlighting or keys acting weird, then you can reset the EEPROM (persistent setting storage). Bootmagic is one way to do this, but if that isn't enabled, then you can use a custom macro to do so.
To wipe the EEPROM, run `eeconfig_init()` from your function or macro to reset most of the settings to default.
+
+## Tap random key
+
+If you want to send a random character to the host computer, you can use the `tap_random_base64()` function. This [pseudorandomly](https://en.wikipedia.org/wiki/Pseudorandom_number_generator) selects a number between 0 and 63, and then sends a key press based on that selection. (0–25 is `A`–`Z`, 26–51 is `a`–`z`, 52–61 is `0`–`9`, 62 is `+` and 63 is `/`).
+
+?> Needless to say, but this is _not_ a cryptographically secure method of generating random Base64 keys or passwords.
+
+## Software Timers
+
+It's possible to start timers and read values for time-specific events. Here's an example:
+
+```c
+static uint16_t key_timer;
+key_timer = timer_read();
+
+if (timer_elapsed(key_timer) < 100) {
+ // do something if less than 100ms have passed
+} else {
+ // do something if 100ms or more have passed
+}
+```