1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#![cfg_attr(not(any(feature = "std", feature = "wasm")), no_std)]
#![cfg_attr(all(feature = "nightly", target_arch = "xtensa"), feature(asm_experimental_arch))]
#![allow(clippy::new_without_default)]
#![doc = include_str!("../README.md")]
#![warn(missing_docs)]

// This mod MUST go first, so that the others see its macros.
pub(crate) mod fmt;

#[cfg(feature = "nightly")]
pub use embassy_macros::task;

cfg_if::cfg_if! {
    if #[cfg(cortex_m)] {
        #[path="arch/cortex_m.rs"]
        mod arch;
        pub use arch::*;
        #[cfg(feature = "nightly")]
        pub use embassy_macros::main_cortex_m as main;
    }
    else if #[cfg(target_arch="riscv32")] {
        #[path="arch/riscv32.rs"]
        mod arch;
        pub use arch::*;
        #[cfg(feature = "nightly")]
        pub use embassy_macros::main_riscv as main;
    }
    else if #[cfg(all(target_arch="xtensa", feature = "nightly"))] {
        #[path="arch/xtensa.rs"]
        mod arch;
        pub use arch::*;
    }
    else if #[cfg(feature="wasm")] {
        #[path="arch/wasm.rs"]
        mod arch;
        pub use arch::*;
        #[cfg(feature = "nightly")]
        pub use embassy_macros::main_wasm as main;
    }
    else if #[cfg(feature="std")] {
        #[path="arch/std.rs"]
        mod arch;
        pub use arch::*;
        #[cfg(feature = "nightly")]
        pub use embassy_macros::main_std as main;
    }
}

#[doc(hidden)]
/// Implementation details for embassy macros. DO NOT USE.
pub mod export {
    #[cfg(feature = "rtos-trace")]
    pub use rtos_trace::trace;

    /// Expands the given block of code when `embassy-executor` is compiled with
    /// the `rtos-trace-interrupt` feature.
    #[doc(hidden)]
    #[macro_export]
    #[cfg(feature = "rtos-trace-interrupt")]
    macro_rules! rtos_trace_interrupt {
        ($($tt:tt)*) => { $($tt)* };
    }

    /// Does not expand the given block of code when `embassy-executor` is
    /// compiled without the `rtos-trace-interrupt` feature.
    #[doc(hidden)]
    #[macro_export]
    #[cfg(not(feature = "rtos-trace-interrupt"))]
    macro_rules! rtos_trace_interrupt {
        ($($tt:tt)*) => {};
    }
}

pub mod raw;

mod spawner;
pub use spawner::*;

/// Do not use. Used for macros and HALs only. Not covered by semver guarantees.
#[doc(hidden)]
pub mod _export {
    pub use static_cell::StaticCell;
}