pub mod i2c;
pub mod spi;
pub use self::i2c::I2cInterface;
pub use self::spi::SpiInterface;
use crate::errors::{GyroError, XmError};
pub const MAX_WRITE_LEN: usize = 15;
pub trait Interface {
type BusError;
async fn write_gyro(&mut self, addr: u8, data: &[u8]) -> Result<(), GyroError<Self::BusError>>;
async fn write_byte_gyro(
&mut self,
addr: u8,
value: u8,
) -> Result<(), GyroError<Self::BusError>> {
self.write_gyro(addr, &[value]).await
}
async fn write_xm(&mut self, addr: u8, data: &[u8]) -> Result<(), XmError<Self::BusError>>;
async fn write_byte_xm(&mut self, addr: u8, value: u8) -> Result<(), XmError<Self::BusError>> {
self.write_xm(addr, &[value]).await
}
async fn read_gyro(
&mut self,
addr: u8,
buffer: &mut [u8],
) -> Result<(), GyroError<Self::BusError>>;
async fn read_xm(&mut self, addr: u8, buffer: &mut [u8])
-> Result<(), XmError<Self::BusError>>;
}