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.
| Functionality | Expected type | How to enable |
|---|---|---|
network | embassy_net::Config | See the book section. |
rcc | embassy_stm32::rcc::Config | Enable the rcc-config-override Cargo feature. |
usb | embassy_usb::Config | Enable the override-usb-config Cargo feature. |
§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
The ariel-os crate (or ariel-os-embassy, for use in crates which ariel-os depends on)
must be a dependency of the crate where this macro is used, otherwise this macro panics.