Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/generate/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,16 @@ impl<REG: Writable> W<REG> {
self.bits = bits;
self
}
#[inline(always)]
pub unsafe fn set_bits(&mut self, bits: REG::Ux) -> &mut Self {
self.bits |= bits;
self
}
#[inline(always)]
pub unsafe fn clear_bits(&mut self, bits: REG::Ux) -> &mut Self {
self.bits &= !bits;
self
}
}
impl<REG> W<REG>
where
Expand Down Expand Up @@ -424,6 +434,18 @@ where
self.w.bits |= (REG::Ux::from(value) & REG::Ux::mask::<WI>()) << self.o;
self.w
}

#[inline(always)]
pub unsafe fn set_bits(self, value: FI::Ux) -> &'a mut W<REG> {
self.w.bits |= (REG::Ux::from(value) & REG::Ux::mask::<WI>()) << self.o;
self.w
}

#[inline(always)]
pub unsafe fn clear_bits(self, value: FI::Ux) -> &'a mut W<REG> {
self.w.bits &= !((REG::Ux::from(value) & REG::Ux::mask::<WI>()) << self.o);
self.w
}
}

impl<'a, REG, const WI: u8, FI> FieldWriter<'a, REG, WI, FI, Safe>
Expand Down
Loading