diff --git a/embassy-mspm0/build.rs b/embassy-mspm0/build.rs index ffbe15c56..8c6dd4a5c 100644 --- a/embassy-mspm0/build.rs +++ b/embassy-mspm0/build.rs @@ -107,11 +107,7 @@ fn generate_code() { } // Generate timers - for peripheral in METADATA - .peripherals - .iter() - .filter(|p| p.name.starts_with("TIM")) - { + for peripheral in METADATA.peripherals.iter().filter(|p| p.name.starts_with("TIM")) { let name = Ident::new(&peripheral.name, Span::call_site()); let timers = &*TIMERS; @@ -225,8 +221,7 @@ fn time_driver(singletons: &[String], cfgs: &mut CfgSet) { // TODO: 32-bit timers are not considered yet [ // 16-bit, 2 channel - "TIMG0", "TIMG1", "TIMG2", "TIMG3", - // 16-bit, 2 channel with shadow registers + "TIMG0", "TIMG1", "TIMG2", "TIMG3", // 16-bit, 2 channel with shadow registers "TIMG4", "TIMG5", "TIMG6", "TIMG7", // 16-bit, 4 channel "TIMG14", // 16-bit with QEI "TIMG8", "TIMG9", "TIMG10", "TIMG11", // Advanced timers diff --git a/embassy-mspm0/src/gpio.rs b/embassy-mspm0/src/gpio.rs index fd4dc55ab..e1eb7eecf 100644 --- a/embassy-mspm0/src/gpio.rs +++ b/embassy-mspm0/src/gpio.rs @@ -7,13 +7,12 @@ use core::task::{Context, Poll}; use embassy_hal_internal::{impl_peripheral, into_ref, Peripheral, PeripheralRef}; use embassy_sync::waitqueue::AtomicWaker; + +use crate::pac::gpio::vals::*; +use crate::pac::gpio::{self}; #[cfg(all(feature = "rt", feature = "mspm0c110x"))] use crate::pac::interrupt; - -use crate::pac::{ - self, - gpio::{self, vals::*}, -}; +use crate::pac::{self}; /// Represents a digital input or output level. #[derive(Debug, Eq, PartialEq, Clone, Copy)] @@ -88,9 +87,7 @@ impl<'d> Flex<'d> { into_ref!(pin); // Pin will be in disconnected state. - Self { - pin: pin.map_into(), - } + Self { pin: pin.map_into() } } /// Set the pin's pull. @@ -974,14 +971,7 @@ impl<'d> Future for InputFuture<'d> { waker.register(cx.waker()); // The interrupt handler will mask the interrupt if the event has occurred. - if self - .pin - .block() - .cpu_int() - .ris() - .read() - .dio(self.pin.bit_index()) - { + if self.pin.block().cpu_int().ris().read().dio(self.pin.bit_index()) { return Poll::Ready(()); } diff --git a/embassy-mspm0/src/lib.rs b/embassy-mspm0/src/lib.rs index ee629f063..1191b1010 100644 --- a/embassy-mspm0/src/lib.rs +++ b/embassy-mspm0/src/lib.rs @@ -1,10 +1,6 @@ #![no_std] // Doc feature labels can be tested locally by running RUSTDOCFLAGS="--cfg=docsrs" cargo +nightly doc -#![cfg_attr( - docsrs, - feature(doc_auto_cfg, doc_cfg_hide), - doc(cfg_hide(doc, docsrs)) -)] +#![cfg_attr(docsrs, feature(doc_auto_cfg, doc_cfg_hide), doc(cfg_hide(doc, docsrs)))] // This mod MUST go first, so that the others see its macros. pub(crate) mod fmt; @@ -40,6 +36,7 @@ pub(crate) mod _generated { } // Reexports +pub(crate) use _generated::gpio_pincm; pub use _generated::{peripherals, Peripherals}; pub use embassy_hal_internal::{into_ref, Peripheral, PeripheralRef}; #[cfg(feature = "unstable-pac")] @@ -48,8 +45,6 @@ pub use mspm0_metapac as pac; pub(crate) use mspm0_metapac as pac; pub use crate::_generated::interrupt; -pub(crate) use _generated::gpio_pincm; - /// `embassy-mspm0` global configuration. #[non_exhaustive] diff --git a/embassy-mspm0/src/time_driver.rs b/embassy-mspm0/src/time_driver.rs index 3af7a5edb..937ce58d4 100644 --- a/embassy-mspm0/src/time_driver.rs +++ b/embassy-mspm0/src/time_driver.rs @@ -1,19 +1,13 @@ -use core::{ - cell::{Cell, RefCell}, - sync::atomic::{compiler_fence, AtomicU32, Ordering}, - task::Waker, -}; +use core::cell::{Cell, RefCell}; +use core::sync::atomic::{compiler_fence, AtomicU32, Ordering}; +use core::task::Waker; use critical_section::{CriticalSection, Mutex}; use embassy_time_driver::Driver; use embassy_time_queue_utils::Queue; -use mspm0_metapac::{ - interrupt, - tim::{ - vals::{Cm, Cvae, CxC, EvtCfg, PwrenKey, Ratio, Repeat, ResetKey}, - Counterregs16, Tim, - }, -}; +use mspm0_metapac::interrupt; +use mspm0_metapac::tim::vals::{Cm, Cvae, CxC, EvtCfg, PwrenKey, Ratio, Repeat, ResetKey}; +use mspm0_metapac::tim::{Counterregs16, Tim}; use crate::peripherals; use crate::timer::SealedTimer; @@ -244,18 +238,10 @@ impl TimxDriver { } fn trigger_alarm(&self, cs: CriticalSection) { - let mut next = self - .queue - .borrow(cs) - .borrow_mut() - .next_expiration(self.now()); + let mut next = self.queue.borrow(cs).borrow_mut().next_expiration(self.now()); while !self.set_alarm(cs, next) { - next = self - .queue - .borrow(cs) - .borrow_mut() - .next_expiration(self.now()); + next = self.queue.borrow(cs).borrow_mut().next_expiration(self.now()); } }