154154
155155use crate :: private;
156156
157+ #[ cfg( feature = "defmt-03" ) ]
158+ use crate :: defmt;
159+
157160/// I2C error
158161pub trait Error : core:: fmt:: Debug {
159162 /// Convert error to a generic I2C error kind
@@ -176,6 +179,7 @@ impl Error for core::convert::Infallible {
176179/// free to define more specific or additional error types. However, by providing
177180/// a mapping to these common I2C errors, generic code can still react to them.
178181#[ derive( Debug , Copy , Clone , Eq , PartialEq , Ord , PartialOrd , Hash ) ]
182+ #[ cfg_attr( feature = "defmt-03" , derive( defmt:: Format ) ) ]
179183#[ non_exhaustive]
180184pub enum ErrorKind {
181185 /// Bus error occurred. e.g. A START or a STOP condition is detected and is not
@@ -199,6 +203,7 @@ pub enum ErrorKind {
199203/// response was received to an address versus a no acknowledge to a data byte.
200204/// Where it is not possible to differentiate, `Unknown` should be indicated.
201205#[ derive( Debug , Copy , Clone , Eq , PartialEq , Ord , PartialOrd , Hash ) ]
206+ #[ cfg_attr( feature = "defmt-03" , derive( defmt:: Format ) ) ]
202207pub enum NoAcknowledgeSource {
203208 /// The device did not acknowledge its address. The device may be missing.
204209 Address ,
@@ -272,6 +277,7 @@ impl AddressMode for TenBitAddress {}
272277///
273278/// Several operations can be combined as part of a transaction.
274279#[ derive( Debug , PartialEq , Eq ) ]
280+ #[ cfg_attr( feature = "defmt-03" , derive( defmt:: Format ) ) ]
275281pub enum Operation < ' a > {
276282 /// Read data into the provided buffer
277283 Read ( & ' a mut [ u8 ] ) ,
0 commit comments