Struct peripherals::DynReg[][src]

pub struct DynReg<R> { /* fields omitted */ }
Expand description

A register from a peripheral only known at runtime

This allows to choose at runtime which instance of a peripheral to use. It has the same methods than the Reg type. It is created by Reg::into_dyn or as part of the struct created by peripheral.into_dyn().

Implementations

impl<R: Register> DynReg<R>[src]

pub fn ptr(&self) -> *const R::Int[src]

Raw pointer to the register

pub fn ptr_mut(&mut self) -> *mut R::Int[src]

Mutable raw pointer to the register

impl<R: ReadRegister> DynReg<R>[src]

pub fn read(&self) -> Value<R::Value>[src]

Read the current value of this register

This returns a Value, which can be used to read fields or modified and written back.

pub fn field<T>(&self, field: Field<R::Value, T, R::Int>) -> T where
    R::Int: TryInto<T>,
    <R::Int as TryInto<T>>::Error: Debug
[src]

Read the given field

Same as register.read().field(fields). See Value::field for more details.

pub fn fields<F: Into<Fields<R::Value>> + MayToggle>(
    &self,
    fields: F
) -> FieldValues<R::Value, F::Toggle>
[src]

Read the given fields

Same as register.read() & fields. See Value for more details.

pub fn test<B: Into<FieldValues<R::Value>>>(&self, bits: B) -> bool[src]

Test the value of the given fields

Same as register.read().test(bits). See Value::test for more details.

impl<R: WriteRegister> DynReg<R>[src]

pub fn write(&mut self, value: Value<R::Value>)[src]

Write a value to this register

This takes a Value, which can be read from a register or created with Default.

pub fn reset(&mut self)[src]

Reset this register

This set the register to the value it has right after a reset or a boot.

impl<R: ReadRegister + WriteRegister> DynReg<R>[src]

pub fn modify<B: Into<FieldValues<R::Value>>>(&mut self, bits: B)[src]

Modify the given fields

This takes any field defined for this register by the periph! macro. These fields can also be combined with the | operator.

pub fn toggle<F: Into<Fields<R::Value, Toggle>>>(&mut self, fields: F)[src]

Toggle the given fields

This takes a toggleable field defined for this register by the periph! macro. These fields can also be combined with the | operator.

Trait Implementations

impl<R: Register> Debug for DynReg<R>[src]

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<R> Send for DynReg<R> where
    R: Send

impl<R> Sync for DynReg<R> where
    R: Sync

impl<R> Unpin for DynReg<R> where
    R: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.