diff --git a/CHANGELOG.md b/CHANGELOG.md index aac033b..6bf8098 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,21 +6,24 @@ - [Integration](https://crates.io/crates/mcan-core) with the [`mcan`](https://crates.io/crates/mcan) crate. - Implementation of blocking::i2c::Transactional trait from [embedded-hal](https://crates.io/crates/embedded-hal) for TWI device. +- Support for `critical-section` feature, falling down to PAC optional dependency. ### Changed -- Remove `rust-toolchain.toml` and control MSRV from .github/workflow/ files instead. +- Remove `rust-toolchain.toml` and control MSRV from `.github/workflow/` files instead. - Update `cortex-m-rt` version in examples to `0.7.3`. - Switched from AFE0_AD6 to AFE0_AD8 for the atsamv71_xult board ADC example code. +- The `rt` separated to don't act as part of chip selection feature anymore. ### Removed - Huge generated source code for PACs removed, new location for them [`atsamx7x-pac`](/atsams-rs/atsamx7x-pac) (user side generated) ### Fixed -- Examples now build and link again -- Examples now build again again +- Examples now build and link again. +- Examples now build again again. - [#62] Remove ambiguous reexports from `src/serial/mod.rs`. - TWIHS: Fix issue with clock frequency calculation. -- Fix CI: source of PACs matrix + clippy satisfaction +- Fix CI: source of PACs matrix + clippy satisfaction. +- Fixes doctest use of `take()` which now require `critical-section`. ## [v0.4.2] 2022-11-06 diff --git a/hal/src/clocks/mod.rs b/hal/src/clocks/mod.rs index 23d9cdd..3f8f2ee 100644 --- a/hal/src/clocks/mod.rs +++ b/hal/src/clocks/mod.rs @@ -28,7 +28,7 @@ For example, if we want to configure the [`MainClock`]: use atsamx7x_hal as hal; use hal::fugit::RateExtU32; -let pac = unsafe{hal::pac::Peripherals::steal()}; +let pac = hal::pac::Peripherals::take().unwrap(); let clocks = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()); let mainck = clocks .mainck @@ -72,7 +72,7 @@ use hal::efc::{Efc, VddioLevel}; use hal::fugit::RateExtU32; // configure the clock hierarchy -let pac = unsafe{hal::pac::Peripherals::steal()}; +let pac = hal::pac::Peripherals::take().unwrap(); let clocks = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()); let slck = clocks.slck.configure_external_normal(); let mainck = clocks diff --git a/hal/src/pio/bank.rs b/hal/src/pio/bank.rs index 42fce89..27cb34d 100644 --- a/hal/src/pio/bank.rs +++ b/hal/src/pio/bank.rs @@ -42,7 +42,7 @@ impl BankInterrupts { /// # use hal::pio::*; /// # use hal::clocks::*; /// # use hal::efc::*; - /// # let pac = unsafe{hal::pac::Peripherals::steal()}; + /// # let pac = hal::pac::Peripherals::take().unwrap(); /// # let (slck, mut mck) = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()).por_state(&mut Efc::new(pac.EFC, VddioLevel::V3)); /// let mut banka = BankA::new(pac.PIOA, &mut mck, &slck, BankConfiguration::default()); /// for pin in banka.interrupts.iter() { diff --git a/hal/src/pio/mod.rs b/hal/src/pio/mod.rs index 43c832d..d50b5ea 100644 --- a/hal/src/pio/mod.rs +++ b/hal/src/pio/mod.rs @@ -86,7 +86,7 @@ The below example configures [`Pin`] to trigger on # use hal::pio::*; # use hal::clocks::*; # use hal::efc::*; -# let pac = unsafe{hal::pac::Peripherals::steal()}; +# let pac = hal::pac::Peripherals::take().unwrap(); # let (slck, mut mck) = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()).por_state(&mut Efc::new(pac.EFC, VddioLevel::V3)); let banka = BankA::new( diff --git a/hal/src/rtt.rs b/hal/src/rtt.rs index 906d4be..d738ca5 100644 --- a/hal/src/rtt.rs +++ b/hal/src/rtt.rs @@ -23,7 +23,7 @@ via [`Rtt::new_8192Hz`]. # use hal::rtt::*; # use hal::fugit::RateExtU32; # use rtic_monotonic::*; -# let pac = unsafe{hal::pac::Peripherals::steal()}; +# let pac = hal::pac::Peripherals::take().unwrap(); # let (slck, mut mck) = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()).por_state(&mut Efc::new(pac.EFC, VddioLevel::V3)); let mono: Mono<100> = Rtt::new(pac.RTT, &slck, 100.Hz()).unwrap().into_monotonic(); @@ -37,7 +37,7 @@ or # use hal::rtt::*; # use hal::fugit::RateExtU32; # use rtic_monotonic::Monotonic; -# let pac = unsafe{hal::pac::Peripherals::steal()}; +# let pac = hal::pac::Peripherals::take().unwrap(); # let (slck, mut mck) = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()).por_state(&mut Efc::new(pac.EFC, VddioLevel::V3)); use hal::ehal::{blocking::delay::DelayMs, timer::{CountDown, Cancel}}; @@ -83,7 +83,7 @@ pub enum RttError { /// # use hal::efc::*; /// # use hal::rtt::*; /// # use hal::fugit::RateExtU32; - /// # let pac = unsafe{hal::pac::Peripherals::steal()}; + /// # let pac = hal::pac::Peripherals::take().unwrap(); /// # let (slck, mut mck) = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()).por_state(&mut Efc::new(pac.EFC, VddioLevel::V3)); /// let rtt: Rtt<100> = Rtt::new(pac.RTT, &slck, 100.Hz()).unwrap(); /// ``` diff --git a/hal/src/serial/spi.rs b/hal/src/serial/spi.rs index a2584de..cde2c68 100644 --- a/hal/src/serial/spi.rs +++ b/hal/src/serial/spi.rs @@ -23,7 +23,7 @@ Interrupt event management is handled by the [`event system`](crate::generics::e # use hal::serial::spi::*; # use hal::serial::ExtBpsU32; # use hal::fugit::ExtU32; -# let pac = unsafe{hal::pac::Peripherals::steal()}; +# let pac = hal::pac::Peripherals::take().unwrap(); # let (slck, mut mck) = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()).por_state(&mut Efc::new(pac.EFC, VddioLevel::V3)); let bankd = BankD::new(pac.PIOD, &mut mck, &slck, BankConfiguration::default()); diff --git a/hal/src/serial/twi.rs b/hal/src/serial/twi.rs index c8154ec..4c54828 100644 --- a/hal/src/serial/twi.rs +++ b/hal/src/serial/twi.rs @@ -20,7 +20,7 @@ implemented. # use hal::efc::*; # use hal::serial::twi::*; # use hal::fugit::RateExtU32; -# let pac = unsafe{hal::pac::Peripherals::steal()}; +# let pac = hal::pac::Peripherals::take().unwrap(); # let (slck, mut mck) = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()).por_state(&mut Efc::new(pac.EFC, VddioLevel::V3)); let banka = BankA::new(pac.PIOA, &mut mck, &slck, BankConfiguration::default()); diff --git a/hal/src/serial/uart.rs b/hal/src/serial/uart.rs index 67669a9..7503092 100644 --- a/hal/src/serial/uart.rs +++ b/hal/src/serial/uart.rs @@ -26,7 +26,7 @@ Interrupt event management is handled by the [`event system`](crate::generics::e # use hal::serial::uart::*; # use hal::serial::ExtBpsU32; # use hal::fugit::{ExtU32, RateExtU32}; -# let pac = unsafe{hal::pac::Peripherals::steal()}; +# let pac = hal::pac::Peripherals::take().unwrap(); let clocks = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()); let slck = clocks.slck.configure_external_normal(); let mainck = clocks diff --git a/hal/src/serial/usart/mod.rs b/hal/src/serial/usart/mod.rs index 70e1240..0215814 100644 --- a/hal/src/serial/usart/mod.rs +++ b/hal/src/serial/usart/mod.rs @@ -32,7 +32,7 @@ Mode support depends on what [`Pin`]s that are available for the # use hal::serial::usart::*; # use hal::serial::ExtBpsU32; # use hal::fugit::{ExtU32, RateExtU32}; -# let pac = unsafe{hal::pac::Peripherals::steal()}; +# let pac = hal::pac::Peripherals::take().unwrap(); # let (slck, mut mck) = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()).por_state(&mut Efc::new(pac.EFC, VddioLevel::V3)); use hal::generics::events::EventHandler; use hal::ehal::serial::{Read, Write}; diff --git a/hal/src/tc/mod.rs b/hal/src/tc/mod.rs index aa667e7..57f1d3b 100644 --- a/hal/src/tc/mod.rs +++ b/hal/src/tc/mod.rs @@ -22,7 +22,7 @@ Refer to ยง50 for a full description on the capabilities offered by a [`Tc`]. # use hal::efc::*; # use hal::tc::*; # use hal::fugit::ExtU32; -# let pac = unsafe{hal::pac::Peripherals::steal()}; +# let pac = hal::pac::Peripherals::take().unwrap(); # let (slck, mut mck) = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()).por_state(&mut Efc::new(pac.EFC, VddioLevel::V3)); let banka = hal::pio::BankA::new( pac.PIOA, @@ -54,7 +54,7 @@ counter.sample_freq(100.millis()); # use hal::clocks::*; # use hal::efc::*; # use hal::tc::*; -# let pac = unsafe{hal::pac::Peripherals::steal()}; +# let pac = hal::pac::Peripherals::take().unwrap(); # let (slck, mut mck) = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()).por_state(&mut Efc::new(pac.EFC, VddioLevel::V3)); let tc = Tc::new_tc0(pac.TC0, &mut mck); let driver = tc @@ -80,7 +80,7 @@ let mono: Monotonic> # use hal::clocks::*; # use hal::efc::*; # use hal::tc::*; -# let pac = unsafe{hal::pac::Peripherals::steal()}; +# let pac = hal::pac::Peripherals::take().unwrap(); # let (slck, mut mck) = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()).por_state(&mut Efc::new(pac.EFC, VddioLevel::V3)); let tc = Tc::new_tc0(pac.TC0, &mut mck); let driver = tc @@ -410,7 +410,7 @@ pub enum TcError { /// # use hal::clocks::*; /// # use hal::efc::*; /// # use hal::tc::*; - /// # let pac = unsafe{hal::pac::Peripherals::steal()}; + /// # let pac = hal::pac::Peripherals::take().unwrap(); /// # let (slck, mut mck) = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()).por_state(&mut Efc::new(pac.EFC, VddioLevel::V3)); /// let tc = Tc::new_tc0(pac.TC0, &mut mck); /// let ch = tc.channel_0.generate::<15_000_000>(&mck).unwrap(); diff --git a/hal/src/usb.rs b/hal/src/usb.rs index 5e8d4fb..0922381 100644 --- a/hal/src/usb.rs +++ b/hal/src/usb.rs @@ -16,7 +16,7 @@ extensively tested, and should be considered unstable at the moment. # use hal::efc::*; # use hal::usb::*; # use hal::fugit::RateExtU32; -# let pac = unsafe{hal::pac::Peripherals::steal()}; +# let pac = hal::pac::Peripherals::take().unwrap(); # let clocks = Tokens::new((pac.PMC, pac.SUPC, pac.UTMI), &pac.WDT.into()); # let slck = clocks.slck.configure_external_normal(); # let mainck = clocks