Skip to content

Commit 7be13d5

Browse files
xmc-action-bot[bot]lucasbrendelkodiakhq[bot]
authored
feat: updating from newer svd2rust (#95)
Co-authored-by: lucasbrendel <1765755+lucasbrendel@users.noreply.github.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent 13354c6 commit 7be13d5

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

src/generic.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub trait RegisterSpec {
3838
#[doc = " Raw field type"]
3939
pub trait FieldSpec: Sized {
4040
#[doc = " Raw field type (`u8`, `u16`, `u32`, ...)."]
41-
type Ux: Copy + PartialEq + From<Self>;
41+
type Ux: Copy + core::fmt::Debug + PartialEq + From<Self>;
4242
}
4343
#[doc = " Marker for fields with fixed values"]
4444
pub trait IsEnum: FieldSpec {}
@@ -198,6 +198,14 @@ impl<REG: Readable + Writable> Reg<REG> {
198198
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);
199199
}
200200
}
201+
impl<REG: Readable> core::fmt::Debug for crate::generic::Reg<REG>
202+
where
203+
R<REG>: core::fmt::Debug,
204+
{
205+
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
206+
core::fmt::Debug::fmt(&self.read(), f)
207+
}
208+
}
201209
#[doc(hidden)]
202210
pub mod raw;
203211
#[doc = " Register reader."]
@@ -263,6 +271,11 @@ impl<FI: FieldSpec> FieldReader<FI> {
263271
self.bits
264272
}
265273
}
274+
impl<FI: FieldSpec> core::fmt::Debug for FieldReader<FI> {
275+
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
276+
core::fmt::Debug::fmt(&self.bits, f)
277+
}
278+
}
266279
impl<FI> PartialEq<FI> for FieldReader<FI>
267280
where
268281
FI: FieldSpec + Copy,
@@ -299,6 +312,11 @@ impl<FI> BitReader<FI> {
299312
self.bit()
300313
}
301314
}
315+
impl<FI> core::fmt::Debug for BitReader<FI> {
316+
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
317+
core::fmt::Debug::fmt(&self.bits, f)
318+
}
319+
}
302320
#[doc = " Marker for register/field writers which can take any value of specified width"]
303321
pub struct Safe;
304322
#[doc = " You should check that value is allowed to pass to register/field writer marked with this"]

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#![doc = "Peripheral access API for XMC4200 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]
2-
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"]
1+
#![doc = "Peripheral access API for XMC4200 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]
2+
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"]
33
#![allow(non_camel_case_types)]
44
#![allow(non_snake_case)]
55
#![no_std]

0 commit comments

Comments
 (0)