aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Lilleengen <[email protected]>2025-03-19 07:48:46 +0000
committerGitHub <[email protected]>2025-03-19 07:48:46 +0000
commit81e90935071e6d6a5ce4786a2e94c66fbadbe979 (patch)
tree48ccd7e10af1ba07657f44083f8bf27742a9dad1
parent8bce1fe03ef889b82862f9debc32b2aca8e0bda2 (diff)
parente9b842082df4d8138d3100ecc8ad177245391f38 (diff)
Merge pull request #3971 from dimpolo/defmt-feature-gate
`embassy-stm32::hspi`: gate derive(defmt::Format) behind feature flag
-rw-r--r--embassy-stm32/src/hspi/enums.rs33
-rw-r--r--embassy-stm32/src/hspi/mod.rs3
2 files changed, 24 insertions, 12 deletions
diff --git a/embassy-stm32/src/hspi/enums.rs b/embassy-stm32/src/hspi/enums.rs
index 351fc9ec6..83a88f4d9 100644
--- a/embassy-stm32/src/hspi/enums.rs
+++ b/embassy-stm32/src/hspi/enums.rs
@@ -1,7 +1,8 @@
1//! Enums used in Hspi configuration. 1//! Enums used in Hspi configuration.
2 2
3#[allow(dead_code)] 3#[allow(dead_code)]
4#[derive(Copy, Clone, defmt::Format)] 4#[derive(Copy, Clone)]
5#[cfg_attr(feature = "defmt", derive(defmt::Format))]
5pub(crate) enum HspiMode { 6pub(crate) enum HspiMode {
6 IndirectWrite, 7 IndirectWrite,
7 IndirectRead, 8 IndirectRead,
@@ -22,7 +23,8 @@ impl Into<u8> for HspiMode {
22 23
23/// Hspi lane width 24/// Hspi lane width
24#[allow(dead_code)] 25#[allow(dead_code)]
25#[derive(Copy, Clone, defmt::Format)] 26#[derive(Copy, Clone)]
27#[cfg_attr(feature = "defmt", derive(defmt::Format))]
26pub enum HspiWidth { 28pub enum HspiWidth {
27 /// None 29 /// None
28 NONE, 30 NONE,
@@ -53,7 +55,8 @@ impl Into<u8> for HspiWidth {
53 55
54/// Flash bank selection 56/// Flash bank selection
55#[allow(dead_code)] 57#[allow(dead_code)]
56#[derive(Copy, Clone, defmt::Format)] 58#[derive(Copy, Clone)]
59#[cfg_attr(feature = "defmt", derive(defmt::Format))]
57pub enum FlashSelection { 60pub enum FlashSelection {
58 /// Bank 1 61 /// Bank 1
59 Flash1, 62 Flash1,
@@ -73,7 +76,8 @@ impl Into<bool> for FlashSelection {
73/// Wrap Size 76/// Wrap Size
74#[allow(dead_code)] 77#[allow(dead_code)]
75#[allow(missing_docs)] 78#[allow(missing_docs)]
76#[derive(Copy, Clone, defmt::Format)] 79#[derive(Copy, Clone)]
80#[cfg_attr(feature = "defmt", derive(defmt::Format))]
77pub enum WrapSize { 81pub enum WrapSize {
78 None, 82 None,
79 _16Bytes, 83 _16Bytes,
@@ -97,7 +101,8 @@ impl Into<u8> for WrapSize {
97/// Memory Type 101/// Memory Type
98#[allow(missing_docs)] 102#[allow(missing_docs)]
99#[allow(dead_code)] 103#[allow(dead_code)]
100#[derive(Copy, Clone, defmt::Format)] 104#[derive(Copy, Clone)]
105#[cfg_attr(feature = "defmt", derive(defmt::Format))]
101pub enum MemoryType { 106pub enum MemoryType {
102 Micron, 107 Micron,
103 Macronix, 108 Macronix,
@@ -122,7 +127,8 @@ impl Into<u8> for MemoryType {
122 127
123/// Hspi memory size. 128/// Hspi memory size.
124#[allow(missing_docs)] 129#[allow(missing_docs)]
125#[derive(Copy, Clone, defmt::Format)] 130#[derive(Copy, Clone)]
131#[cfg_attr(feature = "defmt", derive(defmt::Format))]
126pub enum MemorySize { 132pub enum MemorySize {
127 _1KiB, 133 _1KiB,
128 _2KiB, 134 _2KiB,
@@ -182,7 +188,8 @@ impl Into<u8> for MemorySize {
182} 188}
183 189
184/// Hspi Address size 190/// Hspi Address size
185#[derive(Copy, Clone, defmt::Format)] 191#[derive(Copy, Clone)]
192#[cfg_attr(feature = "defmt", derive(defmt::Format))]
186pub enum AddressSize { 193pub enum AddressSize {
187 /// 8-bit address 194 /// 8-bit address
188 _8Bit, 195 _8Bit,
@@ -207,7 +214,8 @@ impl Into<u8> for AddressSize {
207 214
208/// Time the Chip Select line stays high. 215/// Time the Chip Select line stays high.
209#[allow(missing_docs)] 216#[allow(missing_docs)]
210#[derive(Copy, Clone, defmt::Format)] 217#[derive(Copy, Clone)]
218#[cfg_attr(feature = "defmt", derive(defmt::Format))]
211pub enum ChipSelectHighTime { 219pub enum ChipSelectHighTime {
212 _1Cycle, 220 _1Cycle,
213 _2Cycle, 221 _2Cycle,
@@ -236,7 +244,8 @@ impl Into<u8> for ChipSelectHighTime {
236 244
237/// FIFO threshold. 245/// FIFO threshold.
238#[allow(missing_docs)] 246#[allow(missing_docs)]
239#[derive(Copy, Clone, defmt::Format)] 247#[derive(Copy, Clone)]
248#[cfg_attr(feature = "defmt", derive(defmt::Format))]
240pub enum FIFOThresholdLevel { 249pub enum FIFOThresholdLevel {
241 _1Bytes, 250 _1Bytes,
242 _2Bytes, 251 _2Bytes,
@@ -313,7 +322,8 @@ impl Into<u8> for FIFOThresholdLevel {
313 322
314/// Dummy cycle count 323/// Dummy cycle count
315#[allow(missing_docs)] 324#[allow(missing_docs)]
316#[derive(Copy, Clone, defmt::Format)] 325#[derive(Copy, Clone)]
326#[cfg_attr(feature = "defmt", derive(defmt::Format))]
317pub enum DummyCycles { 327pub enum DummyCycles {
318 _0, 328 _0,
319 _1, 329 _1,
@@ -391,7 +401,8 @@ impl Into<u8> for DummyCycles {
391/// Functional mode 401/// Functional mode
392#[allow(missing_docs)] 402#[allow(missing_docs)]
393#[allow(dead_code)] 403#[allow(dead_code)]
394#[derive(Copy, Clone, defmt::Format)] 404#[derive(Copy, Clone)]
405#[cfg_attr(feature = "defmt", derive(defmt::Format))]
395pub enum FunctionalMode { 406pub enum FunctionalMode {
396 IndirectWrite, 407 IndirectWrite,
397 IndirectRead, 408 IndirectRead,
diff --git a/embassy-stm32/src/hspi/mod.rs b/embassy-stm32/src/hspi/mod.rs
index 97e1993dd..54b442481 100644
--- a/embassy-stm32/src/hspi/mod.rs
+++ b/embassy-stm32/src/hspi/mod.rs
@@ -24,7 +24,8 @@ use crate::rcc::{self, RccPeripheral};
24use crate::{peripherals, Peripheral}; 24use crate::{peripherals, Peripheral};
25 25
26/// HSPI driver config. 26/// HSPI driver config.
27#[derive(Clone, Copy, defmt::Format)] 27#[derive(Clone, Copy)]
28#[cfg_attr(feature = "defmt", derive(defmt::Format))]
28pub struct Config { 29pub struct Config {
29 /// Fifo threshold used by the peripheral to generate the interrupt indicating data 30 /// Fifo threshold used by the peripheral to generate the interrupt indicating data
30 /// or space is available in the FIFO 31 /// or space is available in the FIFO