Compare commits

...

1 Commits

Author SHA1 Message Date
Marc Poulhiès 81b831d9f5 Fix clippy lints 1 year ago
  1. 2
      src/i2c.rs
  2. 20
      src/rcc.rs
  3. 3
      src/serial.rs
  4. 7
      src/spi.rs

2
src/i2c.rs

@ -203,7 +203,7 @@ impl<I2C, SCLPIN, SDAPIN> I2c<I2C, SCLPIN, SDAPIN>
where
I2C: Deref<Target = I2cRegisterBlock>,
{
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

20
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

3
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

7
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

Loading…
Cancel
Save