Skip to content

Commit 752b67b

Browse files
committed
Auto merge of #80 - whitequark:reset-method, r=japaric
Add a .reset() method as a short-hand for .write(|w| w) This is only done for Access::ReadWrite because writing the reset value to write-only registers does not seem like it has any potential use at all. Fixes #19.
2 parents ee35f3e + a504b64 commit 752b67b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/generate.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,18 @@ pub fn register(
520520
);
521521
}
522522

523+
if access == Access::ReadWrite {
524+
reg_impl_items.push(
525+
quote! {
526+
/// Writes the reset value to the register
527+
#[inline(always)]
528+
pub fn reset(&self) {
529+
self.write(|w| w)
530+
}
531+
}
532+
)
533+
}
534+
523535
mod_items.push(
524536
quote! {
525537
impl super::#name_pc {

0 commit comments

Comments
 (0)