Skip to content

Commit dc36288

Browse files
committed
defmt: Use Debug2Format for ADC Resolution
1 parent 1e0fde1 commit dc36288

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

src/adc.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -333,21 +333,11 @@ pub struct StoredConfig(AdcSampleTime, Resolution, AdcLshift);
333333
#[cfg(feature = "defmt")]
334334
impl defmt::Format for StoredConfig {
335335
fn format(&self, fmt: defmt::Formatter) {
336-
use stm32h7::stm32h743v::adc3::cfgr::RES_A;
337-
let res = match self.1 {
338-
RES_A::SIXTEENBIT => defmt::intern!("SIXTEENBIT"),
339-
RES_A::FOURTEENBIT => defmt::intern!("FOURTEENBIT"),
340-
RES_A::FOURTEENBITV => defmt::intern!("FOURTEENBITV"),
341-
RES_A::TWELVEBIT => defmt::intern!("TWELVEBIT"),
342-
RES_A::TWELVEBITV => defmt::intern!("TWELVEBITV"),
343-
RES_A::TENBIT => defmt::intern!("TENBIT"),
344-
RES_A::EIGHTBIT => defmt::intern!("EIGHTBIT"),
345-
};
346336
defmt::write!(
347337
fmt,
348-
"StoredConfig({:?}, {=istr}, {:?})",
338+
"StoredConfig({:?}, {:?}, {:?})",
349339
self.0,
350-
res,
340+
defmt::Debug2Format(&self.1),
351341
self.2
352342
)
353343
}

0 commit comments

Comments
 (0)