diff --git a/Cargo.lock b/Cargo.lock index 6b6869644..2cac0a1f3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3615,6 +3615,17 @@ dependencies = [ "static_cell", ] +[[package]] +name = "riot-rs-arch" +version = "0.1.0" +dependencies = [ + "cfg-if", + "riot-rs-esp", + "riot-rs-nrf", + "riot-rs-rp", + "riot-rs-stm32", +] + [[package]] name = "riot-rs-bench" version = "0.1.0" @@ -3688,15 +3699,12 @@ dependencies = [ "heapless 0.8.0", "linkme", "once_cell", + "riot-rs-arch", "riot-rs-debug", "riot-rs-embassy-common", - "riot-rs-esp", "riot-rs-macros", - "riot-rs-nrf", "riot-rs-random", - "riot-rs-rp", "riot-rs-rt", - "riot-rs-stm32", "riot-rs-threads", "riot-rs-utils", "static_cell", diff --git a/Cargo.toml b/Cargo.toml index c69916b0a..51f29abc0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,6 +6,7 @@ members = [ "src/lib/ringbuffer", "src/lib/coapcore", "src/riot-rs", + "src/riot-rs-arch", "src/riot-rs-bench", "src/riot-rs-boards", "src/riot-rs-boards/nrf52", @@ -82,6 +83,7 @@ esp-wifi = { git = "https://github.com/kaspar030/esp-hal", branch = "for-riot-rs linkme = { version = "0.3.21", features = ["used_linker"] } riot-rs = { path = "src/riot-rs", default-features = false } +riot-rs-arch = { path = "src/riot-rs-arch", default-features = false } riot-rs-bench = { path = "src/riot-rs-bench", default-features = false } riot-rs-boards = { path = "src/riot-rs-boards", default-features = false } riot-rs-debug = { path = "src/riot-rs-debug", default-features = false } diff --git a/src/riot-rs-arch/Cargo.toml b/src/riot-rs-arch/Cargo.toml new file mode 100644 index 000000000..acb4f1b31 --- /dev/null +++ b/src/riot-rs-arch/Cargo.toml @@ -0,0 +1,80 @@ +[package] +name = "riot-rs-arch" +version = "0.1.0" +license.workspace = true +edition = "2021" + +[lints] +workspace = true + +[dependencies] +cfg-if.workspace = true + +[target.'cfg(context = "esp")'.dependencies] +riot-rs-esp = { path = "../riot-rs-esp" } + +[target.'cfg(context = "nrf")'.dependencies] +riot-rs-nrf = { path = "../riot-rs-nrf" } + +[target.'cfg(context = "rp")'.dependencies] +riot-rs-rp = { path = "../riot-rs-rp" } + +[target.'cfg(context = "stm32")'.dependencies] +riot-rs-stm32 = { workspace = true } + +[features] +external-interrupts = [ + "riot-rs-esp/external-interrupts", + "riot-rs-nrf/external-interrupts", + "riot-rs-rp/external-interrupts", + "riot-rs-stm32/external-interrupts", +] + +i2c = [ + "riot-rs-esp/i2c", + "riot-rs-nrf/i2c", + "riot-rs-rp/i2c", + "riot-rs-stm32/i2c", +] + +spi = [ + "riot-rs-esp/spi", + "riot-rs-nrf/spi", + "riot-rs-rp/spi", + "riot-rs-stm32/spi", +] + +usb = [ + #"riot-rs-esp/usb", + "riot-rs-nrf/usb", + "riot-rs-rp/usb", + "riot-rs-stm32/usb", +] + +hwrng = [ + #"riot-rs-esp/hwrng", + "riot-rs-nrf/hwrng", + "riot-rs-rp/hwrng", + "riot-rs-stm32/hwrng", +] + +wifi-cyw43 = ["riot-rs-rp/wifi-cyw43"] +wifi-esp = ["riot-rs-esp/wifi-esp"] + +threading = ["riot-rs-esp/threading"] + +executor-single-thread = ["riot-rs-esp/executor-single-thread"] + +executor-interrupt = [ + #"riot-rs-esp/executor-interrupt", + "riot-rs-nrf/executor-interrupt", + "riot-rs-rp/executor-interrupt", + "riot-rs-stm32/executor-interrupt", +] + +defmt = [ + "riot-rs-esp/defmt", + "riot-rs-nrf/defmt", + "riot-rs-rp/defmt", + "riot-rs-stm32/defmt", +] diff --git a/src/riot-rs-arch/src/dummy/executor.rs b/src/riot-rs-arch/src/dummy/executor.rs new file mode 100644 index 000000000..4abf1f11e --- /dev/null +++ b/src/riot-rs-arch/src/dummy/executor.rs @@ -0,0 +1,32 @@ +use embassy_executor::SpawnToken; + +use crate::arch; + +pub struct Executor; + +impl Executor { + #[allow(clippy::new_without_default)] + pub const fn new() -> Self { + // Actually return a value instead of marking it unimplemented like other dummy + // functions, because this function is const and is thus run during compilation + Self {} + } + + pub fn start(&self, _: arch::SWI) { + unimplemented!(); + } + + pub fn spawner(&self) -> Spawner { + unimplemented!(); + } +} + +pub struct Spawner; + +impl Spawner { + #[allow(clippy::result_unit_err)] + pub fn spawn(&self, _token: SpawnToken) -> Result<(), ()> { + unimplemented!(); + } + pub fn must_spawn(&self, _token: SpawnToken) {} +} diff --git a/src/riot-rs-arch/src/dummy/gpio.rs b/src/riot-rs-arch/src/dummy/gpio.rs new file mode 100644 index 000000000..d02cd72eb --- /dev/null +++ b/src/riot-rs-arch/src/dummy/gpio.rs @@ -0,0 +1,188 @@ +macro_rules! define_input_like { + ($type:ident) => { + pub struct $type<'d> { + _marker: core::marker::PhantomData<&'d ()>, + } + + impl $type<'_> { + pub fn is_high(&self) -> bool { + unimplemented!(); + } + + pub fn is_low(&self) -> bool { + unimplemented!(); + } + + pub fn get_level(&self) -> crate::arch::gpio::input::Level { + unimplemented!(); + } + + pub async fn wait_for_high(&mut self) { + unimplemented!(); + } + + pub async fn wait_for_low(&mut self) { + unimplemented!(); + } + + pub async fn wait_for_rising_edge(&mut self) { + unimplemented!(); + } + + pub async fn wait_for_falling_edge(&mut self) { + unimplemented!(); + } + + pub async fn wait_for_any_edge(&mut self) { + unimplemented!(); + } + } + + impl embedded_hal::digital::ErrorType for $type<'_> { + type Error = core::convert::Infallible; + } + + impl embedded_hal::digital::InputPin for $type<'_> { + fn is_low(&mut self) -> Result { + unimplemented!(); + } + + fn is_high(&mut self) -> Result { + unimplemented!(); + } + } + + impl embedded_hal_async::digital::Wait for $type<'_> { + async fn wait_for_high(&mut self) -> Result<(), Self::Error> { + unimplemented!(); + } + + async fn wait_for_low(&mut self) -> Result<(), Self::Error> { + unimplemented!(); + } + + async fn wait_for_rising_edge(&mut self) -> Result<(), Self::Error> { + unimplemented!(); + } + + async fn wait_for_falling_edge(&mut self) -> Result<(), Self::Error> { + unimplemented!(); + } + + async fn wait_for_any_edge(&mut self) -> Result<(), Self::Error> { + unimplemented!(); + } + } + }; +} + +pub mod input { + use crate::arch::peripheral::Peripheral; + + pub(crate) const SCHMITT_TRIGGER_CONFIGURABLE: bool = false; + + pub trait InputPin {} + + pub(crate) fn new( + _pin: impl Peripheral + 'static, + _pull: crate::gpio::Pull, + _schmitt_trigger: bool, + ) -> Result, riot_rs_embassy_common::gpio::input::Error> { + unimplemented!(); + } + + #[cfg(feature = "external-interrupts")] + pub(crate) fn new_int_enabled( + _pin: impl Peripheral + 'static, + _pull: crate::gpio::Pull, + _schmitt_trigger: bool, + ) -> Result, riot_rs_embassy_common::gpio::input::Error> { + unimplemented!(); + } + + define_input_like!(Input); + #[cfg(feature = "external-interrupts")] + define_input_like!(IntEnabledInput); + + pub enum Level { + Low, + High, + } + + riot_rs_embassy_common::define_into_level!(); +} + +pub mod output { + use embedded_hal::digital::StatefulOutputPin; + use riot_rs_embassy_common::gpio::{FromDriveStrength, FromSpeed}; + + use crate::arch::peripheral::Peripheral; + + pub(crate) const DRIVE_STRENGTH_CONFIGURABLE: bool = false; + pub(crate) const SPEED_CONFIGURABLE: bool = false; + + pub trait OutputPin {} + + pub(crate) fn new( + _pin: impl Peripheral + 'static, + _initial_level: crate::gpio::Level, + _drive_strength: DriveStrength, + _speed: Speed, + ) -> Output<'static> { + unimplemented!(); + } + + /// Actual type is architecture-specific. + #[derive(Copy, Clone, PartialEq, Eq)] + pub enum DriveStrength { + #[doc(hidden)] + Hidden, + } + + impl FromDriveStrength for DriveStrength { + fn from(_drive_strength: crate::gpio::DriveStrength) -> Self { + unimplemented!(); + } + } + + /// Actual type is architecture-specific. + #[derive(Copy, Clone, PartialEq, Eq)] + pub enum Speed { + #[doc(hidden)] + Hidden, + } + + impl FromSpeed for Speed { + fn from(_speed: crate::gpio::Speed) -> Self { + unimplemented!(); + } + } + + pub struct Output<'d> { + _marker: core::marker::PhantomData<&'d ()>, + } + + impl embedded_hal::digital::ErrorType for Output<'_> { + type Error = core::convert::Infallible; + } + + impl embedded_hal::digital::OutputPin for Output<'_> { + fn set_low(&mut self) -> Result<(), Self::Error> { + unimplemented!(); + } + + fn set_high(&mut self) -> Result<(), Self::Error> { + unimplemented!(); + } + } + + impl StatefulOutputPin for Output<'_> { + fn is_set_high(&mut self) -> Result { + unimplemented!(); + } + + fn is_set_low(&mut self) -> Result { + unimplemented!(); + } + } +} diff --git a/src/riot-rs-arch/src/dummy/hwrng.rs b/src/riot-rs-arch/src/dummy/hwrng.rs new file mode 100644 index 000000000..901ec360c --- /dev/null +++ b/src/riot-rs-arch/src/dummy/hwrng.rs @@ -0,0 +1,5 @@ +use crate::arch; + +pub fn construct_rng(_peripherals: &mut arch::OptionalPeripherals) { + unimplemented!(); +} diff --git a/src/riot-rs-arch/src/dummy/i2c/controller.rs b/src/riot-rs-arch/src/dummy/i2c/controller.rs new file mode 100644 index 000000000..5df78b747 --- /dev/null +++ b/src/riot-rs-arch/src/dummy/i2c/controller.rs @@ -0,0 +1,63 @@ +//! Architecture- and MCU-specific types for I2C. +//! +//! This module provides a driver for each I2C peripheral, the driver name being the same as the +//! peripheral; see the tests and examples to learn how to instantiate them. +//! These driver instances are meant to be shared between tasks using +//! [`I2cDevice`](crate::i2c::controller::I2cDevice). + +/// Peripheral-agnostic I2C driver implementing [`embedded_hal_async::i2c::I2c`]. +/// +/// This type is not meant to be instantiated directly; instead instantiate a peripheral-specific +/// driver provided by this module. +// NOTE: we keep this type public because it may still required in user-written type signatures. +pub enum I2c { + // Make the docs show that this enum has variants, but do not show any because they are + // MCU-specific. + #[doc(hidden)] + Hidden, +} + +/// MCU-specific I2C bus frequency. +#[derive(Debug, Copy, Clone, PartialEq, Eq)] +pub enum Frequency { + /// Standard mode. + _100k, + /// Fast mode. + _400k, + #[doc(hidden)] + Hidden, +} + +impl Frequency { + pub const fn first() -> Self { + Self::_100k + } + + pub const fn last() -> Self { + Self::_400k + } + + pub const fn next(self) -> Option { + match self { + Self::_100k => Some(Self::_400k), + Self::_400k => None, + Self::Hidden => unreachable!(), + } + } + + pub const fn prev(self) -> Option { + match self { + Self::_100k => None, + Self::_400k => Some(Self::_100k), + Self::Hidden => unreachable!(), + } + } + + pub const fn khz(self) -> u32 { + match self { + Self::_100k => 100, + Self::_400k => 400, + Self::Hidden => unreachable!(), + } + } +} diff --git a/src/riot-rs-arch/src/dummy/i2c/mod.rs b/src/riot-rs-arch/src/dummy/i2c/mod.rs new file mode 100644 index 000000000..82163327f --- /dev/null +++ b/src/riot-rs-arch/src/dummy/i2c/mod.rs @@ -0,0 +1,8 @@ +#[doc(alias = "master")] +pub mod controller; + +use crate::arch; + +pub fn init(_peripherals: &mut arch::OptionalPeripherals) { + unimplemented!(); +} diff --git a/src/riot-rs-arch/src/dummy/mod.rs b/src/riot-rs-arch/src/dummy/mod.rs new file mode 100644 index 000000000..7ea286db3 --- /dev/null +++ b/src/riot-rs-arch/src/dummy/mod.rs @@ -0,0 +1,44 @@ +//! Dummy module used to satisfy platform-independent tooling. +// TODO: redirect to the manufacturer-specific crate documentation when we publish it, and +// mark every item in this dummy module `doc(hidden)` + +mod executor; +pub mod gpio; + +pub mod peripheral { + pub use embassy_hal_internal::Peripheral; +} + +#[cfg(feature = "hwrng")] +pub mod hwrng; + +#[cfg(feature = "i2c")] +pub mod i2c; + +#[cfg(feature = "spi")] +pub mod spi; + +#[cfg(feature = "usb")] +pub mod usb; + +pub use executor::{Executor, Spawner}; + +/// Dummy type. +/// +/// See the `OptionalPeripherals` type of your Embassy architecture crate instead. +pub struct OptionalPeripherals; + +/// Dummy type. +pub struct Peripherals; + +impl From for OptionalPeripherals { + fn from(_peripherals: Peripherals) -> Self { + Self {} + } +} + +pub fn init() -> OptionalPeripherals { + unimplemented!(); +} + +pub struct SWI; diff --git a/src/riot-rs-arch/src/dummy/spi/main/mod.rs b/src/riot-rs-arch/src/dummy/spi/main/mod.rs new file mode 100644 index 000000000..2d1a25f49 --- /dev/null +++ b/src/riot-rs-arch/src/dummy/spi/main/mod.rs @@ -0,0 +1,31 @@ +//! Architecture- and MCU-specific types for SPI. +//! +//! This module provides a driver for each SPI peripheral, the driver name being the same as the +//! peripheral; see the tests and examples to learn how to instantiate them. +//! These driver instances are meant to be shared between tasks using +//! [`SpiDevice`](crate::spi::main::SpiDevice). + +use riot_rs_embassy_common::spi::main::Kilohertz; + +const MAX_FREQUENCY: Kilohertz = Kilohertz::MHz(8); + +/// Peripheral-agnostic SPI driver implementing [`embedded_hal_async::spi::SpiBus`]. +/// +/// This type is not meant to be instantiated directly; instead instantiate a peripheral-specific +/// driver provided by this module. +// NOTE: we keep this type public because it may still required in user-written type signatures. +pub enum Spi { + // Make the docs show that this enum has variants, but do not show any because they are + // MCU-specific. + #[doc(hidden)] + Hidden, +} + +/// MCU-specific I2C bus frequency. +#[derive(Debug, Copy, Clone, PartialEq, Eq)] +pub enum Frequency { + #[doc(hidden)] + F(Kilohertz), +} + +riot_rs_embassy_common::impl_spi_frequency_const_functions!(MAX_FREQUENCY); diff --git a/src/riot-rs-arch/src/dummy/spi/mod.rs b/src/riot-rs-arch/src/dummy/spi/mod.rs new file mode 100644 index 000000000..6a75b4ae3 --- /dev/null +++ b/src/riot-rs-arch/src/dummy/spi/mod.rs @@ -0,0 +1,8 @@ +#[doc(alias = "master")] +pub mod main; + +use crate::arch; + +pub fn init(_peripherals: &mut arch::OptionalPeripherals) { + unimplemented!(); +} diff --git a/src/riot-rs-arch/src/dummy/usb.rs b/src/riot-rs-arch/src/dummy/usb.rs new file mode 100644 index 000000000..39e8aac2c --- /dev/null +++ b/src/riot-rs-arch/src/dummy/usb.rs @@ -0,0 +1,135 @@ +use embassy_usb::driver::{ + Bus, ControlPipe, Driver, Endpoint, EndpointAddress, EndpointAllocError, EndpointError, + EndpointIn, EndpointInfo, EndpointOut, EndpointType, Event, Unsupported, +}; + +use crate::arch; + +pub struct UsbDriver; + +impl<'a> Driver<'a> for UsbDriver { + type EndpointOut = DummyEndpointOut; + type EndpointIn = DummyEndpointIn; + type ControlPipe = DummyControlPipe; + type Bus = DummyBus; + + fn alloc_endpoint_out( + &mut self, + _ep_type: EndpointType, + _max_packet_size: u16, + _interval_ms: u8, + ) -> Result { + unimplemented!(); + } + fn alloc_endpoint_in( + &mut self, + _ep_type: EndpointType, + _max_packet_size: u16, + _interval_ms: u8, + ) -> Result { + unimplemented!(); + } + fn start(self, _control_max_packet_size: u16) -> (Self::Bus, Self::ControlPipe) { + unimplemented!(); + } +} + +pub fn driver(_peripherals: &mut arch::OptionalPeripherals) -> UsbDriver { + unimplemented!(); +} + +pub struct DummyEndpointOut; + +impl Endpoint for DummyEndpointOut { + fn info(&self) -> &EndpointInfo { + unimplemented!(); + } + async fn wait_enabled(&mut self) { + unimplemented!(); + } +} + +impl EndpointOut for DummyEndpointOut { + async fn read(&mut self, _buf: &mut [u8]) -> Result { + unimplemented!(); + } +} + +pub struct DummyEndpointIn; + +impl Endpoint for DummyEndpointIn { + fn info(&self) -> &EndpointInfo { + unimplemented!(); + } + async fn wait_enabled(&mut self) { + unimplemented!(); + } +} + +impl EndpointIn for DummyEndpointIn { + async fn write(&mut self, _buf: &[u8]) -> Result<(), EndpointError> { + unimplemented!(); + } +} + +pub struct DummyControlPipe; + +impl ControlPipe for DummyControlPipe { + fn max_packet_size(&self) -> usize { + unimplemented!(); + } + async fn setup(&mut self) -> [u8; 8] { + unimplemented!(); + } + async fn data_out( + &mut self, + _buf: &mut [u8], + _first: bool, + _last: bool, + ) -> Result { + unimplemented!(); + } + async fn data_in( + &mut self, + _data: &[u8], + _first: bool, + _last: bool, + ) -> Result<(), EndpointError> { + unimplemented!(); + } + async fn accept(&mut self) { + unimplemented!(); + } + async fn reject(&mut self) { + unimplemented!(); + } + async fn accept_set_address(&mut self, _addr: u8) { + unimplemented!(); + } +} + +pub struct DummyBus; + +impl Bus for DummyBus { + async fn enable(&mut self) { + unimplemented!(); + } + async fn disable(&mut self) { + unimplemented!(); + } + async fn poll(&mut self) -> Event { + unimplemented!(); + } + fn endpoint_set_enabled(&mut self, _ep_addr: EndpointAddress, _enabled: bool) { + unimplemented!(); + } + fn endpoint_set_stalled(&mut self, _ep_addr: EndpointAddress, _stalled: bool) { + unimplemented!(); + } + fn endpoint_is_stalled(&mut self, _ep_addr: EndpointAddress) -> bool { + unimplemented!(); + } + async fn remote_wakeup(&mut self) -> Result<(), Unsupported> { + unimplemented!(); + } +} diff --git a/src/riot-rs-arch/src/lib.rs b/src/riot-rs-arch/src/lib.rs new file mode 100644 index 000000000..d42c58ebb --- /dev/null +++ b/src/riot-rs-arch/src/lib.rs @@ -0,0 +1,20 @@ +//! This module dispatches between the riot-rs architecture support crates. + +#![no_std] + +cfg_if::cfg_if! { + if #[cfg(context = "nrf")] { + pub use riot_rs_nrf::*; + } else if #[cfg(context = "rp")] { + pub use riot_rs_rp::*; + } else if #[cfg(context = "esp")] { + pub use riot_rs_esp::*; + } else if #[cfg(context = "stm32")] { + pub use riot_rs_stm32::*; + } else if #[cfg(context = "riot-rs")] { + compile_error!("this architecture is not supported"); + } else { + mod dummy; + pub use dummy::*; + } +} diff --git a/src/riot-rs-embassy/Cargo.toml b/src/riot-rs-embassy/Cargo.toml index 9c7c70700..437bd614b 100644 --- a/src/riot-rs-embassy/Cargo.toml +++ b/src/riot-rs-embassy/Cargo.toml @@ -28,6 +28,7 @@ embassy-usb = { workspace = true, optional = true } embedded-hal = { workspace = true } embedded-hal-async = { workspace = true } +riot-rs-arch = { path = "../riot-rs-arch" } riot-rs-embassy-common = { workspace = true } riot-rs-threads = { path = "../riot-rs-threads", optional = true } riot-rs-debug = { workspace = true } @@ -45,27 +46,11 @@ embassy-executor = { workspace = true, default-features = false, features = [ "arch-cortex-m", ] } -# Manufacturer-specific -[target.'cfg(context = "esp")'.dependencies] -riot-rs-esp = { path = "../riot-rs-esp" } - -[target.'cfg(context = "nrf")'.dependencies] -riot-rs-nrf = { path = "../riot-rs-nrf" } - -[target.'cfg(context = "rp")'.dependencies] -riot-rs-rp = { path = "../riot-rs-rp" } - -[target.'cfg(context = "stm32")'.dependencies] -riot-rs-stm32 = { workspace = true } - [features] ## Enables GPIO interrupt support. external-interrupts = [ "riot-rs-embassy-common/external-interrupts", - "riot-rs-esp/external-interrupts", - "riot-rs-nrf/external-interrupts", - "riot-rs-rp/external-interrupts", - "riot-rs-stm32/external-interrupts", + "riot-rs-arch/external-interrupts", ] time = ["dep:embassy-time", "embassy-executor/integrated-timers"] @@ -73,49 +58,34 @@ time = ["dep:embassy-time", "embassy-executor/integrated-timers"] i2c = [ "dep:embassy-embedded-hal", "riot-rs-embassy-common/i2c", - "riot-rs-esp/i2c", - "riot-rs-nrf/i2c", - "riot-rs-rp/i2c", - "riot-rs-stm32/i2c", + "riot-rs-arch/i2c", ] ## Enables SPI support. spi = [ "dep:embassy-embedded-hal", "riot-rs-embassy-common/spi", - "riot-rs-esp/spi", - "riot-rs-nrf/spi", - "riot-rs-rp/spi", - "riot-rs-stm32/spi", -] -usb = [ - "dep:embassy-usb", - "riot-rs-nrf/usb", - "riot-rs-rp/usb", - "riot-rs-stm32/usb", + "riot-rs-arch/spi", ] +usb = ["dep:embassy-usb", "riot-rs-arch/usb"] # embassy-net requires embassy-time and support for timeouts in the executor net = ["dep:embassy-net", "time"] usb-ethernet = ["usb", "net"] ## Use a hardware RNG to seed into the riot-rs-random system-wide RNG -hwrng = ["riot-rs-nrf/hwrng", "riot-rs-rp/hwrng", "riot-rs-stm32/hwrng"] +hwrng = ["riot-rs-arch/hwrng"] wifi = [] -wifi-cyw43 = ["riot-rs-rp/wifi-cyw43", "net", "wifi"] -wifi-esp = ["riot-rs-esp/wifi-esp", "net", "wifi"] +wifi-cyw43 = ["riot-rs-arch/wifi-cyw43", "net", "wifi"] +wifi-esp = ["riot-rs-arch/wifi-esp", "net", "wifi"] -threading = ["dep:riot-rs-threads", "riot-rs-esp/threading"] +threading = ["dep:riot-rs-threads", "riot-rs-arch/threading"] override-network-config = [] override-usb-config = [] executor-single-thread = [ "riot-rs-rt/executor-single-thread", - "riot-rs-esp/executor-single-thread", -] -executor-interrupt = [ - "riot-rs-nrf/executor-interrupt", - "riot-rs-rp/executor-interrupt", - "riot-rs-stm32/executor-interrupt", + "riot-rs-arch/executor-single-thread", ] +executor-interrupt = ["riot-rs-arch/executor-interrupt"] executor-thread = ["threading"] executor-none = [] @@ -123,9 +93,6 @@ defmt = [ "embassy-net?/defmt", "embassy-time?/defmt", "embassy-usb?/defmt", + "riot-rs-arch/defmt", "riot-rs-embassy-common/defmt", - "riot-rs-esp/defmt", - "riot-rs-nrf/defmt", - "riot-rs-rp/defmt", - "riot-rs-stm32/defmt", ] diff --git a/src/riot-rs-embassy/src/lib.rs b/src/riot-rs-embassy/src/lib.rs index 1f85fea59..f1cf758f3 100644 --- a/src/riot-rs-embassy/src/lib.rs +++ b/src/riot-rs-embassy/src/lib.rs @@ -8,21 +8,7 @@ pub mod define_peripherals; pub mod gpio; -cfg_if::cfg_if! { - if #[cfg(context = "nrf")] { - pub use riot_rs_nrf as arch; - } else if #[cfg(context = "rp")] { - pub use riot_rs_rp as arch; - } else if #[cfg(context = "esp")] { - pub use riot_rs_esp as arch; - } else if #[cfg(context = "stm32")] { - pub use riot_rs_stm32 as arch; - } else if #[cfg(context = "riot-rs")] { - compile_error!("this architecture is not supported"); - } else { - pub mod arch; - } -} +pub use riot_rs_arch as arch; #[cfg(feature = "i2c")] pub mod i2c;