Skip to main content

RegisterOperation

Struct RegisterOperation 

Source
pub struct RegisterOperation<'b, B, RegisterFs, AddressType, Access, Repeat>
where B: Block, B::Interface: RegisterInterfaceBase<AddressType = AddressType>, RegisterFs: Fieldset, AddressType: Address,
{ /* private fields */ }
Expand description

Object that performs actions on the device in the context of a register

Implementations§

Source§

impl<'b, B, RegisterFs, AddressType, Access, Repeat> RegisterOperation<'b, B, RegisterFs, AddressType, Access, Repeat>
where RegisterFs: Fieldset, B: Block, B::Interface: RegisterInterfaceBase<AddressType = AddressType>, AddressType: Address,

Source

pub fn address(&self) -> AddressType

Get the register’s address.

Source

pub fn reset_value(&self) -> RegisterFs

Get the register’s reset value.

Source

pub fn plan(&self) -> Plan<AddressType, RegisterFs, Access>
where Repeat: NotRepeating,

Get a plan to read, write or modify for bulk register operations

Source

pub fn plan_at( &self, index: Repeat::Index, ) -> Plan<AddressType, RegisterFs, Access>
where Repeat: Repeating,

Get a plan to read, write or modify for bulk register operations at a given index

Source

pub fn plan_with_zero(&self) -> Plan<AddressType, RegisterFs, Access>
where Repeat: NotRepeating, Access: WriteCapability,

Same as Self::plan, but initialize the fieldset with all zeroes

Source

pub fn plan_with_zero_at( &self, index: Repeat::Index, ) -> Plan<AddressType, RegisterFs, Access>
where Repeat: Repeating, Access: WriteCapability,

Same as Self::plan_at, but initialize the fieldset with all zeroes

Source

pub fn plan_array_at<const N: usize>( self, index: Repeat::Index, ) -> Plan<AddressType, [RegisterFs; N], Access>
where Repeat: ArrayRepeating, B::RegisterAddressMode: AddressMode,

Get a plan to read, write or modify an array of registers for bulk register operations with a given start index and length

Source

pub fn plan_array_with_zero_at<const N: usize>( self, index: Repeat::Index, ) -> Plan<AddressType, [RegisterFs; N], Access>
where Repeat: ArrayRepeating, B::RegisterAddressMode: AddressMode, Access: WriteCapability,

Same as Self::plan_array_at, but initialize the fieldsets with all zeroes

Source

pub fn write( self, f: impl FnOnce(&mut RegisterFs), ) -> Result<(), <B::Interface as RegisterInterfaceBase>::Error>
where Repeat: NotRepeating, B::Interface: RegisterInterface, Access: WriteCapability,

Write to the register.

The closure is given the write object initialized to the reset value of the register. If no reset value is specified for this register, this function is the same as Self::write_with_zero.

Source

pub fn write_at( self, index: Repeat::Index, f: impl FnOnce(&mut RegisterFs), ) -> Result<(), <B::Interface as RegisterInterfaceBase>::Error>
where Repeat: Repeating, B::Interface: RegisterInterface, Access: WriteCapability,

Write to the register at a given index.

The closure is given the write object initialized to the reset value of the register. If no reset value is specified for this register, this function is the same as Self::write_with_zero_at.

Source

pub fn write_array_at<const N: usize>( self, index: Repeat::Index, f: impl FnOnce(&mut [RegisterFs; N]), ) -> Result<(), <B::Interface as RegisterInterfaceBase>::Error>
where Repeat: ArrayRepeating, B::Interface: RegisterInterface, B::RegisterAddressMode: AddressMode, Access: WriteCapability,

Write to an array of register at the given index and N length.

The closure is given the write object initialized to the reset value of the register. If no reset value is specified for this register, this function is the same as Self::write_array_with_zero_at.

Source

pub fn write_async( self, f: impl FnOnce(&mut RegisterFs), ) -> impl Future<Output = Result<(), <B::Interface as RegisterInterfaceBase>::Error>>
where Repeat: NotRepeating, B::Interface: AsyncRegisterInterface, Access: WriteCapability,

Write to the register.

The closure is given the write object initialized to the reset value of the register. If no reset value is specified for this register, this function is the same as Self::write_with_zero.

Source

pub fn write_at_async( self, index: Repeat::Index, f: impl FnOnce(&mut RegisterFs), ) -> impl Future<Output = Result<(), <B::Interface as RegisterInterfaceBase>::Error>>
where Repeat: Repeating, B::Interface: AsyncRegisterInterface, Access: WriteCapability,

Write to the register at a given index.

The closure is given the write object initialized to the reset value of the register. If no reset value is specified for this register, this function is the same as Self::write_with_zero_at_async.

Source

