diff options
| author | 1-rafael-1 <[email protected]> | 2025-09-15 20:07:18 +0200 |
|---|---|---|
| committer | 1-rafael-1 <[email protected]> | 2025-09-15 20:07:18 +0200 |
| commit | 6bb3d2c0720fa082f27d3cdb70f516058497ec87 (patch) | |
| tree | 5a1e255cff999b00800f203b91a759c720c973e5 /embassy-executor-macros/src/lib.rs | |
| parent | eb685574601d98c44faed9a3534d056199b46e20 (diff) | |
| parent | 92a6fd2946f2cbb15359290f68aa360953da2ff7 (diff) | |
Merge branch 'main' into rp2040-rtc-alarm
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 | /// |
