reformat
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
use std::fmt::{Debug, Formatter};
|
||||
use std::time::Instant;
|
||||
use crate::hardware::error::I2cError;
|
||||
use anyhow::{bail, Result};
|
||||
use embedded_hal::i2c::I2c;
|
||||
use log::{info, trace};
|
||||
use crate::hardware::error::I2cError;
|
||||
use std::fmt::{Debug, Formatter};
|
||||
use std::time::Instant;
|
||||
|
||||
pub trait Mcp23017 {
|
||||
fn init(&mut self) -> Result<()>;
|
||||
@@ -27,9 +27,9 @@ impl<I2C> Debug for Mcp23017Driver<I2C> {
|
||||
impl<I2C> Mcp23017Driver<I2C>
|
||||
where
|
||||
I2C: I2c,
|
||||
I2C::Error : Send,
|
||||
I2C::Error : Sync,
|
||||
I2C::Error : 'static
|
||||
I2C::Error: Send,
|
||||
I2C::Error: Sync,
|
||||
I2C::Error: 'static,
|
||||
{
|
||||
pub fn new(i2c: I2C, address: u8) -> Self {
|
||||
trace!("Mcp23017Driver::new(i2c, address: {address:07b})");
|
||||
@@ -46,9 +46,9 @@ where
|
||||
impl<I2C> Mcp23017 for Mcp23017Driver<I2C>
|
||||
where
|
||||
I2C: I2c,
|
||||
I2C::Error : Send,
|
||||
I2C::Error : Sync,
|
||||
I2C::Error : 'static
|
||||
I2C::Error: Send,
|
||||
I2C::Error: Sync,
|
||||
I2C::Error: 'static,
|
||||
{
|
||||
fn init(&mut self) -> Result<()> {
|
||||
trace!("Mcp23017Driver::init(self: {self:?})");
|
||||
@@ -64,10 +64,10 @@ where
|
||||
let (pin_bank, dirty_flag, pin_index) = match pin {
|
||||
0..8 => {
|
||||
(&mut self.bank[0], &mut self.dirty, pin as u32)
|
||||
},
|
||||
8 ..16 => {
|
||||
}
|
||||
8..16 => {
|
||||
(&mut self.bank[1], &mut self.dirty, (pin as u32) - 8)
|
||||
},
|
||||
}
|
||||
_ => bail!("Invalid Pin ID"),
|
||||
};
|
||||
let pin_mask = 1u8.unbounded_shl(pin_index);
|
||||
|
||||
Reference in New Issue
Block a user