pub fn write_array_at_async<const N: usize>( self, index: Repeat::Index, f: impl FnOnce(&mut [RegisterFs; N]), ) -> impl Future<Output = Result<(), <B::Interface as RegisterInterfaceBase>::Error>>
where Repeat: ArrayRepeating, B::Interface: AsyncRegisterInterface, B::RegisterAddressMode: AddressMode, Access: WriteCapability,

Write to an array of register at the given index and N length.

The closure is given the write object initialized to the reset value of the register. If no reset value is specified for this register, this function is the same as Self::write_array_with_zero_at_async.

Source

pub fn write_with_zero( self, f: impl FnOnce(&mut RegisterFs), ) -> Result<(), <B::Interface as RegisterInterfaceBase>::Error>
where Repeat: NotRepeating, B::Interface: RegisterInterface, Access: WriteCapability,

Write to the register.

The closure is given the write object initialized to all zero.

Source

pub fn write_with_zero_at( self, index: Repeat::Index, f: impl FnOnce(&mut RegisterFs), ) -> Result<(), <B::Interface as RegisterInterfaceBase>::Error>
where Repeat: Repeating, B::Interface: RegisterInterface, Access: WriteCapability,

Write to the register at a given index.

The closure is given the write object initialized to all zero.

Source

pub fn write_array_with_zero_at<const N: usize>( self, index: Repeat::Index, f: impl FnOnce(&mut [RegisterFs; N]), ) -> Result<(), <B::Interface as RegisterInterfaceBase>::Error>
where Repeat: ArrayRepeating, B::Interface: RegisterInterface, B::RegisterAddressMode: AddressMode, Access: WriteCapability,

Write to an array of registers at a given index and length.

The closure is given the write object initialized to all zero.

Source

pub fn write_with_zero_async( self, f: impl FnOnce(&mut RegisterFs), ) -> impl Future<Output = Result<(), <B::Interface as RegisterInterfaceBase>::Error>>
where Repeat: NotRepeating, B::Interface: AsyncRegisterInterface, Access: WriteCapability,

Write to the register.

The closure is given the write object initialized to all zero.

Source

pub fn write_with_zero_at_async( self, index: Repeat::Index, f: impl FnOnce(&mut RegisterFs), ) -> impl Future<Output = Result<(), <B::Interface as RegisterInterfaceBase>::Error>>
where Repeat: Repeating, B::Interface: AsyncRegisterInterface, Access: WriteCapability,

Write to the register at a given index.

The closure is given the write object initialized to all zero.

Source

pub fn write_array_with_zero_at_async<const N: usize>( self, index: Repeat::Index, f: impl FnOnce(&mut [RegisterFs; N]), ) -> impl Future<Output = Result<(), <B::Interface as RegisterInterfaceBase>::Error>>
where Repeat: ArrayRepeating, B::Interface: AsyncRegisterInterface, B::RegisterAddressMode: AddressMode, Access: WriteCapability,

Write to an array of registers at a given index and length.

The closure is given the write object initialized to all zero.

Source

pub fn read( self, ) -> Result<RegisterFs, <B::Interface as RegisterInterfaceBase>::Error>
where Repeat: NotRepeating, B::Interface: RegisterInterface, Access: ReadCapability,

Read the register from the device

Source

pub fn read_at( self, index: Repeat::Index, ) -> Result<RegisterFs, <B::Interface as RegisterInterfaceBase>::Error>
where Repeat: Repeating, B::Interface: RegisterInterface, Access: ReadCapability,

Read the register from the device at a given index

Source

pub fn read_array_at<const N: usize>( self, index: Repeat::Index, ) -> Result<[RegisterFs; N], <B::Interface as RegisterInterfaceBase>::Error>
where Repeat: ArrayRepeating, B::Interface: RegisterInterface, B::RegisterAddressMode: AddressMode, Access: ReadCapability,

Read an array of registers from the device at a given index and length

Source

pub fn read_async( self, ) -> impl Future<Output = Result<RegisterFs, <B::Interface as RegisterInterfaceBase>::Error>>
where Repeat: NotRepeating, B::Interface: AsyncRegisterInterface, Access: ReadCapability,

Read the register from the device

Source

pub fn read_at_async( self, index: Repeat::Index, ) -> impl Future<Output = Result<RegisterFs, <B::Interface as RegisterInterfaceBase>::Error>>
where Repeat: Repeating, B::Interface: AsyncRegisterInterface, B::RegisterAddressMode: AddressMode, Access: ReadCapability,

Read the register from the device at a given index

Source

pub fn read_array_at_async<const N: usize>( self, index: Repeat::Index, ) -> impl Future<Output = Result<[RegisterFs; N], <B::Interface as RegisterInterfaceBase>::Error>>
where Repeat: ArrayRepeating, B::Interface: AsyncRegisterInterface, B::RegisterAddressMode: AddressMode, Access: ReadCapability,

