Struct embedded_builder::register::Register
[−]
[src]
pub struct Register<T: RegisterType<T>>(_, _);
Methods
impl<T: RegisterType<T>> Register<T>
[src]
pub fn new(addr: usize) -> Register<T>
[src]
Creates a new register of the provided type with the specified address
Note that impl RegisterType<T> for T {}
is required for unimplemented types
pub fn u16(addr: usize) -> Register<u16>
[src]
Creates a new 16-bit ride register
pub fn u32(addr: usize) -> Register<u32>
[src]
Creates a new 32-bit register
pub fn read(&mut self) -> Register<T>
[src]
Reads the register value and returns a new instance with internal value set.
pub fn zero(&mut self) -> Register<T>
[src]
clears the internal register value
pub fn value(&self) -> T
[src]
returns the register value
pub fn set(self, val: T) -> Register<T>
[src]
sets the internal value of the register
pub fn and(self, val: T) -> Register<T>
[src]
boolean and the provided and current values
pub fn or(self, val: T) -> Register<T>
[src]
ors the provided and current values
pub fn clear(self, mask: T) -> Register<T>
[src]
clears the masked area of the provided value
pub fn get_bit(&self, i: T) -> bool
[src]
returns a boolean consisting to the indexed bit
pub fn set_bit(self, i: T, v: bool) -> Register<T>
[src]
Sets a bit in the current value
pub fn get_masked(&self, shift: T, mask: T) -> T
[src]
Fetches a value with the provided mask and shift Note that shift is applied prior to masking, so mask should always start at 0b1
pub fn set_masked(self, shift: T, mask: T, val: T) -> Register<T>
[src]
Sets a value with a provided mask and shift Note that mask is applied before shifting, so mask should always start at 0b1
pub fn write(self)
[src]
Writes the internal value to the register
Trait Implementations
impl<T: Debug + RegisterType<T>> Debug for Register<T>
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<T: PartialEq + RegisterType<T>> PartialEq for Register<T>
[src]
fn eq(&self, __arg_0: &Register<T>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Register<T>) -> bool
[src]
This method tests for !=
.