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,
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,
Sourcepub fn reset_value(&self) -> RegisterFs
pub fn reset_value(&self) -> RegisterFs
Get the register’s reset value.
Sourcepub fn plan(&self) -> Plan<AddressType, RegisterFs, Access>where
Repeat: NotRepeating,
pub fn plan(&self) -> Plan<AddressType, RegisterFs, Access>where
Repeat: NotRepeating,
Get a plan to read, write or modify for bulk register operations
Sourcepub fn plan_at(
&self,
index: Repeat::Index,
) -> Plan<AddressType, RegisterFs, Access>where
Repeat: Repeating,
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
Sourcepub fn plan_with_zero(&self) -> Plan<AddressType, RegisterFs, Access>where
Repeat: NotRepeating,
Access: WriteCapability,
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
Sourcepub fn plan_with_zero_at(
&self,
index: Repeat::Index,
) -> Plan<AddressType, RegisterFs, Access>where
Repeat: Repeating,
Access: WriteCapability,
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
Sourcepub fn plan_array_at<const N: usize>(
self,
index: Repeat::Index,
) -> Plan<AddressType, [RegisterFs; N], Access>where
Repeat: ArrayRepeating,
B::RegisterAddressMode: AddressMode,
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
Sourcepub 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,
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
Sourcepub fn write(
self,
f: impl FnOnce(&mut RegisterFs),
) -> Result<(), <B::Interface as RegisterInterfaceBase>::Error>where
Repeat: NotRepeating,
B::Interface: RegisterInterface,
Access: WriteCapability,
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.
Sourcepub 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,
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.
Sourcepub 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,
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.
Sourcepub 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,
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.
Sourcepub 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,
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.
Sourcepub 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,
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.
Sourcepub fn write_with_zero(
self,
f: impl FnOnce(&mut RegisterFs),
) -> Result<(), <B::Interface as RegisterInterfaceBase>::Error>where
Repeat: NotRepeating,
B::Interface: RegisterInterface,
Access: WriteCapability,
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.
Sourcepub 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,
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.
Sourcepub 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,
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.
Sourcepub 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,
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.
Sourcepub 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,
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.
Sourcepub 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,
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.
Sourcepub fn read(
self,
) -> Result<RegisterFs, <B::Interface as RegisterInterfaceBase>::Error>where
Repeat: NotRepeating,
B::Interface: RegisterInterface,
Access: ReadCapability,
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
Sourcepub fn read_at(
self,
index: Repeat::Index,
) -> Result<RegisterFs, <B::Interface as RegisterInterfaceBase>::Error>where
Repeat: Repeating,
B::Interface: RegisterInterface,
Access: ReadCapability,
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
Sourcepub 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,
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
Sourcepub fn read_async(
self,
) -> impl Future<Output = Result<RegisterFs, <B::Interface as RegisterInterfaceBase>::Error>>where
Repeat: NotRepeating,
B::Interface: AsyncRegisterInterface,
Access: ReadCapability,
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
Sourcepub 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,
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
Sourcepub 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,
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
Sourcepub fn modify(
self,
f: impl FnOnce(&mut RegisterFs),
) -> Result<(), <B::Interface as RegisterInterfaceBase>::Error>where
Repeat: NotRepeating,
B::Interface: RegisterInterface,
Access: ReadCapability + WriteCapability,
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.
Sourcepub 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,
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.
Sourcepub 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,
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.
Sourcepub 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,
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.
Sourcepub 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,
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.
Sourcepub 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,
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.