Read an array of registers from the device at a given index and length

Source

pub fn modify( self, f: impl FnOnce(&mut RegisterFs), ) -> Result<(), <B::Interface as RegisterInterfaceBase>::Error>
where Repeat: NotRepeating, B::Interface: RegisterInterface, Access: ReadCapability + WriteCapability,

Modify the existing register value.

The register is read, the value is then passed to the closure for making changes. The result is then written back to the device.

Source

pub fn modify_at( self, index: Repeat::Index, f: impl FnOnce(&mut RegisterFs), ) -> Result<(), <B::Interface as RegisterInterfaceBase>::Error>
where Repeat: Repeating, B::Interface: RegisterInterface, Access: ReadCapability + WriteCapability,

Modify the existing register value at a given index.

The register is read, the value is then passed to the closure for making changes. The result is then written back to the device.

Source

pub fn modify_array_at<const N: usize>( self, index: Repeat::Index, f: impl FnOnce(&mut [RegisterFs; N]), ) -> Result<(), <B::Interface as RegisterInterfaceBase>::Error>
where Repeat: ArrayRepeating, B::Interface: RegisterInterface, B::RegisterAddressMode: AddressMode, Access: ReadCapability + WriteCapability,

Modify an array of existing register values at a given start index and length.

The registers are read, the values are then passed to the closure for making changes. The result is then written back to the device.

Source

pub fn modify_async( self, f: impl FnOnce(&mut RegisterFs), ) -> impl Future<Output = Result<(), <B::Interface as RegisterInterfaceBase>::Error>>
where Repeat: NotRepeating, B::Interface: AsyncRegisterInterface, Access: ReadCapability + WriteCapability,

Modify the existing register value.

The register is read, the value is then passed to the closure for making changes. The result is then written back to the device.

Source

pub fn modify_at_async( self, index: Repeat::Index, f: impl FnOnce(&mut RegisterFs), ) -> impl Future<Output = Result<(), <B::Interface as RegisterInterfaceBase>::Error>>
where Repeat: Repeating, B::Interface: AsyncRegisterInterface, Access: ReadCapability + WriteCapability,

Modify the existing register value at a given index.

The register is read, the value is then passed to the closure for making changes. The result is then written back to the device.

Source

pub fn modify_array_at_async<const N: usize>( self, index: Repeat::Index, f: impl FnOnce(&mut [RegisterFs; N]), ) -> impl Future<Output = Result<(), <B::Interface as RegisterInterfaceBase>::Error>>
where Repeat: ArrayRepeating, B::Interface: AsyncRegisterInterface, B::RegisterAddressMode: AddressMode, Access: ReadCapability + WriteCapability,

Modify an array of existing register values at a given starting index and length.

The registers are read, the values are then passed to the closure for making changes. The result is then written back to the device.

Auto Trait Implementations§

§

impl<'b, B, RegisterFs, AddressType, Access, Repeat> !UnwindSafe for RegisterOperation<'b, B, RegisterFs, AddressType, Access, Repeat>

§

impl<'b, B, RegisterFs, AddressType, Access, Repeat> Freeze for RegisterOperation<'b, B, RegisterFs, AddressType, Access, Repeat>
where AddressType: Freeze,

§

impl<'b, B, RegisterFs, AddressType, Access, Repeat> RefUnwindSafe for RegisterOperation<'b, B, RegisterFs, AddressType, Access, Repeat>
where AddressType: RefUnwindSafe, B: RefUnwindSafe, RegisterFs: RefUnwindSafe, Access: RefUnwindSafe, Repeat: RefUnwindSafe,

§

impl<'b, B, RegisterFs, AddressType, Access, Repeat> Send for RegisterOperation<'b, B, RegisterFs, AddressType, Access, Repeat>
where AddressType: Send, B: Send, RegisterFs: Send, Access: Send, Repeat: Send,

§

impl<'b, B, RegisterFs, AddressType, Access, Repeat> Sync for RegisterOperation<'b, B, RegisterFs, AddressType, Access, Repeat>
where AddressType: Sync, B: Sync, RegisterFs: Sync, Access: Sync, Repeat: Sync,

§

impl<'b, B, RegisterFs, AddressType, Access, Repeat> Unpin for RegisterOperation<'b, B, RegisterFs, AddressType, Access, Repeat>
where AddressType: Unpin, RegisterFs: Unpin, Access: Unpin, Repeat: Unpin,

§

impl<'b, B, RegisterFs, AddressType, Access, Repeat> UnsafeUnpin for RegisterOperation<'b, B, RegisterFs, AddressType, Access, Repeat>
where AddressType: UnsafeUnpin,

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.