Skip to content

Commit 211e59c

Browse files
Generate reset for write-only registers
I'm unsure if this was intended behavior...
1 parent efe90b0 commit 211e59c

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/generate.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -785,23 +785,21 @@ pub fn register(
785785
}
786786
});
787787

788+
reg_impl_items.push(quote! {
789+
/// Writes the reset value to the register
790+
#[inline]
791+
pub fn reset(&self) {
792+
self.write(|w| w)
793+
}
794+
})
795+
788796
w_impl_items.push(quote! {
789797
/// Reset value of the register
790798
#[inline]
791799
pub fn reset_value() -> W {
792800
W { bits: #rv }
793801
}
794802
});
795-
796-
if access == Access::ReadWrite {
797-
reg_impl_items.push(quote! {
798-
/// Writes the reset value to the register
799-
#[inline]
800-
pub fn reset(&self) {
801-
self.write(|w| w)
802-
}
803-
})
804-
}
805803
}
806804

807805
w_impl_items.push(quote! {

0 commit comments

Comments
 (0)