pub trait Mcp23x17Bus {
type BusError;
// Required methods
fn write_reg<R: Into<u8>>(
&mut self,
addr: u8,
reg: R,
value: u8,
) -> Result<(), Self::BusError>;
fn read_reg<R: Into<u8>>(
&mut self,
addr: u8,
reg: R,
) -> Result<u8, Self::BusError>;
// Provided method
fn update_reg<R: Into<u8>>(
&mut self,
addr: u8,
reg: R,
mask_set: u8,
mask_clear: u8,
) -> Result<(), Self::BusError> { ... }
}Expand description
Special -Bus trait for the Mcp23x17 since the SPI version is a bit special/weird in terms of writing SPI registers, which can’t necessarily be generialized for other devices.
Required Associated Types§
Required Methods§
fn write_reg<R: Into<u8>>( &mut self, addr: u8, reg: R, value: u8, ) -> Result<(), Self::BusError>
fn read_reg<R: Into<u8>>( &mut self, addr: u8, reg: R, ) -> Result<u8, Self::BusError>
Provided Methods§
fn update_reg<R: Into<u8>>( &mut self, addr: u8, reg: R, mask_set: u8, mask_clear: u8, ) -> Result<(), Self::BusError>
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.