Mcp23x17Bus

Trait Mcp23x17Bus 

Source
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§

Source

fn write_reg<R: Into<u8>>( &mut self, addr: u8, reg: R, value: u8, ) -> Result<(), Self::BusError>

Source

fn read_reg<R: Into<u8>>( &mut self, addr: u8, reg: R, ) -> Result<u8, Self::BusError>

Provided Methods§

Source

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.

Implementors§

Source§

impl<I2C: I2cBus> Mcp23x17Bus for Mcp23017Bus<I2C>

Source§

impl<SPI: SpiBus> Mcp23x17Bus for Mcp23S17Bus<SPI>

Source§

type BusError = <SPI as SpiBus>::BusError