Trait tock_registers::interfaces::Readable
source · [−]pub trait Readable {
type T: UIntLike;
type R: RegisterLongName;
fn get(&self) -> Self::T;
fn read(&self, field: Field<Self::T, Self::R>) -> Self::T { ... }
fn read_as_enum<E: TryFromValue<Self::T, EnumType = E>>(
&self,
field: Field<Self::T, Self::R>
) -> Option<E> { ... }
fn extract(&self) -> LocalRegisterCopy<Self::T, Self::R> { ... }
fn is_set(&self, field: Field<Self::T, Self::R>) -> bool { ... }
fn matches_any(&self, field: FieldValue<Self::T, Self::R>) -> bool { ... }
fn matches_all(&self, field: FieldValue<Self::T, Self::R>) -> bool { ... }
}
Expand description
Readable register
Register which at least supports reading the current value. Only
Readable::get
must be implemented, as for other methods a
default implementation is provided.
A register that is both Readable
and Writeable
will also
automatically be ReadWriteable
, if the RegisterLongName
of
Readable
is the same as that of Writeable
(i.e. not for
Aliased
registers).
Required Associated Types
Required Methods
Provided Methods
fn read_as_enum<E: TryFromValue<Self::T, EnumType = E>>(
&self,
field: Field<Self::T, Self::R>
) -> Option<E>
fn read_as_enum<E: TryFromValue<Self::T, EnumType = E>>(
&self,
field: Field<Self::T, Self::R>
) -> Option<E>
Set the raw register value
fn extract(&self) -> LocalRegisterCopy<Self::T, Self::R>
fn extract(&self) -> LocalRegisterCopy<Self::T, Self::R>
Make a local copy of the register
Check if one or more bits in a field are set
fn matches_any(&self, field: FieldValue<Self::T, Self::R>) -> bool
fn matches_any(&self, field: FieldValue<Self::T, Self::R>) -> bool
Check if any specified parts of a field match
fn matches_all(&self, field: FieldValue<Self::T, Self::R>) -> bool
fn matches_all(&self, field: FieldValue<Self::T, Self::R>) -> bool
Check if all specified parts of a field match