Skip to content

Commit

Permalink
Don't gate i2c methods unnecessarily on RccPeriph
Browse files Browse the repository at this point in the history
Signed-off-by: Akhil Velagapudi <[email protected]>
  • Loading branch information
akhilles committed Dec 16, 2024
1 parent 01a19ee commit d3c86bf
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,12 @@ where

result
}
}

impl<R> I2c<R>
where
R: Deref<Target = pac::i2c1::RegisterBlock>,
{
/// Enable SMBus support. See L44 RM, section 37.4.11: SMBus initialization
pub fn enable_smbus(&mut self) -> Result<(), Error> {
// todo: Roll this into an init setting or I2cConfig struct etc.
Expand Down Expand Up @@ -724,17 +729,14 @@ impl i2c::Error for Error {
}

#[cfg(feature = "embedded_hal")]
impl<R> i2c::ErrorType for I2c<R>
where
R: Deref<Target = pac::i2c1::RegisterBlock> + RccPeriph,
{
impl<R> i2c::ErrorType for I2c<R> {
type Error = Error;
}

#[cfg(feature = "embedded_hal")]
impl<R> i2c::I2c for I2c<R>
where
R: Deref<Target = pac::i2c1::RegisterBlock> + RccPeriph,
R: Deref<Target = pac::i2c1::RegisterBlock>,
{
fn transaction(
&mut self,
Expand Down

0 comments on commit d3c86bf

Please sign in to comment.