pub struct Reg<U, REG> { /* private fields */ }
Expand description
This structure provides volatile access to register
Implementations§
source§impl<U, REG> Reg<U, REG>where
Self: ResetValue<Type = U> + Writable,
U: Copy,
impl<U, REG> Reg<U, REG>where Self: ResetValue<Type = U> + Writable, U: Copy,
source§impl<U, REG> Reg<U, REG>where
Self: Writable,
U: Copy + Default,
impl<U, REG> Reg<U, REG>where Self: Writable, U: Copy + Default,
sourcepub fn write_with_zero<F>(&self, f: F)where
F: FnOnce(&mut W<U, Self>) -> &mut W<U, Self>,
pub fn write_with_zero<F>(&self, f: F)where F: FnOnce(&mut W<U, Self>) -> &mut W<U, Self>,
Writes Zero to Writable
register
Similar to write
, but unused bits will contain 0.
source§impl<U, REG> Reg<U, REG>where
Self: Readable + Writable,
U: Copy,
impl<U, REG> Reg<U, REG>where Self: Readable + Writable, U: Copy,
sourcepub fn modify<F>(&self, f: F)where
for<'w> F: FnOnce(&R<U, Self>, &'w mut W<U, Self>) -> &'w mut W<U, Self>,
pub fn modify<F>(&self, f: F)where for<'w> F: FnOnce(&R<U, Self>, &'w mut W<U, Self>) -> &'w mut W<U, Self>,
Modifies the contents of the register
E.g. to do a read-modify-write sequence to change parts of a register:
ⓘ
periph.reg.modify(|r, w| unsafe { w.bits(
r.bits() | 3
) });
or
ⓘ
periph.reg.modify(|_, w| w
.field1().bits(newfield1bits)
.field2().set_bit()
.field3().variant(VARIANT)
);
Other fields will have value they had before call modify
.
Trait Implementations§
Auto Trait Implementations§
impl<U, REG> !RefUnwindSafe for Reg<U, REG>
impl<U, REG> !Sync for Reg<U, REG>
impl<U, REG> Unpin for Reg<U, REG>where REG: Unpin, U: Unpin,
impl<U, REG> UnwindSafe for Reg<U, REG>where REG: UnwindSafe, U: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more