| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
This is an extension crate for the datex core crate that provides interfaces and helpers for running DATEX on embedded targets.
This crate is nostd-compatible and supports various embedded targets, including:
To get started, add this crate to you project with cargo add datex-embedded.
This crate has no default feature flags, so to use it, you probably want to enable additional features:
To build for an ESP32 target, enable the feature flag for your specific target.
Full list of ESP32 target feature flags
The datex_embedded::main macro provides an easy way to use an async main function with an initialized DATEX runtime:
#![no_std]
#![no_main]
use datex_core::runtime::Runtime;
#[datex_embedded::main("../config.dx")]
async fn main(runtime: Runtime) {
info!("DATEX runtime version: {}", runtime.version);
// do some stuff
}Note that you need to specify a path to a DATEX config file for your endpoint. Here is a simple example config file that defines Wifi credentials and a websocket server to connect to:
{
endpoint: @mymicrocontroller,
interfaces: [
{
type: "websocket-client",
config: {
address: "wss://example.unyt.land"
}
}
],
env: {
WIFI_SSID: "my-wifi",
WIFI_PASSWORD: "123",
}
}
To initialize a new runtime instance, you can also use init_runtime:
use datex_embedded::esp::init::init_runtime;
let spawner: embassy_executor::Spawner = ...;
let peripherals: esp_hal::peripherals::Peripherals = ...;
esp_println::logger::init_logger(log::LevelFilter::Info);
let runner = RuntimeRunner::new(
RuntimeConfig {
endpoint: Some(Endpoint::new("@myesp")),
interfaces: Some(vec![
RuntimeConfigInterface::new(
"websocket-client",
WebSocketClientInterfaceSetupData {
address: "wss://example.unyt.land".to_string()
}
).unwrap()
])
}
);
let context = init_runtime(
spawner,
&peripherals,
Some(WifiCredentials { ssid, password. auth_method }),
runtime,
).await;
runner.run(async move |runtime: Runtime| {
// the runtime is fully initialized and ready to use
info!("runtime version: {}", runtime.version);
// ...
}).await;We welcome every contribution!
Please take a look at the
DATEX contribution guidelines and the unyt.org
contribution guidlines.
© unyt 2026 • unyt.org
| Back | FazBrowse Home | New Git URL |