RegisterFieldBool

Struct RegisterFieldBool 

Source
pub struct RegisterFieldBool<const START_OFFSET: usize, const DIM: u8, const DIM_INCREMENT: u8, T, A>
where T: RegSpec, A: Access,
{ /* private fields */ }
Expand description

Proxy struct for boolean bitfields

Implementations§

Source§

impl<const START_OFFSET: usize, const DIM: u8, const DIM_INCREMENT: u8, T, A> RegisterFieldBool<START_OFFSET, DIM, DIM_INCREMENT, T, A>
where T: RegSpec, A: Read,

Source

pub fn get(&self) -> bool

Extract bitfield from read register value

Source§

impl<const START_OFFSET: usize, const DIM: u8, const DIM_INCREMENT: u8, T, A> RegisterFieldBool<START_OFFSET, DIM, DIM_INCREMENT, T, A>
where T: RegSpec, A: Write,

Source

pub fn set(self, value: bool) -> RegValueT<T>

Prepare bitfield value to be written to register

§Example
// example with generic names
// get an instance by reading
let values = TIMER.bitfield_reg().read();
// or by starting with a known value
let value = timer::BitfieldReg::new(0);
// or by starting with the default
let value = timer::BitfieldReg::default();

// set bitfield
let value = value
    .boolrw()
    .set(true);

// up until now no hardware change has taken place, do that now by writing
TIMER.bitfield_reg().write(value);
Source§

impl<const START_OFFSET: usize, const DIM: u8, const DIM_INCREMENT: u8, T, A> RegisterFieldBool<START_OFFSET, DIM, DIM_INCREMENT, T, A>
where T: RegSpec, A: Access,

Source

pub fn mask(&self) -> T::DataType

Get mask for bitfield, the mask is unshifted and at offset 0

Prefer the use of RegisterField<START_OFFSET, MASK, DIM, DIM_INCREMENT, ValueType, T, A>::get() to extract a bitfield value.

Source

pub const fn offset(&self) -> usize

Get offset of bitfield in containing register

Prefer the use of RegisterField<START_OFFSET, MASK, DIM, DIM_INCREMENT, ValueType, T, A>::get() to extract a bitfield value.

Auto Trait Implementations§

§

impl<const START_OFFSET: usize, const DIM: u8, const DIM_INCREMENT: u8, T, A> Freeze for RegisterFieldBool<START_OFFSET, DIM, DIM_INCREMENT, T, A>
where <T as RegSpec>::DataType: Freeze,

§

impl<const START_OFFSET: usize, const DIM: u8, const DIM_INCREMENT: u8, T, A> RefUnwindSafe for RegisterFieldBool<START_OFFSET, DIM, DIM_INCREMENT, T, A>
where <T as RegSpec>::DataType: RefUnwindSafe, A: RefUnwindSafe,

§

impl<const START_OFFSET: usize, const DIM: u8, const DIM_INCREMENT: u8, T, A> Send for RegisterFieldBool<START_OFFSET, DIM, DIM_INCREMENT, T, A>
where <T as RegSpec>::DataType: Send, A: Send,

§

impl<const START_OFFSET: usize, const DIM: u8, const DIM_INCREMENT: u8, T, A> Sync for RegisterFieldBool<START_OFFSET, DIM, DIM_INCREMENT, T, A>
where <T as RegSpec>::DataType: Sync, A: Sync,

§

impl<const START_OFFSET: usize, const DIM: u8, const DIM_INCREMENT: u8, T, A> Unpin for RegisterFieldBool<START_OFFSET, DIM, DIM_INCREMENT, T, A>
where <T as RegSpec>::DataType: Unpin, A: Unpin,

§

impl<const START_OFFSET: usize, const DIM: u8, const DIM_INCREMENT: u8, T, A> UnwindSafe for RegisterFieldBool<START_OFFSET, DIM, DIM_INCREMENT, T, A>
where <T as RegSpec>::DataType: UnwindSafe, A: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.