summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorcoliss86 <coliss86@users.noreply.github.com>2022-08-16 20:41:31 +0200
committerGitHub <noreply@github.com>2022-08-16 11:41:31 -0700
commit837a57b3c51a99cd6dbda6fbe19afa1dd28a80d0 (patch)
tree6bc2ee547b8ddf086f4c6ffa28f5d299d170e271 /docs
parentc834608a74cad6557d26ba7bb1b53b1dd92cb0b6 (diff)
Adjust the hierarchy of chapter `Deferred Execution` (#18075)
Diffstat (limited to 'docs')
-rw-r--r--docs/custom_quantum_functions.md12
1 files changed, 6 insertions, 6 deletions
diff --git a/docs/custom_quantum_functions.md b/docs/custom_quantum_functions.md
index f9a6e1bcc8..7b7849ad07 100644
--- a/docs/custom_quantum_functions.md
+++ b/docs/custom_quantum_functions.md
@@ -406,11 +406,11 @@ And you're done. The RGB layer indication will only work if you want it to. And
The `val` is the value of the data that you want to write to EEPROM. And the `eeconfig_read_*` function return a 32 bit (DWORD) value from the EEPROM.
-### Deferred Execution :id=deferred-execution
+# Deferred Execution :id=deferred-execution
QMK has the ability to execute a callback after a specified period of time, rather than having to manually manage timers. To enable this functionality, set `DEFERRED_EXEC_ENABLE = yes` in rules.mk.
-#### Deferred executor callbacks
+## Deferred executor callbacks
All _deferred executor callbacks_ have a common function signature and look like:
@@ -430,7 +430,7 @@ The return value is the number of milliseconds to use if the function should be
?> Note that the returned delay will be applied to the intended trigger time, not the time of callback invocation. This allows for generally consistent timing even in the face of occasional late execution.
-#### Deferred executor registration
+## Deferred executor registration
Once a callback has been defined, it can be scheduled using the following API:
@@ -444,7 +444,7 @@ The third parameter is the `cb_arg` that gets passed to the callback at the poin
The return value is a `deferred_token` that can consequently be used to cancel the deferred executor callback before it's invoked. If a failure occurs, the returned value will be `INVALID_DEFERRED_TOKEN`. Usually this will be as a result of supplying `0` to the delay, or a `NULL` for the callback. The other failure case is if there are too many deferred executions "in flight" -- this can be increased by changing the limit, described below.
-#### Extending a deferred execution
+## Extending a deferred execution
The `deferred_token` returned by `defer_exec()` can be used to extend a the duration a pending execution waits before it gets invoked:
```c
@@ -452,7 +452,7 @@ The `deferred_token` returned by `defer_exec()` can be used to extend a the dura
extend_deferred_exec(my_token, 800);
```
-#### Cancelling a deferred execution
+## Cancelling a deferred execution
The `deferred_token` returned by `defer_exec()` can be used to cancel a pending execution before it gets invoked:
```c
@@ -462,7 +462,7 @@ cancel_deferred_exec(my_token);
Once a token has been canceled, it should be considered invalid. Reusing the same token is not supported.
-#### Deferred callback limits
+## Deferred callback limits
There are a maximum number of deferred callbacks that can be scheduled, controlled by the value of the define `MAX_DEFERRED_EXECUTORS`.