mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-21 22:32:29 +00:00
Merge pull request #3460 from bugadani/keepawake
Explain how to keep the executor awake
This commit is contained in:
commit
a18ca16437
@ -372,3 +372,16 @@ Issues like these while implementing drivers often fall into one of the followin
|
|||||||
3. Some kind of hardware errata, or some hardware misconfiguration like wrong clock speeds
|
3. Some kind of hardware errata, or some hardware misconfiguration like wrong clock speeds
|
||||||
4. Some issue with an interrupt handler, either enabling, disabling, or re-enabling of interrupts when necessary
|
4. Some issue with an interrupt handler, either enabling, disabling, or re-enabling of interrupts when necessary
|
||||||
5. Some kind of async issue, like not registering wakers fully before checking flags, or not registering or pending wakers at the right time
|
5. Some kind of async issue, like not registering wakers fully before checking flags, or not registering or pending wakers at the right time
|
||||||
|
|
||||||
|
== How can I prevent the thread-mode executor from going to sleep? ==
|
||||||
|
|
||||||
|
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.
|
||||||
|
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.
|
||||||
|
|
||||||
|
[source,rust]
|
||||||
|
----
|
||||||
|
#[embassy_executor::task]
|
||||||
|
async fn idle() {
|
||||||
|
loop { embassy_futures::yield_now().await; }
|
||||||
|
}
|
||||||
|
----
|
||||||
|
Loading…
Reference in New Issue
Block a user