Trait device_driver::AsyncRegisterDevice
source · pub trait AsyncRegisterDevice {
type Error;
type AddressType;
// Required methods
async fn write_register<R, const SIZE_BYTES: usize>(
&mut self,
data: &BitArray<[u8; SIZE_BYTES]>
) -> Result<(), Self::Error>
where R: Register<SIZE_BYTES, AddressType = Self::AddressType>;
async fn read_register<R, const SIZE_BYTES: usize>(
&mut self,
data: &mut BitArray<[u8; SIZE_BYTES]>
) -> Result<(), Self::Error>
where R: Register<SIZE_BYTES, AddressType = Self::AddressType>;
}
Expand description
A trait to represent the interface to the device.
This is called to asynchronously write to and read from registers.
Required Associated Types§
sourcetype AddressType
type AddressType
The address type used by this interface. Should likely be an integer.
Required Methods§
sourceasync fn write_register<R, const SIZE_BYTES: usize>(
&mut self,
data: &BitArray<[u8; SIZE_BYTES]>
) -> Result<(), Self::Error>where
R: Register<SIZE_BYTES, AddressType = Self::AddressType>,
async fn write_register<R, const SIZE_BYTES: usize>(
&mut self,
data: &BitArray<[u8; SIZE_BYTES]>
) -> Result<(), Self::Error>where
R: Register<SIZE_BYTES, AddressType = Self::AddressType>,
Write the given data to the register asynchronously.
The address and the length of the register is descriped with the constant in the R
Register type.
The data can made into a normal slice by calling as_raw_slice
on it.
sourceasync fn read_register<R, const SIZE_BYTES: usize>(
&mut self,
data: &mut BitArray<[u8; SIZE_BYTES]>
) -> Result<(), Self::Error>where
R: Register<SIZE_BYTES, AddressType = Self::AddressType>,
async fn read_register<R, const SIZE_BYTES: usize>(
&mut self,
data: &mut BitArray<[u8; SIZE_BYTES]>
) -> Result<(), Self::Error>where
R: Register<SIZE_BYTES, AddressType = Self::AddressType>,
Read the data from the register asynchronously into the given buffer.
The address and the length of the register is descriped with the constant in the R
Register type.
The data can made into a normal slice by calling as_raw_slice
on it.
Object Safety§
This trait is not object safe.