adds simulated hardware

This commit is contained in:
2025-10-20 20:17:50 -07:00
parent 086ac7f195
commit 2bcb122319
16 changed files with 325 additions and 81 deletions

View File

@@ -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();
}
}