diff --git a/Cargo.lock b/Cargo.lock index b2c39b56d..a4a5b6cbd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -240,6 +240,19 @@ dependencies = [ "memoffset", ] +[[package]] +name = "coap" +version = "0.1.0" +dependencies = [ + "embassy-executor", + "embassy-net", + "embassy-time", + "embedded-io-async", + "heapless 0.8.0", + "riot-rs", + "riot-rs-boards", +] + [[package]] name = "codespan-reporting" version = "0.11.1" diff --git a/examples/coap/Cargo.toml b/examples/coap/Cargo.toml new file mode 100644 index 000000000..99975fb02 --- /dev/null +++ b/examples/coap/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "coap" +version = "0.1.0" +authors = [ "Christian Amsüss " ] +edition.workspace = true +publish = false + +[dependencies] +embassy-executor = { workspace = true, default-features = false } +embassy-net = { workspace = true, features = ["udp"] } +embassy-time = { workspace = true, default-features = false } +embedded-io-async = "0.6.1" +heapless = { workspace = true } +riot-rs = { path = "../../src/riot-rs", features = ["override-network-config"] } +riot-rs-boards = { path = "../../src/riot-rs-boards" } diff --git a/examples/coap/README.md b/examples/coap/README.md new file mode 100644 index 000000000..8f80c818b --- /dev/null +++ b/examples/coap/README.md @@ -0,0 +1,14 @@ +# coap demo + +## About + +This application is a work in progress demo of running CoAP on RIOT-rs. + +## Roadmap + +Eventually, this should be 20 line demo. + +Until the CoAP roadmap is complete, +this serves as a work bench, test bed, demo zone and playground at the same time. +This application will grow as parts of the roadmap are added, +and shrink as they become default or are wrapped into components of RIOT-rs. diff --git a/examples/coap/laze.yml b/examples/coap/laze.yml new file mode 100644 index 000000000..ce37ee7fb --- /dev/null +++ b/examples/coap/laze.yml @@ -0,0 +1,5 @@ +apps: + - name: coap + selects: + - ?release + - network diff --git a/examples/coap/src/main.rs b/examples/coap/src/main.rs new file mode 100644 index 000000000..24ac3dac3 --- /dev/null +++ b/examples/coap/src/main.rs @@ -0,0 +1,27 @@ +#![no_main] +#![no_std] +#![feature(type_alias_impl_trait)] +#![feature(used_with_arg)] + +use riot_rs::{debug::println, embassy::network}; + +#[riot_rs::task(autostart)] +async fn udp_echo() { + let stack = network::network_stack().await.unwrap(); + + println!("Starting up CoAP server"); + + todo!("Work with {stack:p}"); +} + +// FIXME: So far, this is necessary boiler plate; see ../README.md#networking for details +#[riot_rs::config(network)] +fn network_config() -> embassy_net::Config { + use embassy_net::Ipv4Address; + + embassy_net::Config::ipv4_static(embassy_net::StaticConfigV4 { + address: embassy_net::Ipv4Cidr::new(Ipv4Address::new(10, 42, 0, 61), 24), + dns_servers: heapless::Vec::new(), + gateway: Some(Ipv4Address::new(10, 42, 0, 1)), + }) +} diff --git a/examples/laze.yml b/examples/laze.yml index 3fbb52486..f48c26618 100644 --- a/examples/laze.yml +++ b/examples/laze.yml @@ -6,6 +6,7 @@ defaults: subdirs: - benchmark - core-sizes + - coap - embassy - embassy-http-server - embassy-net-tcp