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§

source

type Error

The error type

source

type AddressType

The address type used by this interface. Should likely be an integer.

Required Methods§

source

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.

source

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.

Implementors§