embassy-stm32::hspi: gate derive(defmt::Format) behind feature flag

This commit is contained in:
dimi 2025-03-18 17:00:40 +01:00
parent 9d672c44d1
commit e9b842082d
2 changed files with 24 additions and 12 deletions

View File

@ -1,7 +1,8 @@
//! Enums used in Hspi configuration. //! Enums used in Hspi configuration.
#[allow(dead_code)] #[allow(dead_code)]
#[derive(Copy, Clone, defmt::Format)] #[derive(Copy, Clone)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub(crate) enum HspiMode { pub(crate) enum HspiMode {
IndirectWrite, IndirectWrite,
IndirectRead, IndirectRead,
@ -22,7 +23,8 @@ impl Into<u8> for HspiMode {
/// Hspi lane width /// Hspi lane width
#[allow(dead_code)] #[allow(dead_code)]
#[derive(Copy, Clone, defmt::Format)] #[derive(Copy, Clone)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum HspiWidth { pub enum HspiWidth {
/// None /// None
NONE, NONE,
@ -53,7 +55,8 @@ impl Into<u8> for HspiWidth {
/// Flash bank selection /// Flash bank selection
#[allow(dead_code)] #[allow(dead_code)]
#[derive(Copy, Clone, defmt::Format)] #[derive(Copy, Clone)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum FlashSelection { pub enum FlashSelection {
/// Bank 1 /// Bank 1
Flash1, Flash1,
@ -73,7 +76,8 @@ impl Into<bool> for FlashSelection {
/// Wrap Size /// Wrap Size
#[allow(dead_code)] #[allow(dead_code)]
#[allow(missing_docs)] #[allow(missing_docs)]
#[derive(Copy, Clone, defmt::Format)] #[derive(Copy, Clone)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum WrapSize { pub enum WrapSize {
None, None,
_16Bytes, _16Bytes,
@ -97,7 +101,8 @@ impl Into<u8> for WrapSize {
/// Memory Type /// Memory Type
#[allow(missing_docs)] #[allow(missing_docs)]
#[allow(dead_code)] #[allow(dead_code)]
#[derive(Copy, Clone, defmt::Format)] #[derive(Copy, Clone)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum MemoryType { pub enum MemoryType {
Micron, Micron,
Macronix, Macronix,
@ -122,7 +127,8 @@ impl Into<u8> for MemoryType {
/// Hspi memory size. /// Hspi memory size.
#[allow(missing_docs)] #[allow(missing_docs)]
#[derive(Copy, Clone, defmt::Format)] #[derive(Copy, Clone)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum MemorySize { pub enum MemorySize {
_1KiB, _1KiB,
_2KiB, _2KiB,
@ -182,7 +188,8 @@ impl Into<u8> for MemorySize {
} }
/// Hspi Address size /// Hspi Address size
#[derive(Copy, Clone, defmt::Format)] #[derive(Copy, Clone)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum AddressSize { pub enum AddressSize {
/// 8-bit address /// 8-bit address
_8Bit, _8Bit,
@ -207,7 +214,8 @@ impl Into<u8> for AddressSize {
/// Time the Chip Select line stays high. /// Time the Chip Select line stays high.
#[allow(missing_docs)] #[allow(missing_docs)]
#[derive(Copy, Clone, defmt::Format)] #[derive(Copy, Clone)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum ChipSelectHighTime { pub enum ChipSelectHighTime {
_1Cycle, _1Cycle,
_2Cycle, _2Cycle,
@ -236,7 +244,8 @@ impl Into<u8> for ChipSelectHighTime {
/// FIFO threshold. /// FIFO threshold.
#[allow(missing_docs)] #[allow(missing_docs)]
#[derive(Copy, Clone, defmt::Format)] #[derive(Copy, Clone)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum FIFOThresholdLevel { pub enum FIFOThresholdLevel {
_1Bytes, _1Bytes,
_2Bytes, _2Bytes,
@ -313,7 +322,8 @@ impl Into<u8> for FIFOThresholdLevel {
/// Dummy cycle count /// Dummy cycle count
#[allow(missing_docs)] #[allow(missing_docs)]
#[derive(Copy, Clone, defmt::Format)] #[derive(Copy, Clone)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum DummyCycles { pub enum DummyCycles {
_0, _0,
_1, _1,
@ -391,7 +401,8 @@ impl Into<u8> for DummyCycles {
/// Functional mode /// Functional mode
#[allow(missing_docs)] #[allow(missing_docs)]
#[allow(dead_code)] #[allow(dead_code)]
#[derive(Copy, Clone, defmt::Format)] #[derive(Copy, Clone)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum FunctionalMode { pub enum FunctionalMode {
IndirectWrite, IndirectWrite,
IndirectRead, IndirectRead,

View File

@ -24,7 +24,8 @@ use crate::rcc::{self, RccPeripheral};
use crate::{peripherals, Peripheral}; use crate::{peripherals, Peripheral};
/// HSPI driver config. /// HSPI driver config.
#[derive(Clone, Copy, defmt::Format)] #[derive(Clone, Copy)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct Config { pub struct Config {
/// Fifo threshold used by the peripheral to generate the interrupt indicating data /// Fifo threshold used by the peripheral to generate the interrupt indicating data
/// or space is available in the FIFO /// or space is available in the FIFO