Skip to content

Commit 4236021

Browse files
committed
add Safety doc
1 parent a7288e6 commit 4236021

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/generate/generic.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ where
130130
/// Writes 0 to a `Writable` register.
131131
///
132132
/// Similar to `write`, but unused bits will contain 0.
133+
///
134+
/// # Safety
135+
///
136+
/// Unsafe to use with registers which don't allow to write 0.
133137
#[inline(always)]
134138
pub unsafe fn write_with_zero<F>(&self, f: F)
135139
where
@@ -232,6 +236,10 @@ pub struct W<REG: RegisterSpec + ?Sized> {
232236

233237
impl<REG: RegisterSpec> W<REG> {
234238
/// Writes raw bits to the register.
239+
///
240+
/// # Safety
241+
///
242+
/// Read datasheet or reference manual to find what values are allowed to pass.
235243
#[inline(always)]
236244
pub unsafe fn bits(&mut self, bits: REG::Ux) -> &mut Self {
237245
self.bits = bits;

0 commit comments

Comments
 (0)