Struct DeviceInterface

Source
pub struct DeviceInterface<Spi> {
    pub spi: Spi,
}
Expand description

The SPI Device wrapper interface to the driver

Fields§

§spi: Spi

The SPI device used to communicate with the iC-MD device.

Implementations§

Source§

impl<Spi> DeviceInterface<Spi>

Source

pub const fn new(spi: Spi) -> Self

Construct a new instance of the device.

Spi mode 0, max 10 MHz according to the datasheet.

Trait Implementations§

Source§

impl<Spi: Debug> Debug for DeviceInterface<Spi>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Spi: SpiDevice> RegisterInterface for DeviceInterface<Spi>

Source§

type Error = DeviceError<<Spi as ErrorType>::Error>

The error type
Source§

type AddressType = u8

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

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§

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

Auto Trait Implementations§

§

impl<Spi> Freeze for DeviceInterface<Spi>
where Spi: Freeze,

§

impl<Spi> RefUnwindSafe for DeviceInterface<Spi>
where Spi: RefUnwindSafe,

§

impl<Spi> Send for DeviceInterface<Spi>
where Spi: Send,

§

impl<Spi> Sync for DeviceInterface<Spi>
where Spi: Sync,

§

impl<Spi> Unpin for DeviceInterface<Spi>
where Spi: Unpin,

§

impl<Spi> UnwindSafe for DeviceInterface<Spi>
where Spi: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.