diff --git a/src/generic.rs b/src/generic.rs index c8cae283..209b70cf 100644 --- a/src/generic.rs +++ b/src/generic.rs @@ -38,7 +38,7 @@ pub trait RegisterSpec { #[doc = " Raw field type"] pub trait FieldSpec: Sized { #[doc = " Raw field type (`u8`, `u16`, `u32`, ...)."] - type Ux: Copy + PartialEq + From; + type Ux: Copy + core::fmt::Debug + PartialEq + From; } #[doc = " Marker for fields with fixed values"] pub trait IsEnum: FieldSpec {} @@ -198,6 +198,14 @@ impl Reg { self.register.set(f(&R { bits, _reg: marker::PhantomData }, &mut W { bits: bits & !REG::ONE_TO_MODIFY_FIELDS_BITMAP | REG::ZERO_TO_MODIFY_FIELDS_BITMAP, _reg: marker::PhantomData }).bits); } } +impl core::fmt::Debug for crate::generic::Reg +where + R: core::fmt::Debug, +{ + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + core::fmt::Debug::fmt(&self.read(), f) + } +} #[doc(hidden)] pub mod raw; #[doc = " Register reader."] @@ -263,6 +271,11 @@ impl FieldReader { self.bits } } +impl core::fmt::Debug for FieldReader { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + core::fmt::Debug::fmt(&self.bits, f) + } +} impl PartialEq for FieldReader where FI: FieldSpec + Copy, @@ -299,6 +312,11 @@ impl BitReader { self.bit() } } +impl core::fmt::Debug for BitReader { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + core::fmt::Debug::fmt(&self.bits, f) + } +} #[doc = " Marker for register/field writers which can take any value of specified width"] pub struct Safe; #[doc = " You should check that value is allowed to pass to register/field writer marked with this"] diff --git a/src/lib.rs b/src/lib.rs index 2083556c..0ed3c3c7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,5 @@ -#![doc = "Peripheral access API for XMC4700 microcontrollers (generated using svd2rust v0.33.1 ( ))\n\nYou can find an overview of the generated API [here].\n\nAPI features to be included in the [next] -svd2rust release can be generated by cloning the svd2rust [repository], checking out the above commit, and running `cargo doc --open`.\n\n[here]: https://docs.rs/svd2rust/0.33.1/svd2rust/#peripheral-api\n[next]: https://github.com/rust-embedded/svd2rust/blob/master/CHANGELOG.md#unreleased\n[repository]: https://github.com/rust-embedded/svd2rust"] +#![doc = "Peripheral access API for XMC4700 microcontrollers (generated using svd2rust v0.33.3 ( ))\n\nYou can find an overview of the generated API [here].\n\nAPI features to be included in the [next] +svd2rust release can be generated by cloning the svd2rust [repository], checking out the above commit, and running `cargo doc --open`.\n\n[here]: https://docs.rs/svd2rust/0.33.3/svd2rust/#peripheral-api\n[next]: https://github.com/rust-embedded/svd2rust/blob/master/CHANGELOG.md#unreleased\n[repository]: https://github.com/rust-embedded/svd2rust"] #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![no_std]