pub struct SpiInterface<SPI> { /* private fields */ }Expand description
SPI interface for the ICM-20948
§Note on Chip Select
This interface uses the SpiDevice trait from embedded-hal, which manages
the chip select (CS) pin automatically. The CS pin is handled internally by
the SPI device implementation you provide, so you don’t need to pass it separately.
If using embedded-hal-bus, you would typically create an SpiDevice like:
ⓘ
let spi_device = embedded_hal_bus::spi::ExclusiveDevice::new(spi_bus, cs_pin, delay);
let interface = SpiInterface::new(spi_device);Implementations§
Source§impl<SPI> SpiInterface<SPI>
impl<SPI> SpiInterface<SPI>
Trait Implementations§
Source§impl<SPI, E> AsyncRegisterInterface for SpiInterface<SPI>where
SPI: SpiDevice<Error = E>,
Available on crate feature async only.
impl<SPI, E> AsyncRegisterInterface for SpiInterface<SPI>where
SPI: SpiDevice<Error = E>,
Available on crate feature
async only.Source§type AddressType = u8
type AddressType = u8
The address type used by this interface. Should likely be an integer.
Source§async fn read_register(
&mut self,
address: Self::AddressType,
size_bits: u32,
read_data: &mut [u8],
) -> Result<(), Self::Error>
async fn read_register( &mut self, address: Self::AddressType, size_bits: u32, read_data: &mut [u8], ) -> Result<(), Self::Error>
Read the register located at the given addres to the given data slice
Source§async fn write_register(
&mut self,
address: Self::AddressType,
size_bits: u32,
write_data: &[u8],
) -> Result<(), Self::Error>
async fn write_register( &mut self, address: Self::AddressType, size_bits: u32, write_data: &[u8], ) -> Result<(), Self::Error>
Write the given data to the register located at the given address
Source§impl<SPI, E> RegisterInterface for SpiInterface<SPI>where
SPI: SpiDevice<Error = E>,
impl<SPI, E> RegisterInterface for SpiInterface<SPI>where
SPI: SpiDevice<Error = E>,
Source§type AddressType = u8
type AddressType = u8
The address type used by this interface. Should likely be an integer.
Source§fn read_register(
&mut self,
address: Self::AddressType,
size_bits: u32,
read_data: &mut [u8],
) -> Result<(), Self::Error>
fn read_register( &mut self, address: Self::AddressType, size_bits: u32, read_data: &mut [u8], ) -> Result<(), Self::Error>
Read the register located at the given addres to the given data slice
Source§fn write_register(
&mut self,
address: Self::AddressType,
size_bits: u32,
write_data: &[u8],
) -> Result<(), Self::Error>
fn write_register( &mut self, address: Self::AddressType, size_bits: u32, write_data: &[u8], ) -> Result<(), Self::Error>
Write the given data to the register located at the given address
Auto Trait Implementations§
impl<SPI> Freeze for SpiInterface<SPI>where
SPI: Freeze,
impl<SPI> RefUnwindSafe for SpiInterface<SPI>where
SPI: RefUnwindSafe,
impl<SPI> Send for SpiInterface<SPI>where
SPI: Send,
impl<SPI> Sync for SpiInterface<SPI>where
SPI: Sync,
impl<SPI> Unpin for SpiInterface<SPI>where
SPI: Unpin,
impl<SPI> UnwindSafe for SpiInterface<SPI>where
SPI: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more