From 542ae72ca77f3af95ff0b2a62e1110728e72053d Mon Sep 17 00:00:00 2001 From: goodhoko Date: Tue, 16 Sep 2025 00:23:52 +0200 Subject: Unify derivation of Clone, Copy and defmt::format for all *SPI configs --- embassy-stm32/src/hspi/mod.rs | 2 ++ embassy-stm32/src/ospi/mod.rs | 3 +++ embassy-stm32/src/qspi/mod.rs | 2 ++ embassy-stm32/src/xspi/mod.rs | 3 +++ 4 files changed, 10 insertions(+) diff --git a/embassy-stm32/src/hspi/mod.rs b/embassy-stm32/src/hspi/mod.rs index 3b73062a2..95d9e5099 100644 --- a/embassy-stm32/src/hspi/mod.rs +++ b/embassy-stm32/src/hspi/mod.rs @@ -86,6 +86,8 @@ impl Default for Config { } /// HSPI transfer configuration. +#[derive(Clone, Copy)] +#[cfg_attr(feature = "defmt", derive(defmt::Format))] pub struct TransferConfig { /// Instruction width (IMODE) pub iwidth: HspiWidth, diff --git a/embassy-stm32/src/ospi/mod.rs b/embassy-stm32/src/ospi/mod.rs index cbd6c8d35..eebaf5573 100644 --- a/embassy-stm32/src/ospi/mod.rs +++ b/embassy-stm32/src/ospi/mod.rs @@ -23,6 +23,7 @@ use crate::{peripherals, Peri}; /// OPSI driver config. #[derive(Clone, Copy)] +#[cfg_attr(feature = "defmt", derive(defmt::Format))] pub struct Config { /// Fifo threshold used by the peripheral to generate the interrupt indicating data /// or space is available in the FIFO @@ -83,6 +84,8 @@ impl Default for Config { } /// OSPI transfer configuration. +#[derive(Clone, Copy)] +#[cfg_attr(feature = "defmt", derive(defmt::Format))] pub struct TransferConfig { /// Instruction width (IMODE) pub iwidth: OspiWidth, diff --git a/embassy-stm32/src/qspi/mod.rs b/embassy-stm32/src/qspi/mod.rs index 0644069a6..b03cd9009 100644 --- a/embassy-stm32/src/qspi/mod.rs +++ b/embassy-stm32/src/qspi/mod.rs @@ -18,6 +18,7 @@ use crate::{peripherals, Peri}; /// QSPI transfer configuration. #[derive(Clone, Copy)] +#[cfg_attr(feature = "defmt", derive(defmt::Format))] pub struct TransferConfig { /// Instruction width (IMODE) pub iwidth: QspiWidth, @@ -48,6 +49,7 @@ impl Default for TransferConfig { /// QSPI driver configuration. #[derive(Clone, Copy)] +#[cfg_attr(feature = "defmt", derive(defmt::Format))] #[non_exhaustive] pub struct Config { /// Flash memory size representend as 2^[0-32], as reasonable minimum 1KiB(9) was chosen. diff --git a/embassy-stm32/src/xspi/mod.rs b/embassy-stm32/src/xspi/mod.rs index 5ae074a90..901569f64 100644 --- a/embassy-stm32/src/xspi/mod.rs +++ b/embassy-stm32/src/xspi/mod.rs @@ -23,6 +23,7 @@ use crate::{peripherals, Peri}; /// XPSI driver config. #[derive(Clone, Copy)] +#[cfg_attr(feature = "defmt", derive(defmt::Format))] pub struct Config { /// Fifo threshold used by the peripheral to generate the interrupt indicating data /// or space is available in the FIFO @@ -80,6 +81,8 @@ impl Default for Config { } /// XSPI transfer configuration. +#[derive(Clone, Copy)] +#[cfg_attr(feature = "defmt", derive(defmt::Format))] pub struct TransferConfig { /// Instruction width (IMODE) pub iwidth: XspiWidth, -- cgit