adds simulated hardware
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use crate::hardware::error::I2cError;
|
||||
use crate::hardware::error::WrappingError;
|
||||
use crate::hardware::mcp23017::pin::{Mcp23017OutputPinDriver, Mcp23017Pins};
|
||||
use crate::hardware::mcp23017::{Mcp23017, Mcp23017OutputPin};
|
||||
use anyhow::bail;
|
||||
@@ -109,7 +109,7 @@ where
|
||||
let data: [u8; _] = [0x00, 0x00, 0x00];
|
||||
|
||||
match self.i2c.get_mut() {
|
||||
Ok(lock) => lock.write(self.address, &data).map_err(I2cError)?,
|
||||
Ok(lock) => lock.write(self.address, &data).map_err(WrappingError)?,
|
||||
Err(_) => bail!("Lock was poisoned"),
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ where
|
||||
let data: [u8; _] = [0x12, bytes[0], bytes[1]];
|
||||
// This blocks while writing
|
||||
if let Ok(mut lock) = self.i2c.lock() {
|
||||
lock.write(self.address, &data).map_err(I2cError)?;
|
||||
lock.write(self.address, &data).map_err(WrappingError)?;
|
||||
self.i2c.clear_poison();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user