Trait RegisterInterfaceSync

Source
pub trait RegisterInterfaceSync {
    type Error;

    // Required methods
    fn read_register<R>(&mut self) -> Result<R, Self::Error>
       where R: ReadableRegister;
    fn write_register<R>(
        &mut self,
        register: impl AsRef<R>,
    ) -> Result<(), Self::Error>
       where R: WritableRegister;
}
Expand description

A trait that is implemented by any bus interface and allows devices with registers to share register read/write implementations independent of the actual interface in use.

Required Associated Types§

Required Methods§

Source

fn read_register<R>(&mut self) -> Result<R, Self::Error>

Reads the given register via this interface

Source

fn write_register<R>( &mut self, register: impl AsRef<R>, ) -> Result<(), Self::Error>

Writes the given register via this interface

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§

Source§

impl<I, A, C> RegisterInterfaceSync for I2cDeviceSync<I, A, C>
where I: I2c<A> + ErrorType, A: AddressMode + Copy, C: CodecSync,

Source§

impl<I, C> RegisterInterfaceSync for SpiDeviceSync<I, C>
where I: SpiDevice, C: CodecSync,