Skip to content

Commit

Permalink
examples: Establish CoAP playground
Browse files Browse the repository at this point in the history
  • Loading branch information
chrysn committed Apr 8, 2024
1 parent f8fdf17 commit 4ef831f
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions examples/coap/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "coap"
version = "0.1.0"
authors = [ "Christian Amsüss <[email protected]>" ]
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" }
14 changes: 14 additions & 0 deletions examples/coap/README.md
Original file line number Diff line number Diff line change
@@ -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.
5 changes: 5 additions & 0 deletions examples/coap/laze.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apps:
- name: coap
selects:
- ?release
- network
27 changes: 27 additions & 0 deletions examples/coap/src/main.rs
Original file line number Diff line number Diff line change
@@ -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)),
})
}
1 change: 1 addition & 0 deletions examples/laze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ defaults:
subdirs:
- benchmark
- core-sizes
- coap
- embassy
- embassy-http-server
- embassy-net-tcp
Expand Down

0 comments on commit 4ef831f

Please sign in to comment.