diff options
| author | Dániel Buga <[email protected]> | 2024-10-25 18:53:59 +0200 |
|---|---|---|
| committer | Dániel Buga <[email protected]> | 2024-10-25 18:53:59 +0200 |
| commit | d1db7d90434e7cf8d82361818427942c19923726 (patch) | |
| tree | c6bdfc80691002f6207ee50f82cacc0e6df0027c /docs/pages | |
| parent | 8803128707b8bd9fc9dcea392a62dfd42aa822d2 (diff) | |
Explain how to keep the executor awake
Diffstat (limited to 'docs/pages')
| -rw-r--r-- | docs/pages/faq.adoc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/docs/pages/faq.adoc b/docs/pages/faq.adoc index 8eb947b5e..d4f49bfc1 100644 --- a/docs/pages/faq.adoc +++ b/docs/pages/faq.adoc | |||
| @@ -372,3 +372,16 @@ Issues like these while implementing drivers often fall into one of the followin | |||
| 372 | 3. Some kind of hardware errata, or some hardware misconfiguration like wrong clock speeds | 372 | 3. Some kind of hardware errata, or some hardware misconfiguration like wrong clock speeds |
| 373 | 4. Some issue with an interrupt handler, either enabling, disabling, or re-enabling of interrupts when necessary | 373 | 4. Some issue with an interrupt handler, either enabling, disabling, or re-enabling of interrupts when necessary |
| 374 | 5. Some kind of async issue, like not registering wakers fully before checking flags, or not registering or pending wakers at the right time | 374 | 5. Some kind of async issue, like not registering wakers fully before checking flags, or not registering or pending wakers at the right time |
| 375 | |||
| 376 | == How can I prevent the thread-mode executor from going to sleep? == | ||
| 377 | |||
| 378 | In some cases you might want to prevent the thread-mode executor from going to sleep, for example when doing so would result in current spikes that reduce analog performance. | ||
| 379 | As a workaround, you can spawn a task that yields in a loop, preventing the executor from going to sleep. Note that this may increase power consumption. | ||
| 380 | |||
| 381 | [source,rust] | ||
| 382 | ---- | ||
| 383 | #[embassy_executor::task] | ||
| 384 | async fn idle() { | ||
| 385 | loop { embassy_futures::yield_now().await; } | ||
| 386 | } | ||
| 387 | ---- | ||
