ariel_os

Attribute Macro config

#[config]
Expand description

Allows to provide configuration for the associated driver during initial system configuration.

Important: for this configuration to be taken into account, a specific Cargo feature may need to be enabled on the ariel-os dependency, for each configuration type (see table below).

There is no requirements on the constant’s name.

§Parameters

  • The name of the driver the constant provides configuration for.
DriverExpected typeCargo feature to enable
networkembassy_net::Confignetwork-config-override
usbembassy_usb::Configoverride-usb-config

§Note

The ariel_os crate provides re-exports for the relevant Embassy crates.

§Examples

The following provides configuration for the network stack:

use ariel_os::reexports::embassy_net;

#[ariel_os::config(network)]
const 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)),
    })
};

§Panics

This macro panics when the ariel-os crate cannot be found as a dependency of the crate where this macro is used.