embassy-stm32: Misc clippy fixes

This commit is contained in:
Grant Miller
2023-08-06 15:00:39 -05:00
parent 477a90b8e3
commit d49f40dd5c
11 changed files with 61 additions and 64 deletions

View File

@ -21,21 +21,12 @@ impl<T: Instance> interrupt::typelevel::Handler<T::Interrupt> for InterruptHandl
}
#[non_exhaustive]
#[derive(Copy, Clone)]
#[derive(Copy, Clone, Default)]
pub struct Config {
pub sda_pullup: bool,
pub scl_pullup: bool,
}
impl Default for Config {
fn default() -> Self {
Self {
sda_pullup: false,
scl_pullup: false,
}
}
}
pub struct State {}
impl State {
@ -90,7 +81,7 @@ impl<'d, T: Instance, TXDMA, RXDMA> I2c<'d, T, TXDMA, RXDMA> {
//reg.set_anfoff(false);
});
let timings = Timings::new(T::frequency(), freq.into());
let timings = Timings::new(T::frequency(), freq);
T::regs().cr2().modify(|reg| {
reg.set_freq(timings.freq);
@ -461,7 +452,7 @@ impl Timings {
let speed = speed.0;
let clock = i2cclk.0;
let freq = clock / 1_000_000;
assert!(freq >= 2 && freq <= 50);
assert!((2..=50).contains(&freq));
// Configure bus frequency into I2C peripheral
let trise = if speed <= 100_000 {