AsyncRegisterInterface

Trait AsyncRegisterInterface 

Source
pub trait AsyncRegisterInterface {
    type Error;
    type AddressType: Copy;

    // Required methods
    async fn write_register(
        &mut self,
        address: Self::AddressType,
        size_bits: u32,
        data: &[u8],
    ) -> Result<(), Self::Error>;
    async fn read_register(
        &mut self,
        address: Self::AddressType,
        size_bits: u32,
        data: &mut [u8],
    ) -> Result<(), Self::Error>;
}
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: Copy

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

Required Methods§

Source

async fn write_register( &mut self, address: Self::AddressType, size_bits: u32, data: &[u8], ) -> Result<(), Self::Error>

Write the given data to the register located at the given address

Source

async fn read_register( &mut self, address: Self::AddressType, size_bits: u32, data: &mut [u8], ) -> Result<(), Self::Error>

Read the register located at the given addres to the given data slice

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§