Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for MCP23017 and MCP23S17 #27

Merged
merged 5 commits into from
Mar 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/bus.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use embedded_hal::i2c as hal_i2c;
use embedded_hal::{i2c as hal_i2c, spi as hal_spi};

/// Blanket trait for types implementing `i2c::I2c
pub trait I2cBus: hal_i2c::I2c {
Expand Down Expand Up @@ -56,3 +56,14 @@ impl<I2C: I2cBus> I2cExt for I2C {
Ok(buf[0])
}
}

pub trait SpiBus: hal_spi::SpiDevice {
type BusError: From<<Self as hal_spi::ErrorType>::Error>;
}

impl<T, E> SpiBus for T
where
T: hal_spi::SpiDevice<Error = E>,
{
type BusError = E;
}
Loading
Loading