diff options
| author | Ulf Lilleengen <[email protected]> | 2022-06-23 12:59:18 +0200 |
|---|---|---|
| committer | Ulf Lilleengen <[email protected]> | 2022-06-23 13:17:56 +0200 |
| commit | ca59c1ff3570474dc819c2d759c69c3a186ca5bc (patch) | |
| tree | 22f96a5a03cdb43366e8bedf954cad13566328ca /embassy-cortex-m/src/executor.rs | |
| parent | 6d3a652026d222bb0191c77406e1f4145a64c5f9 (diff) | |
Add more API docs for embassy-cortex-m and embassy-nrf
Diffstat (limited to 'embassy-cortex-m/src/executor.rs')
| -rw-r--r-- | embassy-cortex-m/src/executor.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/embassy-cortex-m/src/executor.rs b/embassy-cortex-m/src/executor.rs index 34f3ec236..8c7f8cf9d 100644 --- a/embassy-cortex-m/src/executor.rs +++ b/embassy-cortex-m/src/executor.rs | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | //! Executor specific to cortex-m devices. | ||
| 1 | use core::marker::PhantomData; | 2 | use core::marker::PhantomData; |
| 2 | 3 | ||
| 3 | pub use embassy::executor::Executor; | 4 | pub use embassy::executor::Executor; |
| @@ -60,18 +61,18 @@ impl<I: Interrupt> InterruptExecutor<I> { | |||
| 60 | /// The executor keeps running in the background through the interrupt. | 61 | /// The executor keeps running in the background through the interrupt. |
| 61 | /// | 62 | /// |
| 62 | /// This returns a [`SendSpawner`] you can use to spawn tasks on it. A [`SendSpawner`] | 63 | /// This returns a [`SendSpawner`] you can use to spawn tasks on it. A [`SendSpawner`] |
| 63 | /// is returned instead of a [`Spawner`] because the executor effectively runs in a | 64 | /// is returned instead of a [`Spawner`](embassy::executor::Spawner) because the executor effectively runs in a |
| 64 | /// different "thread" (the interrupt), so spawning tasks on it is effectively | 65 | /// different "thread" (the interrupt), so spawning tasks on it is effectively |
| 65 | /// sending them. | 66 | /// sending them. |
| 66 | /// | 67 | /// |
| 67 | /// To obtain a [`Spawner`] for this executor, use [`Spawner::for_current_executor`] from | 68 | /// To obtain a [`Spawner`](embassy::executor::Spawner) for this executor, use [`Spawner::for_current_executor()`](embassy::executor::Spawner::for_current_executor()) from |
| 68 | /// a task running in it. | 69 | /// a task running in it. |
| 69 | /// | 70 | /// |
| 70 | /// This function requires `&'static mut self`. This means you have to store the | 71 | /// This function requires `&'static mut self`. This means you have to store the |
| 71 | /// Executor instance in a place where it'll live forever and grants you mutable | 72 | /// Executor instance in a place where it'll live forever and grants you mutable |
| 72 | /// access. There's a few ways to do this: | 73 | /// access. There's a few ways to do this: |
| 73 | /// | 74 | /// |
| 74 | /// - a [Forever](crate::util::Forever) (safe) | 75 | /// - a [Forever](embassy::util::Forever) (safe) |
| 75 | /// - a `static mut` (unsafe) | 76 | /// - a `static mut` (unsafe) |
| 76 | /// - a local variable in a function you know never returns (like `fn main() -> !`), upgrading its lifetime with `transmute`. (unsafe) | 77 | /// - a local variable in a function you know never returns (like `fn main() -> !`), upgrading its lifetime with `transmute`. (unsafe) |
| 77 | pub fn start(&'static mut self) -> SendSpawner { | 78 | pub fn start(&'static mut self) -> SendSpawner { |
