diff options
Diffstat (limited to 'embassy-executor-macros/src/lib.rs')
| -rw-r--r-- | embassy-executor-macros/src/lib.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/embassy-executor-macros/src/lib.rs b/embassy-executor-macros/src/lib.rs index 8e737db6a..962ce2e75 100644 --- a/embassy-executor-macros/src/lib.rs +++ b/embassy-executor-macros/src/lib.rs | |||
| @@ -70,6 +70,31 @@ pub fn main_cortex_m(args: TokenStream, item: TokenStream) -> TokenStream { | |||
| 70 | main::run(args.into(), item.into(), &main::ARCH_CORTEX_M).into() | 70 | main::run(args.into(), item.into(), &main::ARCH_CORTEX_M).into() |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | /// Creates a new `executor` instance and declares an application entry point for Cortex-A/R | ||
| 74 | /// spawning the corresponding function body as an async task. | ||
| 75 | /// | ||
| 76 | /// The following restrictions apply: | ||
| 77 | /// | ||
| 78 | /// * The function must accept exactly 1 parameter, an `embassy_executor::Spawner` handle that it | ||
| 79 | /// can use to spawn additional tasks. | ||
| 80 | /// * The function must be declared `async`. | ||
| 81 | /// * The function must not use generics. | ||
| 82 | /// * Only a single `main` task may be declared. | ||
| 83 | /// | ||
| 84 | /// ## Examples | ||
| 85 | /// Spawning a task: | ||
| 86 | /// | ||
| 87 | /// ``` rust | ||
| 88 | /// #[embassy_executor::main] | ||
| 89 | /// async fn main(_s: embassy_executor::Spawner) { | ||
| 90 | /// // Function body | ||
| 91 | /// } | ||
| 92 | /// ``` | ||
| 93 | #[proc_macro_attribute] | ||
| 94 | pub fn main_cortex_ar(args: TokenStream, item: TokenStream) -> TokenStream { | ||
| 95 | main::run(args.into(), item.into(), &main::ARCH_CORTEX_AR).into() | ||
| 96 | } | ||
| 97 | |||
| 73 | /// Creates a new `executor` instance and declares an architecture agnostic application entry point spawning | 98 | /// Creates a new `executor` instance and declares an architecture agnostic application entry point spawning |
| 74 | /// the corresponding function body as an async task. | 99 | /// the corresponding function body as an async task. |
| 75 | /// | 100 | /// |
