diff --git a/src/i2c.rs b/src/i2c.rs index 55fa879..7d5fa80 100644 --- a/src/i2c.rs +++ b/src/i2c.rs @@ -203,7 +203,7 @@ impl I2c where I2C: Deref, { - fn i2c_init(self: Self, speed: KiloHertz) -> Self { + fn i2c_init(self, speed: KiloHertz) -> Self { use core::cmp; // Make sure the I2C unit is disabled so we can configure it diff --git a/src/rcc.rs b/src/rcc.rs index ae79f5e..32c51ec 100644 --- a/src/rcc.rs +++ b/src/rcc.rs @@ -559,17 +559,15 @@ impl CFGR { feature = "stm32f091", feature = "stm32f098", ))] - match self.crs { - Some(crs) => { - self.rcc.apb1enr.modify(|_, w| w.crsen().set_bit()); - - // Initialize clock recovery - // Set autotrim enabled. - crs.cr.modify(|_, w| w.autotrimen().set_bit()); - // Enable CR - crs.cr.modify(|_, w| w.cen().set_bit()); - } - _ => {} + + if let Some(crs) = self.crs { + self.rcc.apb1enr.modify(|_, w| w.crsen().set_bit()); + + // Initialize clock recovery + // Set autotrim enabled. + crs.cr.modify(|_, w| w.autotrimen().set_bit()); + // Enable CR + crs.cr.modify(|_, w| w.cen().set_bit()); } // use HSI as source diff --git a/src/serial.rs b/src/serial.rs index 5fe0541..c06f4e7 100644 --- a/src/serial.rs +++ b/src/serial.rs @@ -72,6 +72,7 @@ use core::marker::PhantomData; /// Serial error #[derive(Debug)] +#[non_exhaustive] pub enum Error { /// Framing error Framing, @@ -81,8 +82,6 @@ pub enum Error { Overrun, /// Parity check error Parity, - #[doc(hidden)] - _Extensible, } /// Interrupt event diff --git a/src/spi.rs b/src/spi.rs index 8d31fd8..8a2fd8c 100644 --- a/src/spi.rs +++ b/src/spi.rs @@ -75,6 +75,7 @@ pub struct SixteenBit; /// SPI error #[derive(Debug)] +#[non_exhaustive] pub enum Error { /// Overrun occurred Overrun, @@ -82,8 +83,6 @@ pub enum Error { ModeFault, /// CRC error Crc, - #[doc(hidden)] - _Extensible, } /// SPI abstraction @@ -445,7 +444,7 @@ where for word in words.iter_mut() { nb::block!(self.check_send())?; - self.send_u8(word.clone()); + self.send_u8(*word); nb::block!(self.check_read())?; *word = self.read_u8(); } @@ -522,7 +521,7 @@ where for word in words { nb::block!(self.check_send())?; - self.send_u16(word.clone()); + self.send_u16(*word); } // Do one last status register check before continuing