diff --git a/Cargo.lock b/Cargo.lock index 099a7dbe0..6e4fce48c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1996,6 +1996,15 @@ dependencies = [ "riot-rs-boards", ] +[[package]] +name = "hello-world-async" +version = "0.1.0" +dependencies = [ + "embassy-executor", + "riot-rs", + "riot-rs-boards", +] + [[package]] name = "hermit-abi" version = "0.1.19" diff --git a/examples/hello-world-async/Cargo.toml b/examples/hello-world-async/Cargo.toml new file mode 100644 index 000000000..b5799c0ab --- /dev/null +++ b/examples/hello-world-async/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "hello-world-async" +version = "0.1.0" +authors.workspace = true +edition.workspace = true +publish = false + +[dependencies] +riot-rs = { path = "../../src/riot-rs" } +riot-rs-boards = { path = "../../src/riot-rs-boards" } + +embassy-executor = { workspace = true, default-features = false } diff --git a/examples/hello-world-async/README.md b/examples/hello-world-async/README.md new file mode 100644 index 000000000..286279053 --- /dev/null +++ b/examples/hello-world-async/README.md @@ -0,0 +1,11 @@ +# hello-world-async + +## About + +This application is the classic example using async Rust. + +## How to run + +In this folder, run + + laze build -b nrf52840dk run diff --git a/examples/hello-world-async/laze.yml b/examples/hello-world-async/laze.yml new file mode 100644 index 000000000..793494c84 --- /dev/null +++ b/examples/hello-world-async/laze.yml @@ -0,0 +1,4 @@ +apps: + - name: hello-world-async + selects: + - ?release diff --git a/examples/hello-world-async/src/main.rs b/examples/hello-world-async/src/main.rs new file mode 100644 index 000000000..68e60a966 --- /dev/null +++ b/examples/hello-world-async/src/main.rs @@ -0,0 +1,11 @@ +#![no_main] +#![no_std] +#![feature(type_alias_impl_trait)] +#![feature(used_with_arg)] + +use riot_rs::debug::println; + +#[riot_rs::task(autostart)] +async fn main() { + println!("Hello World!"); +} diff --git a/examples/laze.yml b/examples/laze.yml index f697e9f40..ec646425e 100644 --- a/examples/laze.yml +++ b/examples/laze.yml @@ -13,6 +13,7 @@ subdirs: - embassy-net-udp - embassy-usb-keyboard - hello-world + - hello-world-async - minimal - random - threading