163163
164164use core:: fmt:: Debug ;
165165
166+ #[ cfg( feature = "defmt-03" ) ]
167+ use crate :: defmt;
168+
166169/// Clock polarity
167170#[ derive( Clone , Copy , Debug , PartialEq , Eq ) ]
171+ #[ cfg_attr( feature = "defmt-03" , derive( defmt:: Format ) ) ]
168172pub enum Polarity {
169173 /// Clock signal low when idle
170174 IdleLow ,
@@ -174,6 +178,7 @@ pub enum Polarity {
174178
175179/// Clock phase
176180#[ derive( Clone , Copy , Debug , PartialEq , Eq ) ]
181+ #[ cfg_attr( feature = "defmt-03" , derive( defmt:: Format ) ) ]
177182pub enum Phase {
178183 /// Data in "captured" on the first clock transition
179184 CaptureOnFirstTransition ,
@@ -183,6 +188,7 @@ pub enum Phase {
183188
184189/// SPI mode
185190#[ derive( Clone , Copy , Debug , PartialEq , Eq ) ]
191+ #[ cfg_attr( feature = "defmt-03" , derive( defmt:: Format ) ) ]
186192pub struct Mode {
187193 /// Clock polarity
188194 pub polarity : Polarity ,
@@ -236,6 +242,7 @@ impl Error for core::convert::Infallible {
236242/// free to define more specific or additional error types. However, by providing
237243/// a mapping to these common SPI errors, generic code can still react to them.
238244#[ derive( Debug , Copy , Clone , Eq , PartialEq , Ord , PartialOrd , Hash ) ]
245+ #[ cfg_attr( feature = "defmt-03" , derive( defmt:: Format ) ) ]
239246#[ non_exhaustive]
240247pub enum ErrorKind {
241248 /// The peripheral receive buffer was overrun
@@ -295,7 +302,8 @@ impl<T: ErrorType + ?Sized> ErrorType for &mut T {
295302/// SPI transaction operation.
296303///
297304/// This allows composition of SPI operations into a single bus transaction
298- #[ derive( Debug , PartialEq ) ]
305+ #[ derive( Debug , PartialEq , Eq ) ]
306+ #[ cfg_attr( feature = "defmt-03" , derive( defmt:: Format ) ) ]
299307pub enum Operation < ' a , Word : ' static > {
300308 /// Read data into the provided buffer.
301309 ///
0 commit comments