pub struct RegisterOperation<'i, Interface, AddressType: Copy, Register: FieldSet, Access> { /* private fields */ }Expand description
Object that performs actions on the device in the context of a register
Implementations§
Source§impl<Interface, AddressType: Copy, Register: FieldSet, Access> RegisterOperation<'_, Interface, AddressType, Register, Access>where
Interface: RegisterInterface<AddressType = AddressType>,
Access: WriteCapability,
impl<Interface, AddressType: Copy, Register: FieldSet, Access> RegisterOperation<'_, Interface, AddressType, Register, Access>where
Interface: RegisterInterface<AddressType = AddressType>,
Access: WriteCapability,
Sourcepub fn write<R>(
&mut self,
f: impl FnOnce(&mut Register) -> R,
) -> Result<R, Interface::Error>
pub fn write<R>( &mut self, f: impl FnOnce(&mut Register) -> R, ) -> Result<R, Interface::Error>
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.
Sourcepub fn write_with_zero<R>(
&mut self,
f: impl FnOnce(&mut Register) -> R,
) -> Result<R, Interface::Error>
pub fn write_with_zero<R>( &mut self, f: impl FnOnce(&mut Register) -> R, ) -> Result<R, Interface::Error>
Write to the register.
The closure is given the write object initialized to all zero.
Source§impl<Interface, AddressType: Copy, Register: FieldSet, Access> RegisterOperation<'_, Interface, AddressType, Register, Access>where
Interface: RegisterInterface<AddressType = AddressType>,
Access: ReadCapability,
impl<Interface, AddressType: Copy, Register: FieldSet, Access> RegisterOperation<'_, Interface, AddressType, Register, Access>where
Interface: RegisterInterface<AddressType = AddressType>,
Access: ReadCapability,
Source§impl<Interface, AddressType: Copy, Register: FieldSet, Access> RegisterOperation<'_, Interface, AddressType, Register, Access>where
Interface: RegisterInterface<AddressType = AddressType>,
Access: ReadCapability + WriteCapability,
impl<Interface, AddressType: Copy, Register: FieldSet, Access> RegisterOperation<'_, Interface, AddressType, Register, Access>where
Interface: RegisterInterface<AddressType = AddressType>,
Access: ReadCapability + WriteCapability,
Source§impl<Interface, AddressType: Copy, Register: FieldSet, Access> RegisterOperation<'_, Interface, AddressType, Register, Access>where
Interface: AsyncRegisterInterface<AddressType = AddressType>,
Access: WriteCapability,
impl<Interface, AddressType: Copy, Register: FieldSet, Access> RegisterOperation<'_, Interface, AddressType, Register, Access>where
Interface: AsyncRegisterInterface<AddressType = AddressType>,
Access: WriteCapability,
Sourcepub async fn write_async<R>(
&mut self,
f: impl FnOnce(&mut Register) -> R,
) -> Result<R, Interface::Error>
pub async fn write_async<R>( &mut self, f: impl FnOnce(&mut Register) -> R, ) -> Result<R, Interface::Error>
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.
Sourcepub async fn write_with_zero_async<R>(
&mut self,
f: impl FnOnce(&mut Register) -> R,
) -> Result<R, Interface::Error>
pub async fn write_with_zero_async<R>( &mut self, f: impl FnOnce(&mut Register) -> R, ) -> Result<R, Interface::Error>
Write to the register.
The closure is given the write object initialized to all zero.
Source§impl<Interface, AddressType: Copy, Register: FieldSet, Access> RegisterOperation<'_, Interface, AddressType, Register, Access>where
Interface: AsyncRegisterInterface<AddressType = AddressType>,
Access: ReadCapability,
impl<Interface, AddressType: Copy, Register: FieldSet, Access> RegisterOperation<'_, Interface, AddressType, Register, Access>where
Interface: AsyncRegisterInterface<AddressType = AddressType>,
Access: ReadCapability,
Sourcepub async fn read_async(&mut self) -> Result<Register, Interface::Error>
pub async fn read_async(&mut self) -> Result<Register, Interface::Error>
Read the register from the device
Source§impl<Interface, AddressType: Copy, Register: FieldSet, Access> RegisterOperation<'_, Interface, AddressType, Register, Access>where
Interface: AsyncRegisterInterface<AddressType = AddressType>,
Access: ReadCapability + WriteCapability,
impl<Interface, AddressType: Copy, Register: FieldSet, Access> RegisterOperation<'_, Interface, AddressType, Register, Access>where
Interface: AsyncRegisterInterface<AddressType = AddressType>,
Access: ReadCapability + WriteCapability,
Sourcepub async fn modify_async<R>(
&mut self,
f: impl FnOnce(&mut Register) -> R,
) -> Result<R, Interface::Error>
pub async fn modify_async<R>( &mut self, f: impl FnOnce(&mut Register) -> R, ) -> Result<R, Interface::Error>
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.