From 88d54fa0b8818dd68af4487490e21beffc7ce20d Mon Sep 17 00:00:00 2001 From: JC <8765278+Crzyrndm@users.noreply.github.com> Date: Sat, 16 Oct 2021 12:45:06 +1300 Subject: [PATCH 01/12] rename current device selection features to make clear they are internal now --- Cargo.toml | 10 +- src/can.rs | 2 +- src/gpio.rs | 4 +- src/i2c.rs | 22 ++-- src/lib.rs | 268 ++++++++++++++++++++++++------------------------ src/qspi.rs | 48 ++++----- src/rcc.rs | 4 +- src/serial.rs | 24 ++--- src/spi.rs | 106 +++++++++---------- src/timer.rs | 4 +- src/watchdog.rs | 8 +- 11 files changed, 257 insertions(+), 243 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c19aaea3..9069847a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -61,11 +61,11 @@ features = ["rt", "stm32l4x2", "stm32-usbd"] [features] rt = ["stm32l4/rt"] -stm32l4x1 = ["stm32l4/stm32l4x1"] -stm32l4x2 = ["stm32l4/stm32l4x2"] -stm32l4x3 = ["stm32l4/stm32l4x3"] -stm32l4x5 = ["stm32l4/stm32l4x5"] -stm32l4x6 = ["stm32l4/stm32l4x6"] +private_pac_stm32l4x1 = ["stm32l4/stm32l4x1"] +private_pac_stm32l4x2 = ["stm32l4/stm32l4x2"] +private_pac_stm32l4x3 = ["stm32l4/stm32l4x3"] +private_pac_stm32l4x5 = ["stm32l4/stm32l4x5"] +private_pac_stm32l4x6 = ["stm32l4/stm32l4x6"] unproven = ["embedded-hal/unproven"] otg_fs = ["synopsys-usb-otg"] diff --git a/src/can.rs b/src/can.rs index 209a1152..5ca2f8a2 100644 --- a/src/can.rs +++ b/src/can.rs @@ -45,7 +45,7 @@ mod common_pins { } } -#[cfg(feature = "stm32l4x1")] +#[cfg(feature = "private_pac_stm32l4x1")] mod pb13_pb12_af10 { use crate::gpio::{ gpiob::{PB12, PB13}, diff --git a/src/gpio.rs b/src/gpio.rs index 1381c6ac..fccd3962 100644 --- a/src/gpio.rs +++ b/src/gpio.rs @@ -870,7 +870,7 @@ gpio!(GPIOE, gpioe, gpioc, gpioeen, gpioerst, PEx, 4, [ PE15: (pe15, 15, Input, AFRH, exticr4), ]); -#[cfg(any(feature = "stm32l4x5", feature = "stm32l4x6"))] +#[cfg(any(feature = "private_pac_stm32l4x5", feature = "private_pac_stm32l4x6"))] gpio!(GPIOF, gpiof, gpioc, gpiofen, gpiofrst, PFx, 5, [ PF0: (pf0, 0, Input, AFRL, exticr1), PF1: (pf1, 1, Input, AFRL, exticr1), @@ -890,7 +890,7 @@ gpio!(GPIOF, gpiof, gpioc, gpiofen, gpiofrst, PFx, 5, [ PF15: (pf15, 15, Input, AFRH, exticr4), ]); -#[cfg(any(feature = "stm32l4x5", feature = "stm32l4x6"))] +#[cfg(any(feature = "private_pac_stm32l4x5", feature = "private_pac_stm32l4x6"))] gpio!(GPIOG, gpiog, gpioc, gpiogen, gpiogrst, PGx, 6, [ PG0: (pg0, 0, Input, AFRL, exticr1), PG1: (pg1, 1, Input, AFRL, exticr1), diff --git a/src/i2c.rs b/src/i2c.rs index 868757cd..64fd2969 100644 --- a/src/i2c.rs +++ b/src/i2c.rs @@ -3,7 +3,11 @@ //! as of 2021-02-25. use crate::hal::blocking::i2c::{Read, Write, WriteRead}; -#[cfg(any(feature = "stm32l4x1", feature = "stm32l4x2", feature = "stm32l4x6"))] +#[cfg(any( + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x6" +))] use crate::pac::I2C4; use crate::pac::{i2c1, I2C1, I2C2, I2C3}; @@ -190,7 +194,11 @@ hal!(I2C3, enr, rstr, i2c3, i2c3en, i2c3rst); // STM32L471XX and STM32L431XX // STM32L432XX and STM32l442XX // STM32L486XX and STM32L476XX -#[cfg(any(feature = "stm32l4x1", feature = "stm32l4x2", feature = "stm32l4x6"))] +#[cfg(any( + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x6" +))] hal!(I2C4, enr2, rstr2, i2c4, i2c4en, i2c4rst); impl I2c @@ -443,7 +451,7 @@ where } } -#[cfg(feature = "stm32l4x1")] +#[cfg(feature = "private_pac_stm32l4x1")] mod stm32l4x1_pins { use super::{I2C1, I2C2, I2C3, I2C4}; use crate::gpio::*; @@ -468,7 +476,7 @@ mod stm32l4x1_pins { pins!(I2C4, AF3, SCL: [PB10], SDA: [PB11]); } -#[cfg(feature = "stm32l4x2")] +#[cfg(feature = "private_pac_stm32l4x2")] mod stm32l4x2_pins { use super::{I2C1, I2C2, I2C3, I2C4}; use crate::gpio::*; @@ -494,7 +502,7 @@ mod stm32l4x2_pins { pins!(I2C4, AF4, SCL: [PD12], SDA: [PD13]); } -#[cfg(feature = "stm32l4x3")] +#[cfg(feature = "private_pac_stm32l4x3")] mod stm32l4x3_pins { use super::{I2C1, I2C2, I2C3}; use crate::gpio::*; @@ -509,7 +517,7 @@ mod stm32l4x3_pins { pins!(I2C3, AF4, SCL: [PA7, PC0], SDA: [PB4, PC1]); } -#[cfg(feature = "stm32l4x5")] +#[cfg(feature = "private_pac_stm32l4x5")] mod stm32l4x5_pins { use super::{I2C1, I2C2, I2C3}; use crate::gpio::*; @@ -523,7 +531,7 @@ mod stm32l4x5_pins { pins!(I2C3, AF4, SCL: [PC0], SDA: [PC1]); } -#[cfg(feature = "stm32l4x6")] +#[cfg(feature = "private_pac_stm32l4x6")] mod stm32l4x6_pins { use super::{I2C1, I2C2, I2C3, I2C4}; use crate::gpio::*; diff --git a/src/lib.rs b/src/lib.rs index c478f205..fa85ebd2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,239 +11,241 @@ #![no_std] #[cfg(not(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x4", - feature = "stm32l4x5", - feature = "stm32l4x6", + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6", )))] compile_error!("This crate requires one of the following features enabled: stm32l4x1, stm32l4x2, stm32l4x3, stm32l4x4, stm32l4x5 or stm32l4x6"); pub use embedded_hal as hal; pub use stm32l4; -#[cfg(feature = "stm32l4x1")] +#[cfg(feature = "private_pac_stm32l4x1")] pub use stm32l4::stm32l4x1 as pac; -#[cfg(feature = "stm32l4x2")] +#[cfg(feature = "private_pac_stm32l4x2")] pub use stm32l4::stm32l4x2 as pac; -#[cfg(feature = "stm32l4x3")] +#[cfg(feature = "private_pac_stm32l4x3")] pub use stm32l4::stm32l4x3 as pac; -#[cfg(feature = "stm32l4x5")] +#[cfg(feature = "private_pac_stm32l4x5")] pub use stm32l4::stm32l4x5 as pac; -#[cfg(feature = "stm32l4x6")] +#[cfg(feature = "private_pac_stm32l4x6")] pub use stm32l4::stm32l4x6 as pac; #[cfg(feature = "rt")] pub use self::pac::interrupt; #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6" + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6" ))] pub use crate::pac as device; #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6" + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6" ))] pub use crate::pac as stm32; pub mod traits; #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6" + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6" ))] pub mod adc; -#[cfg(any(feature = "stm32l4x1", feature = "stm32l4x5",))] +#[cfg(any(feature = "private_pac_stm32l4x1", feature = "private_pac_stm32l4x5",))] pub mod can; #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6" + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6" ))] pub mod crc; pub mod datetime; #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6" + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6" ))] pub mod delay; #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6" + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6" ))] pub mod dma; #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6" + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6" ))] pub mod flash; #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6" + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6" ))] pub mod gpio; #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6" + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6" ))] pub mod i2c; -#[cfg(all(feature = "otg_fs", any(feature = "stm32l4x5", feature = "stm32l4x6")))] +#[cfg(all( + feature = "otg_fs", + any(feature = "private_pac_stm32l4x5", feature = "private_pac_stm32l4x6") +))] pub mod otg_fs; #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6" + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6" ))] pub mod prelude; #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6" + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6" ))] pub mod pwm; #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6" + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6" ))] pub mod pwr; #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6" + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6" ))] pub mod lptimer; #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x5", - feature = "stm32l4x6" + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6" ))] pub mod qspi; #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6" + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6" ))] pub mod rcc; #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6" + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6" ))] pub mod rng; #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6" + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6" ))] pub mod rtc; #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6" + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6" ))] pub mod serial; #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6" + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6" ))] pub mod signature; #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6" + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6" ))] pub mod spi; #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6" + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6" ))] pub mod time; #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6" + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6" ))] pub mod timer; #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6" + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6" ))] pub mod tsc; #[cfg(all( feature = "stm32-usbd", - any(feature = "stm32l4x2", feature = "stm32l4x3") + any(feature = "private_pac_stm32l4x2", feature = "private_pac_stm32l4x3") ))] pub mod usb; #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6" + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6" ))] pub mod watchdog; diff --git a/src/qspi.rs b/src/qspi.rs index cde5ad2c..04dca385 100644 --- a/src/qspi.rs +++ b/src/qspi.rs @@ -1,10 +1,10 @@ //! Quad Serial Peripheral Interface (QSPI) bus #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6" + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6" ))] use crate::gpio::{ gpioa::{PA6, PA7}, @@ -13,20 +13,20 @@ use crate::gpio::{ }; #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x6" + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x6" ))] use crate::gpio::{ gpioa::{PA2, PA3}, gpiod::{PD3, PD4, PD5, PD6, PD7}, }; -#[cfg(feature = "stm32l4x2")] +#[cfg(feature = "private_pac_stm32l4x2")] use crate::gpio::gpiob::PB2; -#[cfg(feature = "stm32l4x6")] +#[cfg(feature = "private_pac_stm32l4x6")] use crate::gpio::{ gpioc::{PC1, PC2, PC4, PC5}, gpiof::{PF6, PF7, PF8, PF9}, @@ -707,11 +707,11 @@ impl Qspi<(CLK, NCS, IO0, IO1, IO2, IO3)> { } #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6" + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6" ))] pins!( QUADSPI, @@ -725,10 +725,10 @@ pins!( ); #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x6" + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x6" ))] pins!( QUADSPI, @@ -741,22 +741,22 @@ pins!( IO3: [PD7] ); -#[cfg(feature = "stm32l4x2")] +#[cfg(feature = "private_pac_stm32l4x2")] impl IO0Pin for PB1> { fn set_speed(self, speed: Speed) -> Self { self.set_speed(speed) } } -#[cfg(feature = "stm32l4x2")] +#[cfg(feature = "private_pac_stm32l4x2")] impl private::Sealed for PB2> {} -#[cfg(feature = "stm32l4x2")] +#[cfg(feature = "private_pac_stm32l4x2")] impl IO1Pin for PB2> { fn set_speed(self, speed: Speed) -> Self { self.set_speed(speed) } } -#[cfg(feature = "stm32l4x6")] +#[cfg(feature = "private_pac_stm32l4x6")] pins!( QUADSPI, AF10, diff --git a/src/rcc.rs b/src/rcc.rs index ae15582f..9fc0de39 100644 --- a/src/rcc.rs +++ b/src/rcc.rs @@ -256,13 +256,13 @@ impl APB1R1 { unsafe { &(*RCC::ptr()).apb1rstr1 } } - #[cfg(not(any(feature = "stm32l4x3", feature = "stm32l4x5")))] + #[cfg(not(any(feature = "private_pac_stm32l4x3", feature = "private_pac_stm32l4x5")))] pub(crate) fn enr2(&mut self) -> &rcc::APB1ENR2 { // NOTE(unsafe) this proxy grants exclusive access to this register unsafe { &(*RCC::ptr()).apb1enr2 } } - #[cfg(not(any(feature = "stm32l4x3", feature = "stm32l4x5")))] + #[cfg(not(any(feature = "private_pac_stm32l4x3", feature = "private_pac_stm32l4x5")))] pub(crate) fn rstr2(&mut self) -> &rcc::APB1RSTR2 { // NOTE(unsafe) this proxy grants exclusive access to this register unsafe { &(*RCC::ptr()).apb1rstr2 } diff --git a/src/serial.rs b/src/serial.rs index 8986eb61..20d8402f 100644 --- a/src/serial.rs +++ b/src/serial.rs @@ -21,7 +21,7 @@ use crate::pac; use crate::rcc::{Clocks, APB1R1, APB2}; use crate::time::{Bps, U32Ext}; -#[cfg(any(feature = "stm32l4x5", feature = "stm32l4x6",))] +#[cfg(any(feature = "private_pac_stm32l4x5", feature = "private_pac_stm32l4x6",))] use crate::dma::dma2; /// Interrupt event @@ -831,21 +831,21 @@ hal! { } #[cfg(any( - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6", ))] hal! { USART3: (usart3, APB1R1, usart3en, usart3rst, pclk1, tx: (TxDma3, c2s, dma1::C2), rx: (RxDma3, c3s, dma1::C3)), } -#[cfg(any(feature = "stm32l4x5", feature = "stm32l4x6",))] +#[cfg(any(feature = "private_pac_stm32l4x5", feature = "private_pac_stm32l4x6",))] hal! { UART4: (uart4, APB1R1, uart4en, uart4rst, pclk1, tx: (TxDma4, c3s, dma2::C3), rx: (RxDma4, c5s, dma2::C5)), } -#[cfg(any(feature = "stm32l4x5", feature = "stm32l4x6",))] +#[cfg(any(feature = "private_pac_stm32l4x5", feature = "private_pac_stm32l4x6",))] hal! { UART5: (uart5, APB1R1, uart5en, uart5rst, pclk1, tx: (TxDma5, c1s, dma2::C1), rx: (RxDma5, c2s, dma2::C2)), } @@ -975,10 +975,10 @@ impl_pin_traits! { } #[cfg(any( - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6", ))] impl_pin_traits! { USART3: { @@ -991,7 +991,7 @@ impl_pin_traits! { } } -#[cfg(any(feature = "stm32l4x5", feature = "stm32l4x6"))] +#[cfg(any(feature = "private_pac_stm32l4x5", feature = "private_pac_stm32l4x6"))] impl_pin_traits! { UART4: { AF8: { diff --git a/src/spi.rs b/src/spi.rs index 6b6b18f0..e7a98f35 100644 --- a/src/spi.rs +++ b/src/spi.rs @@ -269,102 +269,102 @@ macro_rules! hal { } #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6", + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6", ))] use crate::gpio::gpiod::*; -#[cfg(any(feature = "stm32l4x5", feature = "stm32l4x6"))] +#[cfg(any(feature = "private_pac_stm32l4x5", feature = "private_pac_stm32l4x6"))] use crate::gpio::gpiog::*; use crate::gpio::{gpioa::*, gpiob::*, gpioc::*, gpioe::*}; use crate::stm32::SPI1; #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6" + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6" ))] hal! { SPI1: (spi1, spi1_slave, APB2, spi1en, spi1rst, pclk2), } #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6" + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6" ))] pins!(SPI1, AF5, SCK: [PA5, PB3, PE13], MISO: [PA6, PB4, PE14], MOSI: [PA7, PB5, PE15]); -#[cfg(any(feature = "stm32l4x5", feature = "stm32l4x6"))] +#[cfg(any(feature = "private_pac_stm32l4x5", feature = "private_pac_stm32l4x6"))] pins!(SPI1, AF5, SCK: [PG2], MISO: [PG3], MOSI: [PG4]); #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x5", - feature = "stm32l4x6", + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6", ))] use crate::{gpio::AF6, stm32::SPI3}; #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x5", - feature = "stm32l4x6", + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6", ))] hal! { SPI3: (spi3, spi3_slave, APB1R1, spi3en, spi3rst, pclk1), } #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x5", - feature = "stm32l4x6", + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6", ))] pins!(SPI3, AF6, SCK: [PB3, PC10], MISO: [PB4, PC11], MOSI: [PB5, PC12]); -#[cfg(any(feature = "stm32l4x5", feature = "stm32l4x6",))] +#[cfg(any(feature = "private_pac_stm32l4x5", feature = "private_pac_stm32l4x6",))] pins!(SPI3, AF6, SCK: [PG9], MISO: [PG10], MOSI: [PG11]); #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6", + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6", ))] use crate::stm32::SPI2; #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6", + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6", ))] hal! { SPI2: (spi2, spi2_slave, APB1R1, spi2en, spi2rst, pclk1), } #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6", + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6", ))] pins!(SPI2, AF5, SCK: [PB13, PB10, PD1], @@ -779,17 +779,17 @@ macro_rules! spi_dma { spi_dma!(SPI1, dma1::C2, c2s, map1, dma1::C3, c3s, map1); #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "stm32l4x6", + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x3", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6", ))] spi_dma!(SPI2, dma1::C4, c4s, map1, dma1::C5, c5s, map1); // spi_dma!(SPI1, dma2::C3, c3s, map4, dma2::C4, c4s, map4); #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x5", - feature = "stm32l4x6", + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x5", + feature = "private_pac_stm32l4x6", ))] spi_dma!(SPI3, dma2::C1, c1s, map3, dma2::C2, c2s, map3); diff --git a/src/timer.rs b/src/timer.rs index a3d5e3f3..7bea75de 100644 --- a/src/timer.rs +++ b/src/timer.rs @@ -2,7 +2,7 @@ use crate::hal::timer::{CountDown, Periodic}; use crate::stm32::{TIM15, TIM16, TIM2, TIM6, TIM7}; -#[cfg(any(feature = "stm32l4x5", feature = "stm32l4x6",))] +#[cfg(any(feature = "private_pac_stm32l4x5", feature = "private_pac_stm32l4x6",))] use crate::stm32::{TIM17, TIM4, TIM5}; use cast::{u16, u32}; use void::Void; @@ -219,7 +219,7 @@ hal! { TIM16: (tim16, free_running_tim16, tim16en, tim16rst, APB2, u16), } -#[cfg(any(feature = "stm32l4x5", feature = "stm32l4x6",))] +#[cfg(any(feature = "private_pac_stm32l4x5", feature = "private_pac_stm32l4x6",))] hal! { TIM4: (tim4, free_running_tim4, tim4en, tim4rst, APB1R1, u16), TIM5: (tim5, free_running_tim5, tim5en, tim5rst, APB1R1, u32), diff --git a/src/watchdog.rs b/src/watchdog.rs index af9df25f..faaf58cd 100644 --- a/src/watchdog.rs +++ b/src/watchdog.rs @@ -27,9 +27,13 @@ impl IndependentWatchdog { /// Debug independent watchdog stopped when core is halted pub fn stop_on_debug(&self, dbgmcu: &DBGMCU, stop: bool) { - #[cfg(any(feature = "stm32l4x1", feature = "stm32l4x2", feature = "stm32l4x3",))] + #[cfg(any( + feature = "private_pac_stm32l4x1", + feature = "private_pac_stm32l4x2", + feature = "private_pac_stm32l4x3", + ))] dbgmcu.apb1fzr1.modify(|_, w| w.dbg_iwdg_stop().bit(stop)); - #[cfg(any(feature = "stm32l4x5", feature = "stm32l4x6"))] + #[cfg(any(feature = "private_pac_stm32l4x5", feature = "private_pac_stm32l4x6"))] dbgmcu.apb1_fzr1.modify(|_, w| w.dbg_iwdg_stop().bit(stop)); } From bd35469ed14b204e6ba05b86603764ae8d012edd Mon Sep 17 00:00:00 2001 From: JC <8765278+Crzyrndm@users.noreply.github.com> Date: Sat, 16 Oct 2021 12:51:38 +1300 Subject: [PATCH 02/12] add new per device in L4/L4+ series --- Cargo.toml | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 9069847a..dca8792e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -69,6 +69,47 @@ private_pac_stm32l4x6 = ["stm32l4/stm32l4x6"] unproven = ["embedded-hal/unproven"] otg_fs = ["synopsys-usb-otg"] +# L4x1 +stm32l431 = [ "private_pac_stm32l4x1" ] +stm32l451 = [ "private_pac_stm32l4x1" ] +stm32l471 = [ "private_pac_stm32l4x1" ] + +# L4x2 +stm32l412 = [ "private_pac_stm32l4x2" ] +stm32l422 = [ "private_pac_stm32l4x2" ] +stm32l432 = [ "private_pac_stm32l4x2" ] +stm32l442 = [ "private_pac_stm32l4x2" ] +stm32l452 = [ "private_pac_stm32l4x2" ] +stm32l462 = [ "private_pac_stm32l4x2" ] + +# L4x3 +stm32l433 = [ "private_pac_stm32l4x3" ] +stm32l443 = [ "private_pac_stm32l4x3" ] + +# L4x5 +stm32l475 = [ "private_pac_stm32l4x5" ] +# L4+ series? Need to check if PAC supports +stm32l4p5 = [ "private_pac_stm32l4x5" ] +stm32l4q5 = [ "private_pac_stm32l4x5" ] +stm32l4r5 = [ "private_pac_stm32l4x5" ] +stm32l4s5 = [ "private_pac_stm32l4x5" ] + +# L4x6 +stm32l476 = [ "private_pac_stm32l4x6" ] +stm32l486 = [ "private_pac_stm32l4x6" ] +stm32l496 = [ "private_pac_stm32l4x6" ] +stm32l4A6 = [ "private_pac_stm32l4x6" ] + +# L4x7 +# L4+ series? Need to check if PAC supports +stm32l4r7 = [ "private_pac_stm32l4x7" ] +stm32l4s7 = [ "private_pac_stm32l4x7" ] + +# L4x9 +# L4+ series? Need to check if PAC supports +stm32l4r9 = [ "private_pac_stm32l4x9" ] +stm32l4s9 = [ "private_pac_stm32l4x9" ] + [dev-dependencies] panic-halt = "0.2.0" panic-semihosting = "0.5.0" From e27615644f3ca00e177efac6be7c5d51219fd76a Mon Sep 17 00:00:00 2001 From: JC <8765278+Crzyrndm@users.noreply.github.com> Date: Sat, 16 Oct 2021 13:22:41 +1300 Subject: [PATCH 03/12] add features for the peripheral set (L4x) --- Cargo.toml | 71 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 45 insertions(+), 26 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index dca8792e..2d6f5296 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -61,54 +61,73 @@ features = ["rt", "stm32l4x2", "stm32-usbd"] [features] rt = ["stm32l4/rt"] +unproven = ["embedded-hal/unproven"] +otg_fs = ["synopsys-usb-otg"] + +# private features are for internal use only +# L4 PAC is currently feature gated on the stm32L4 line private_pac_stm32l4x1 = ["stm32l4/stm32l4x1"] private_pac_stm32l4x2 = ["stm32l4/stm32l4x2"] private_pac_stm32l4x3 = ["stm32l4/stm32l4x3"] private_pac_stm32l4x5 = ["stm32l4/stm32l4x5"] private_pac_stm32l4x6 = ["stm32l4/stm32l4x6"] -unproven = ["embedded-hal/unproven"] -otg_fs = ["synopsys-usb-otg"] + +# Devices can also be grouped by peripheral set +private_product_L41_L42 = [] +private_product_L43_L44 = [] +private_product_L45_L46 = [] +private_product_L47_L48 = [] +private_product_L49_L4A = [] +# L4+ products +private_product_L4P_L4Q = [] +private_product_L4R_L4S = [] + +# AES is available only for L4A, L48, L46, L44, L42 +# these devices are otherwise identical the the odd numbered pair +private_aes = [] +# Sha-256 is only present on L4A and the L4+ parts with AES capability +private_sha256 = [] # L4x1 -stm32l431 = [ "private_pac_stm32l4x1" ] -stm32l451 = [ "private_pac_stm32l4x1" ] -stm32l471 = [ "private_pac_stm32l4x1" ] +stm32l431 = [ "private_pac_stm32l4x1", "private_product_L43_L44" ] +stm32l451 = [ "private_pac_stm32l4x1", "private_product_L45_L46" ] +stm32l471 = [ "private_pac_stm32l4x1", "private_product_L47_L48" ] # L4x2 -stm32l412 = [ "private_pac_stm32l4x2" ] -stm32l422 = [ "private_pac_stm32l4x2" ] -stm32l432 = [ "private_pac_stm32l4x2" ] -stm32l442 = [ "private_pac_stm32l4x2" ] -stm32l452 = [ "private_pac_stm32l4x2" ] -stm32l462 = [ "private_pac_stm32l4x2" ] +stm32l412 = [ "private_pac_stm32l4x2", "private_product_L41_L42" ] +stm32l422 = [ "private_pac_stm32l4x2", "private_product_L41_L42", "private_aes" ] +stm32l432 = [ "private_pac_stm32l4x2", "private_product_L43_L44" ] +stm32l442 = [ "private_pac_stm32l4x2", "private_product_L43_L44", "private_aes" ] +stm32l452 = [ "private_pac_stm32l4x2", "private_product_L45_L46" ] +stm32l462 = [ "private_pac_stm32l4x2", "private_product_L45_L46", "private_aes" ] # L4x3 -stm32l433 = [ "private_pac_stm32l4x3" ] -stm32l443 = [ "private_pac_stm32l4x3" ] +stm32l433 = [ "private_pac_stm32l4x3", "private_product_L43_L44" ] +stm32l443 = [ "private_pac_stm32l4x3", "private_product_L43_L44" ] # L4x5 -stm32l475 = [ "private_pac_stm32l4x5" ] +stm32l475 = [ "private_pac_stm32l4x5", "private_product_L47_L48" ] # L4+ series? Need to check if PAC supports -stm32l4p5 = [ "private_pac_stm32l4x5" ] -stm32l4q5 = [ "private_pac_stm32l4x5" ] -stm32l4r5 = [ "private_pac_stm32l4x5" ] -stm32l4s5 = [ "private_pac_stm32l4x5" ] +stm32l4p5 = [ "private_pac_stm32l4x5", "private_product_L4P_L4Q" ] +stm32l4q5 = [ "private_pac_stm32l4x5", "private_product_L4P_L4Q", "private_aes", "private_sha256" ] +stm32l4r5 = [ "private_pac_stm32l4x5", "private_product_L4R_L4S" ] +stm32l4s5 = [ "private_pac_stm32l4x5", "private_product_L4R_L4S", "private_aes", "private_sha256" ] # L4x6 -stm32l476 = [ "private_pac_stm32l4x6" ] -stm32l486 = [ "private_pac_stm32l4x6" ] -stm32l496 = [ "private_pac_stm32l4x6" ] -stm32l4A6 = [ "private_pac_stm32l4x6" ] +stm32l476 = [ "private_pac_stm32l4x6", "private_product_L47_L48" ] +stm32l486 = [ "private_pac_stm32l4x6", "private_product_L47_L48" ] +stm32l496 = [ "private_pac_stm32l4x6", "private_product_L49_L4A" ] +stm32l4A6 = [ "private_pac_stm32l4x6", "private_product_L49_L4A", "private_aes", "private_sha256" ] # L4x7 # L4+ series? Need to check if PAC supports -stm32l4r7 = [ "private_pac_stm32l4x7" ] -stm32l4s7 = [ "private_pac_stm32l4x7" ] +stm32l4r7 = [ "private_pac_stm32l4x7", "private_product_L4R_L4S" ] +stm32l4s7 = [ "private_pac_stm32l4x7", "private_product_L4R_L4S", "private_aes", "private_sha256" ] # L4x9 # L4+ series? Need to check if PAC supports -stm32l4r9 = [ "private_pac_stm32l4x9" ] -stm32l4s9 = [ "private_pac_stm32l4x9" ] +stm32l4r9 = [ "private_pac_stm32l4x9", "private_product_L4R_L4S" ] +stm32l4s9 = [ "private_pac_stm32l4x9", "private_product_L4R_L4S", "private_aes", "private_sha256" ] [dev-dependencies] panic-halt = "0.2.0" From bf11a1a9e8ebc4ccd6014f6db703ee6e8d498d5b Mon Sep 17 00:00:00 2001 From: JC <8765278+Crzyrndm@users.noreply.github.com> Date: Sat, 16 Oct 2021 13:23:42 +1300 Subject: [PATCH 04/12] add the missing L4+ line features --- Cargo.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 2d6f5296..c61435e8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -71,6 +71,8 @@ private_pac_stm32l4x2 = ["stm32l4/stm32l4x2"] private_pac_stm32l4x3 = ["stm32l4/stm32l4x3"] private_pac_stm32l4x5 = ["stm32l4/stm32l4x5"] private_pac_stm32l4x6 = ["stm32l4/stm32l4x6"] +private_pac_stm32l4x7 = [] +private_pac_stm32l4x9 = [] # Devices can also be grouped by peripheral set private_product_L41_L42 = [] From 07c3966bce09f13b35a6906a7747a9d9a0053a2b Mon Sep 17 00:00:00 2001 From: JC <8765278+Crzyrndm@users.noreply.github.com> Date: Sat, 16 Oct 2021 13:28:50 +1300 Subject: [PATCH 05/12] update device feature selection for docs and examples --- Cargo.toml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c61435e8..9b943a63 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,7 +57,7 @@ features = ["cortex-m", "fs"] optional = true [package.metadata.docs.rs] -features = ["rt", "stm32l4x2", "stm32-usbd"] +features = ["rt", "stm32l432", "stm32-usbd"] [features] rt = ["stm32l4/rt"] @@ -165,11 +165,11 @@ lto = true [[example]] name = "adc" -required-features = ["rt", "stm32l4x3"] +required-features = ["rt", "private_pac_stm32l4x3"] [[example]] name = "can-loopback" -required-features = ["rt", "stm32l4x1"] +required-features = ["rt", "private_pac_stm32l4x1"] [[example]] name = "irq_button" @@ -177,7 +177,7 @@ required-features = ["rt"] [[example]] name = "qspi" -required-features = ["rt", "stm32l4x5"] +required-features = ["rt", "private_pac_stm32l4x5"] [[example]] name = "rng" @@ -189,15 +189,15 @@ required-features = ["rt"] [[example]] name = "rtic_frame_serial_dma" -required-features = ["rt", "stm32l4x2"] +required-features = ["rt", "private_pac_stm32l4x2"] [[example]] name = "spi_dma_rxtx" -required-features = ["rt", "stm32l4x2"] +required-features = ["rt", "private_pac_stm32l4x2"] [[example]] name = "serial_echo_rtic" -required-features = ["rt", "stm32l4x3"] +required-features = ["rt", "private_pac_stm32l4x3"] [[example]] name = "timer" @@ -205,20 +205,20 @@ required-features = ["rt"] [[example]] name = "usb_serial" -required-features = ["rt", "stm32l4x2", "stm32-usbd"] +required-features = ["rt", "private_pac_stm32l4x2", "stm32-usbd"] [[example]] name = "otg_fs_serial" -required-features = ["rt", "stm32l4x6", "otg_fs"] +required-features = ["rt", "private_pac_stm32l4x6", "otg_fs"] [[example]] name = "i2c_write" -required-features = ["stm32l4x1"] +required-features = ["private_pac_stm32l4x1"] [[example]] name = "lptim_rtic" -required-features = ["rt", "stm32l4x2"] +required-features = ["rt", "private_pac_stm32l4x2"] [[example]] name = "adc_dma" -required-features = ["rt", "stm32l4x1"] +required-features = ["rt", "private_pac_stm32l4x1"] From 128bf25ae522798d4e8c661016a9cb13dfbf3ed1 Mon Sep 17 00:00:00 2001 From: JC <8765278+Crzyrndm@users.noreply.github.com> Date: Sat, 16 Oct 2021 13:40:14 +1300 Subject: [PATCH 06/12] comment out the L4+ public features as. PAC support is unknown --- Cargo.toml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9b943a63..9d9959b4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -74,7 +74,7 @@ private_pac_stm32l4x6 = ["stm32l4/stm32l4x6"] private_pac_stm32l4x7 = [] private_pac_stm32l4x9 = [] -# Devices can also be grouped by peripheral set +# Devices can also be grouped by peripheral set (PAC may need similar features?) private_product_L41_L42 = [] private_product_L43_L44 = [] private_product_L45_L46 = [] @@ -84,10 +84,10 @@ private_product_L49_L4A = [] private_product_L4P_L4Q = [] private_product_L4R_L4S = [] -# AES is available only for L4A, L48, L46, L44, L42 +# AES is available only for L4(A/8/6/4/2) and L4+(Q/S) # these devices are otherwise identical the the odd numbered pair private_aes = [] -# Sha-256 is only present on L4A and the L4+ parts with AES capability +# SHA-256 is only present on L4A and the L4+(Q/S) private_sha256 = [] # L4x1 @@ -109,11 +109,11 @@ stm32l443 = [ "private_pac_stm32l4x3", "private_product_L43_L44" ] # L4x5 stm32l475 = [ "private_pac_stm32l4x5", "private_product_L47_L48" ] -# L4+ series? Need to check if PAC supports -stm32l4p5 = [ "private_pac_stm32l4x5", "private_product_L4P_L4Q" ] -stm32l4q5 = [ "private_pac_stm32l4x5", "private_product_L4P_L4Q", "private_aes", "private_sha256" ] -stm32l4r5 = [ "private_pac_stm32l4x5", "private_product_L4R_L4S" ] -stm32l4s5 = [ "private_pac_stm32l4x5", "private_product_L4R_L4S", "private_aes", "private_sha256" ] +## L4+ series? PAC doesn't currently support? +#stm32l4p5 = [ "private_pac_stm32l4x5", "private_product_L4P_L4Q" ] +#stm32l4q5 = [ "private_pac_stm32l4x5", "private_product_L4P_L4Q", "private_aes", "private_sha256" ] +#stm32l4r5 = [ "private_pac_stm32l4x5", "private_product_L4R_L4S" ] +#stm32l4s5 = [ "private_pac_stm32l4x5", "private_product_L4R_L4S", "private_aes", "private_sha256" ] # L4x6 stm32l476 = [ "private_pac_stm32l4x6", "private_product_L47_L48" ] @@ -121,15 +121,15 @@ stm32l486 = [ "private_pac_stm32l4x6", "private_product_L47_L48" ] stm32l496 = [ "private_pac_stm32l4x6", "private_product_L49_L4A" ] stm32l4A6 = [ "private_pac_stm32l4x6", "private_product_L49_L4A", "private_aes", "private_sha256" ] -# L4x7 -# L4+ series? Need to check if PAC supports -stm32l4r7 = [ "private_pac_stm32l4x7", "private_product_L4R_L4S" ] -stm32l4s7 = [ "private_pac_stm32l4x7", "private_product_L4R_L4S", "private_aes", "private_sha256" ] +## L4x7 +## L4+ series? PAC doesn't currently support? +#stm32l4r7 = [ "private_pac_stm32l4x7", "private_product_L4R_L4S" ] +#stm32l4s7 = [ "private_pac_stm32l4x7", "private_product_L4R_L4S", "private_aes", "private_sha256" ] -# L4x9 -# L4+ series? Need to check if PAC supports -stm32l4r9 = [ "private_pac_stm32l4x9", "private_product_L4R_L4S" ] -stm32l4s9 = [ "private_pac_stm32l4x9", "private_product_L4R_L4S", "private_aes", "private_sha256" ] +## L4x9 +## L4+ series? PAC doesn't currently support? +#stm32l4r9 = [ "private_pac_stm32l4x9", "private_product_L4R_L4S" ] +#stm32l4s9 = [ "private_pac_stm32l4x9", "private_product_L4R_L4S", "private_aes", "private_sha256" ] [dev-dependencies] panic-halt = "0.2.0" From db2763bfe03e2dca9802d7396d3697fd989fb6b7 Mon Sep 17 00:00:00 2001 From: JC <8765278+Crzyrndm@users.noreply.github.com> Date: Sat, 16 Oct 2021 14:26:28 +1300 Subject: [PATCH 07/12] CI running on specific devices --- .github/workflows/ci.yml | 10 +++++----- .github/workflows/clippy.yml | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bcd0bd30..1041cbcd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,11 +13,11 @@ jobs: rust: - stable mcu: - - stm32l4x1 - - stm32l4x2 - - stm32l4x3 - - stm32l4x5 - - stm32l4x6 + - stm32l451 + - stm32l432 + - stm32l433 + - stm32l475 + - stm32l476 steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index 52cb0177..73525fab 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -1,6 +1,6 @@ on: push: - branches: [ master ] + branches: [master] pull_request: name: Clippy check @@ -19,4 +19,4 @@ jobs: - uses: actions-rs/clippy-check@v1 with: token: ${{ secrets.GITHUB_TOKEN }} - args: --examples --target thumbv7em-none-eabihf --features=stm32l4x2,rt,unproven + args: --examples --target thumbv7em-none-eabihf --features=stm32l432,rt,unproven From b2abfcb7e6710c5d73acbabb0d420effd41d4d30 Mon Sep 17 00:00:00 2001 From: JC <8765278+Crzyrndm@users.noreply.github.com> Date: Sat, 16 Oct 2021 15:54:23 +1300 Subject: [PATCH 08/12] update the feature check to look at specific devices --- src/lib.rs | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index fa85ebd2..99354505 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,13 +11,24 @@ #![no_std] #[cfg(not(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6", + feature = "stm32l431", + feature = "stm32l451", + feature = "stm32l471", + feature = "stm32l412", + feature = "stm32l422", + feature = "stm32l432", + feature = "stm32l442", + feature = "stm32l452", + feature = "stm32l462", + feature = "stm32l433", + feature = "stm32l443", + feature = "stm32l475", + feature = "stm32l476", + feature = "stm32l486", + feature = "stm32l496", + feature = "stm32l4A6", )))] -compile_error!("This crate requires one of the following features enabled: stm32l4x1, stm32l4x2, stm32l4x3, stm32l4x4, stm32l4x5 or stm32l4x6"); +compile_error!("This crate requires one of the following features enabled: stm32l431, stm32l451, stm32l471, stm32l412, stm32l422, stm32l432, stm32l442, stm32l452, stm32l462, stm32l433, stm32l443, stm32l475, stm32l476, stm32l486, stm32l496, stm32l4A6, "); pub use embedded_hal as hal; From 1761972643618ef7ae74155b4a0e24ffb73a7714 Mon Sep 17 00:00:00 2001 From: JC <8765278+Crzyrndm@users.noreply.github.com> Date: Sun, 17 Oct 2021 14:04:11 +1300 Subject: [PATCH 09/12] uncomment L4+ features, use closest PAC feature --- Cargo.toml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9d9959b4..c887e1fe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -71,8 +71,8 @@ private_pac_stm32l4x2 = ["stm32l4/stm32l4x2"] private_pac_stm32l4x3 = ["stm32l4/stm32l4x3"] private_pac_stm32l4x5 = ["stm32l4/stm32l4x5"] private_pac_stm32l4x6 = ["stm32l4/stm32l4x6"] -private_pac_stm32l4x7 = [] -private_pac_stm32l4x9 = [] +private_pac_stm32l4x7 = ["stm32l4/stm32l4x5"] # NOTE: x5 not x7 +private_pac_stm32l4x9 = ["stm32l4/stm32l4r9"] # NOTE: r9 no x9 # Devices can also be grouped by peripheral set (PAC may need similar features?) private_product_L41_L42 = [] @@ -109,11 +109,11 @@ stm32l443 = [ "private_pac_stm32l4x3", "private_product_L43_L44" ] # L4x5 stm32l475 = [ "private_pac_stm32l4x5", "private_product_L47_L48" ] -## L4+ series? PAC doesn't currently support? -#stm32l4p5 = [ "private_pac_stm32l4x5", "private_product_L4P_L4Q" ] -#stm32l4q5 = [ "private_pac_stm32l4x5", "private_product_L4P_L4Q", "private_aes", "private_sha256" ] -#stm32l4r5 = [ "private_pac_stm32l4x5", "private_product_L4R_L4S" ] -#stm32l4s5 = [ "private_pac_stm32l4x5", "private_product_L4R_L4S", "private_aes", "private_sha256" ] +# L4+ series PAC support?? +stm32l4p5 = [ "private_pac_stm32l4x5", "private_product_L4P_L4Q" ] +stm32l4q5 = [ "private_pac_stm32l4x5", "private_product_L4P_L4Q", "private_aes", "private_sha256" ] +stm32l4r5 = [ "private_pac_stm32l4x5", "private_product_L4R_L4S" ] +stm32l4s5 = [ "private_pac_stm32l4x5", "private_product_L4R_L4S", "private_aes", "private_sha256" ] # L4x6 stm32l476 = [ "private_pac_stm32l4x6", "private_product_L47_L48" ] @@ -121,15 +121,15 @@ stm32l486 = [ "private_pac_stm32l4x6", "private_product_L47_L48" ] stm32l496 = [ "private_pac_stm32l4x6", "private_product_L49_L4A" ] stm32l4A6 = [ "private_pac_stm32l4x6", "private_product_L49_L4A", "private_aes", "private_sha256" ] -## L4x7 -## L4+ series? PAC doesn't currently support? -#stm32l4r7 = [ "private_pac_stm32l4x7", "private_product_L4R_L4S" ] -#stm32l4s7 = [ "private_pac_stm32l4x7", "private_product_L4R_L4S", "private_aes", "private_sha256" ] +# L4x7 +# L4+ series PAC support?? +stm32l4r7 = [ "private_pac_stm32l4x7", "private_product_L4R_L4S" ] +stm32l4s7 = [ "private_pac_stm32l4x7", "private_product_L4R_L4S", "private_aes", "private_sha256" ] ## L4x9 -## L4+ series? PAC doesn't currently support? -#stm32l4r9 = [ "private_pac_stm32l4x9", "private_product_L4R_L4S" ] -#stm32l4s9 = [ "private_pac_stm32l4x9", "private_product_L4R_L4S", "private_aes", "private_sha256" ] +# L4+ series PAC support?? +stm32l4r9 = [ "private_pac_stm32l4x9", "private_product_L4R_L4S" ] +stm32l4s9 = [ "private_pac_stm32l4x9", "private_product_L4R_L4S", "private_aes", "private_sha256" ] [dev-dependencies] panic-halt = "0.2.0" From 6629a7282f8e883c03bd51da05503b9d81102bde Mon Sep 17 00:00:00 2001 From: JC <8765278+Crzyrndm@users.noreply.github.com> Date: Sun, 17 Oct 2021 14:41:11 +1300 Subject: [PATCH 10/12] private features now don't activate dependency features This allows for PAC specialisation (like is done for L412 and L4r9) AND grouping in source. The `generic_pac_*` features now enable both the private and dependency features --- .github/workflows/ci.yml | 10 +- Cargo.toml | 97 +++++++------ src/can.rs | 2 +- src/gpio.rs | 4 +- src/i2c.rs | 22 +-- src/lib.rs | 284 +++++++++++++++++++++------------------ src/qspi.rs | 48 +++---- src/rcc.rs | 4 +- src/serial.rs | 24 ++-- src/spi.rs | 106 +++++++-------- src/timer.rs | 4 +- src/watchdog.rs | 8 +- 12 files changed, 325 insertions(+), 288 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1041cbcd..ce57d481 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,11 +13,11 @@ jobs: rust: - stable mcu: - - stm32l451 - - stm32l432 - - stm32l433 - - stm32l475 - - stm32l476 + - generic_pac_stm32l4x1 + - generic_pac_stm32l4x2 + - generic_pac_stm32l4x3 + - generic_pac_stm32l4x5 + - generic_pac_stm32l4x6 steps: - uses: actions/checkout@v2 diff --git a/Cargo.toml b/Cargo.toml index c887e1fe..c806eff9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -65,14 +65,13 @@ unproven = ["embedded-hal/unproven"] otg_fs = ["synopsys-usb-otg"] # private features are for internal use only -# L4 PAC is currently feature gated on the stm32L4 line -private_pac_stm32l4x1 = ["stm32l4/stm32l4x1"] -private_pac_stm32l4x2 = ["stm32l4/stm32l4x2"] -private_pac_stm32l4x3 = ["stm32l4/stm32l4x3"] -private_pac_stm32l4x5 = ["stm32l4/stm32l4x5"] -private_pac_stm32l4x6 = ["stm32l4/stm32l4x6"] -private_pac_stm32l4x7 = ["stm32l4/stm32l4x5"] # NOTE: x5 not x7 -private_pac_stm32l4x9 = ["stm32l4/stm32l4r9"] # NOTE: r9 no x9 +private_line_stm32l4x1 = [] +private_line_stm32l4x2 = [] +private_line_stm32l4x3 = [] +private_line_stm32l4x5 = [] +private_line_stm32l4x6 = [] +private_line_stm32l4x7 = [] +private_line_stm32l4x9 = [] # Devices can also be grouped by peripheral set (PAC may need similar features?) private_product_L41_L42 = [] @@ -87,49 +86,59 @@ private_product_L4R_L4S = [] # AES is available only for L4(A/8/6/4/2) and L4+(Q/S) # these devices are otherwise identical the the odd numbered pair private_aes = [] -# SHA-256 is only present on L4A and the L4+(Q/S) +# SHA-256 is only present on L4(A) and the L4+(Q/S) private_sha256 = [] +# generics are used by dependants that don't want to specify a specific MCU +# Also used by specific MCU geatures as shorthand for the private and PAC features +generic_pac_stm32l4x1 = ["private_line_stm32l4x1", "stm32l4/stm32l4x1"] +generic_pac_stm32l4x2 = ["private_line_stm32l4x2", "stm32l4/stm32l4x2"] +generic_pac_stm32l4x3 = ["private_line_stm32l4x3", "stm32l4/stm32l4x3"] +generic_pac_stm32l4x5 = ["private_line_stm32l4x5", "stm32l4/stm32l4x5"] +generic_pac_stm32l4x6 = ["private_line_stm32l4x6", "stm32l4/stm32l4x6"] +generic_pac_stm32l4x7 = ["private_line_stm32l4x7", "stm32l4/stm32l4x5"] # NOTE: x5 not x7 +generic_pac_stm32l4x9 = ["private_line_stm32l4x9", "stm32l4/stm32l4r9"] # NOTE: r9 no x9 + # L4x1 -stm32l431 = [ "private_pac_stm32l4x1", "private_product_L43_L44" ] -stm32l451 = [ "private_pac_stm32l4x1", "private_product_L45_L46" ] -stm32l471 = [ "private_pac_stm32l4x1", "private_product_L47_L48" ] +stm32l431 = [ "generic_pac_stm32l4x1", "private_product_L43_L44" ] +stm32l451 = [ "generic_pac_stm32l4x1", "private_product_L45_L46" ] +stm32l471 = [ "generic_pac_stm32l4x1", "private_product_L47_L48" ] # L4x2 -stm32l412 = [ "private_pac_stm32l4x2", "private_product_L41_L42" ] -stm32l422 = [ "private_pac_stm32l4x2", "private_product_L41_L42", "private_aes" ] -stm32l432 = [ "private_pac_stm32l4x2", "private_product_L43_L44" ] -stm32l442 = [ "private_pac_stm32l4x2", "private_product_L43_L44", "private_aes" ] -stm32l452 = [ "private_pac_stm32l4x2", "private_product_L45_L46" ] -stm32l462 = [ "private_pac_stm32l4x2", "private_product_L45_L46", "private_aes" ] +stm32l412 = [ "private_line_stm32l4x2", "stm32l4/stm32l412", "private_product_L41_L42" ] # PAC has a L412 specific variation +stm32l422 = [ "generic_pac_stm32l4x2", "private_product_L41_L42", "private_aes" ] +stm32l432 = [ "generic_pac_stm32l4x2", "private_product_L43_L44" ] +stm32l442 = [ "generic_pac_stm32l4x2", "private_product_L43_L44", "private_aes" ] +stm32l452 = [ "generic_pac_stm32l4x2", "private_product_L45_L46" ] +stm32l462 = [ "generic_pac_stm32l4x2", "private_product_L45_L46", "private_aes" ] # L4x3 -stm32l433 = [ "private_pac_stm32l4x3", "private_product_L43_L44" ] -stm32l443 = [ "private_pac_stm32l4x3", "private_product_L43_L44" ] +stm32l433 = [ "generic_pac_stm32l4x3", "private_product_L43_L44" ] +stm32l443 = [ "generic_pac_stm32l4x3", "private_product_L43_L44" ] # L4x5 -stm32l475 = [ "private_pac_stm32l4x5", "private_product_L47_L48" ] +stm32l475 = [ "generic_pac_stm32l4x5", "private_product_L47_L48" ] # L4+ series PAC support?? -stm32l4p5 = [ "private_pac_stm32l4x5", "private_product_L4P_L4Q" ] -stm32l4q5 = [ "private_pac_stm32l4x5", "private_product_L4P_L4Q", "private_aes", "private_sha256" ] -stm32l4r5 = [ "private_pac_stm32l4x5", "private_product_L4R_L4S" ] -stm32l4s5 = [ "private_pac_stm32l4x5", "private_product_L4R_L4S", "private_aes", "private_sha256" ] +stm32l4p5 = [ "generic_pac_stm32l4x5", "private_product_L4P_L4Q" ] +stm32l4q5 = [ "generic_pac_stm32l4x5", "private_product_L4P_L4Q", "private_aes", "private_sha256" ] +stm32l4r5 = [ "generic_pac_stm32l4x5", "private_product_L4R_L4S" ] +stm32l4s5 = [ "generic_pac_stm32l4x5", "private_product_L4R_L4S", "private_aes", "private_sha256" ] # L4x6 -stm32l476 = [ "private_pac_stm32l4x6", "private_product_L47_L48" ] -stm32l486 = [ "private_pac_stm32l4x6", "private_product_L47_L48" ] -stm32l496 = [ "private_pac_stm32l4x6", "private_product_L49_L4A" ] -stm32l4A6 = [ "private_pac_stm32l4x6", "private_product_L49_L4A", "private_aes", "private_sha256" ] +stm32l476 = [ "generic_pac_stm32l4x6", "private_product_L47_L48" ] +stm32l486 = [ "generic_pac_stm32l4x6", "private_product_L47_L48" ] +stm32l496 = [ "generic_pac_stm32l4x6", "private_product_L49_L4A" ] +stm32l4A6 = [ "generic_pac_stm32l4x6", "private_product_L49_L4A", "private_aes", "private_sha256" ] # L4x7 # L4+ series PAC support?? -stm32l4r7 = [ "private_pac_stm32l4x7", "private_product_L4R_L4S" ] -stm32l4s7 = [ "private_pac_stm32l4x7", "private_product_L4R_L4S", "private_aes", "private_sha256" ] +stm32l4r7 = [ "generic_pac_stm32l4x7", "private_product_L4R_L4S" ] +stm32l4s7 = [ "generic_pac_stm32l4x7", "private_product_L4R_L4S", "private_aes", "private_sha256" ] ## L4x9 # L4+ series PAC support?? -stm32l4r9 = [ "private_pac_stm32l4x9", "private_product_L4R_L4S" ] -stm32l4s9 = [ "private_pac_stm32l4x9", "private_product_L4R_L4S", "private_aes", "private_sha256" ] +stm32l4r9 = [ "private_line_stm32l4x9", "stm32l4/stm32l4r9", "private_product_L4R_L4S" ] # PAC has an L4r9 specific variation +stm32l4s9 = [ "generic_pac_stm32l4x9", "private_product_L4R_L4S", "private_aes", "private_sha256" ] [dev-dependencies] panic-halt = "0.2.0" @@ -165,11 +174,11 @@ lto = true [[example]] name = "adc" -required-features = ["rt", "private_pac_stm32l4x3"] +required-features = ["rt", "private_line_stm32l4x3"] [[example]] name = "can-loopback" -required-features = ["rt", "private_pac_stm32l4x1"] +required-features = ["rt", "private_line_stm32l4x1"] [[example]] name = "irq_button" @@ -177,7 +186,7 @@ required-features = ["rt"] [[example]] name = "qspi" -required-features = ["rt", "private_pac_stm32l4x5"] +required-features = ["rt", "private_line_stm32l4x5"] [[example]] name = "rng" @@ -189,15 +198,15 @@ required-features = ["rt"] [[example]] name = "rtic_frame_serial_dma" -required-features = ["rt", "private_pac_stm32l4x2"] +required-features = ["rt", "private_line_stm32l4x2"] [[example]] name = "spi_dma_rxtx" -required-features = ["rt", "private_pac_stm32l4x2"] +required-features = ["rt", "private_line_stm32l4x2"] [[example]] name = "serial_echo_rtic" -required-features = ["rt", "private_pac_stm32l4x3"] +required-features = ["rt", "private_line_stm32l4x3"] [[example]] name = "timer" @@ -205,20 +214,20 @@ required-features = ["rt"] [[example]] name = "usb_serial" -required-features = ["rt", "private_pac_stm32l4x2", "stm32-usbd"] +required-features = ["rt", "private_line_stm32l4x2", "stm32-usbd"] [[example]] name = "otg_fs_serial" -required-features = ["rt", "private_pac_stm32l4x6", "otg_fs"] +required-features = ["rt", "private_line_stm32l4x6", "otg_fs"] [[example]] name = "i2c_write" -required-features = ["private_pac_stm32l4x1"] +required-features = ["private_line_stm32l4x1"] [[example]] name = "lptim_rtic" -required-features = ["rt", "private_pac_stm32l4x2"] +required-features = ["rt", "private_line_stm32l4x2"] [[example]] name = "adc_dma" -required-features = ["rt", "private_pac_stm32l4x1"] +required-features = ["rt", "private_line_stm32l4x1"] diff --git a/src/can.rs b/src/can.rs index 5ca2f8a2..6c71bc3a 100644 --- a/src/can.rs +++ b/src/can.rs @@ -45,7 +45,7 @@ mod common_pins { } } -#[cfg(feature = "private_pac_stm32l4x1")] +#[cfg(feature = "private_line_stm32l4x1")] mod pb13_pb12_af10 { use crate::gpio::{ gpiob::{PB12, PB13}, diff --git a/src/gpio.rs b/src/gpio.rs index fccd3962..9e056623 100644 --- a/src/gpio.rs +++ b/src/gpio.rs @@ -870,7 +870,7 @@ gpio!(GPIOE, gpioe, gpioc, gpioeen, gpioerst, PEx, 4, [ PE15: (pe15, 15, Input, AFRH, exticr4), ]); -#[cfg(any(feature = "private_pac_stm32l4x5", feature = "private_pac_stm32l4x6"))] +#[cfg(any(feature = "private_line_stm32l4x5", feature = "private_line_stm32l4x6"))] gpio!(GPIOF, gpiof, gpioc, gpiofen, gpiofrst, PFx, 5, [ PF0: (pf0, 0, Input, AFRL, exticr1), PF1: (pf1, 1, Input, AFRL, exticr1), @@ -890,7 +890,7 @@ gpio!(GPIOF, gpiof, gpioc, gpiofen, gpiofrst, PFx, 5, [ PF15: (pf15, 15, Input, AFRH, exticr4), ]); -#[cfg(any(feature = "private_pac_stm32l4x5", feature = "private_pac_stm32l4x6"))] +#[cfg(any(feature = "private_line_stm32l4x5", feature = "private_line_stm32l4x6"))] gpio!(GPIOG, gpiog, gpioc, gpiogen, gpiogrst, PGx, 6, [ PG0: (pg0, 0, Input, AFRL, exticr1), PG1: (pg1, 1, Input, AFRL, exticr1), diff --git a/src/i2c.rs b/src/i2c.rs index 64fd2969..78e5d7bc 100644 --- a/src/i2c.rs +++ b/src/i2c.rs @@ -4,9 +4,9 @@ use crate::hal::blocking::i2c::{Read, Write, WriteRead}; #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x6" + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x6" ))] use crate::pac::I2C4; use crate::pac::{i2c1, I2C1, I2C2, I2C3}; @@ -195,9 +195,9 @@ hal!(I2C3, enr, rstr, i2c3, i2c3en, i2c3rst); // STM32L432XX and STM32l442XX // STM32L486XX and STM32L476XX #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x6" + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x6" ))] hal!(I2C4, enr2, rstr2, i2c4, i2c4en, i2c4rst); @@ -451,7 +451,7 @@ where } } -#[cfg(feature = "private_pac_stm32l4x1")] +#[cfg(feature = "private_line_stm32l4x1")] mod stm32l4x1_pins { use super::{I2C1, I2C2, I2C3, I2C4}; use crate::gpio::*; @@ -476,7 +476,7 @@ mod stm32l4x1_pins { pins!(I2C4, AF3, SCL: [PB10], SDA: [PB11]); } -#[cfg(feature = "private_pac_stm32l4x2")] +#[cfg(feature = "private_line_stm32l4x2")] mod stm32l4x2_pins { use super::{I2C1, I2C2, I2C3, I2C4}; use crate::gpio::*; @@ -502,7 +502,7 @@ mod stm32l4x2_pins { pins!(I2C4, AF4, SCL: [PD12], SDA: [PD13]); } -#[cfg(feature = "private_pac_stm32l4x3")] +#[cfg(feature = "private_line_stm32l4x3")] mod stm32l4x3_pins { use super::{I2C1, I2C2, I2C3}; use crate::gpio::*; @@ -517,7 +517,7 @@ mod stm32l4x3_pins { pins!(I2C3, AF4, SCL: [PA7, PC0], SDA: [PB4, PC1]); } -#[cfg(feature = "private_pac_stm32l4x5")] +#[cfg(feature = "private_line_stm32l4x5")] mod stm32l4x5_pins { use super::{I2C1, I2C2, I2C3}; use crate::gpio::*; @@ -531,7 +531,7 @@ mod stm32l4x5_pins { pins!(I2C3, AF4, SCL: [PC0], SDA: [PC1]); } -#[cfg(feature = "private_pac_stm32l4x6")] +#[cfg(feature = "private_line_stm32l4x6")] mod stm32l4x6_pins { use super::{I2C1, I2C2, I2C3, I2C4}; use crate::gpio::*; diff --git a/src/lib.rs b/src/lib.rs index 99354505..bcfdd2c1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -27,236 +27,264 @@ feature = "stm32l486", feature = "stm32l496", feature = "stm32l4A6", + feature = "stm32l4p5", + feature = "stm32l4q5", + feature = "stm32l4r5", + feature = "stm32l4s5", + feature = "stm32l4r7", + feature = "stm32l4s7", + feature = "stm32l4r9", + feature = "stm32l4s9", + feature = "generic_pac_stm32l4x1", + feature = "generic_pac_stm32l4x2", + feature = "generic_pac_stm32l4x3", + feature = "generic_pac_stm32l4x5", + feature = "generic_pac_stm32l4x6", + feature = "generic_pac_stm32l4x7", + feature = "generic_pac_stm32l4x9", )))] -compile_error!("This crate requires one of the following features enabled: stm32l431, stm32l451, stm32l471, stm32l412, stm32l422, stm32l432, stm32l442, stm32l452, stm32l462, stm32l433, stm32l443, stm32l475, stm32l476, stm32l486, stm32l496, stm32l4A6, "); +compile_error!( + "\ +This crate requires one of the following features enabled: + stm32l431, stm32l451, stm32l471, stm32l412, + stm32l422, stm32l432, stm32l442, stm32l452, stm32l462 + stm32l433, stm32l443 + stm32l475, stm32l4p5, stm32l4q5, stm32l4r5, stm32l4s5 + stm32l476, stm32l486, stm32l496, stm32l4A6 + stm32l4r7, stm32l4s7 + stm32l4r9, stm32l4s9 + generic_pac_stm32l4x1, generic_pac_stm32l4x2, generic_pac_stm32l4x3, generic_pac_stm32l4x5, + generic_pac_stm32l4x6, generic_pac_stm32l4x7, generic_pac_stm32l4x9 +" +); pub use embedded_hal as hal; pub use stm32l4; -#[cfg(feature = "private_pac_stm32l4x1")] +#[cfg(feature = "private_line_stm32l4x1")] pub use stm32l4::stm32l4x1 as pac; -#[cfg(feature = "private_pac_stm32l4x2")] +#[cfg(feature = "private_line_stm32l4x2")] pub use stm32l4::stm32l4x2 as pac; -#[cfg(feature = "private_pac_stm32l4x3")] +#[cfg(feature = "private_line_stm32l4x3")] pub use stm32l4::stm32l4x3 as pac; -#[cfg(feature = "private_pac_stm32l4x5")] +#[cfg(feature = "private_line_stm32l4x5")] pub use stm32l4::stm32l4x5 as pac; -#[cfg(feature = "private_pac_stm32l4x6")] +#[cfg(feature = "private_line_stm32l4x6")] pub use stm32l4::stm32l4x6 as pac; #[cfg(feature = "rt")] pub use self::pac::interrupt; #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6" + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6" ))] pub use crate::pac as device; #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6" + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6" ))] pub use crate::pac as stm32; pub mod traits; #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6" + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6" ))] pub mod adc; -#[cfg(any(feature = "private_pac_stm32l4x1", feature = "private_pac_stm32l4x5",))] +#[cfg(any(feature = "private_line_stm32l4x1", feature = "private_line_stm32l4x5",))] pub mod can; #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6" + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6" ))] pub mod crc; pub mod datetime; #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6" + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6" ))] pub mod delay; #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6" + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6" ))] pub mod dma; #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6" + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6" ))] pub mod flash; #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6" + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6" ))] pub mod gpio; #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6" + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6" ))] pub mod i2c; #[cfg(all( feature = "otg_fs", - any(feature = "private_pac_stm32l4x5", feature = "private_pac_stm32l4x6") + any(feature = "private_line_stm32l4x5", feature = "private_line_stm32l4x6") ))] pub mod otg_fs; #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6" + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6" ))] pub mod prelude; #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6" + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6" ))] pub mod pwm; #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6" + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6" ))] pub mod pwr; #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6" + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6" ))] pub mod lptimer; #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6" + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6" ))] pub mod qspi; #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6" + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6" ))] pub mod rcc; #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6" + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6" ))] pub mod rng; #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6" + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6" ))] pub mod rtc; #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6" + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6" ))] pub mod serial; #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6" + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6" ))] pub mod signature; #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6" + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6" ))] pub mod spi; #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6" + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6" ))] pub mod time; #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6" + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6" ))] pub mod timer; #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6" + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6" ))] pub mod tsc; #[cfg(all( feature = "stm32-usbd", - any(feature = "private_pac_stm32l4x2", feature = "private_pac_stm32l4x3") + any(feature = "private_line_stm32l4x2", feature = "private_line_stm32l4x3") ))] pub mod usb; #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6" + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6" ))] pub mod watchdog; diff --git a/src/qspi.rs b/src/qspi.rs index 04dca385..7b5f9c53 100644 --- a/src/qspi.rs +++ b/src/qspi.rs @@ -1,10 +1,10 @@ //! Quad Serial Peripheral Interface (QSPI) bus #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6" + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6" ))] use crate::gpio::{ gpioa::{PA6, PA7}, @@ -13,20 +13,20 @@ use crate::gpio::{ }; #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x6" + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x6" ))] use crate::gpio::{ gpioa::{PA2, PA3}, gpiod::{PD3, PD4, PD5, PD6, PD7}, }; -#[cfg(feature = "private_pac_stm32l4x2")] +#[cfg(feature = "private_line_stm32l4x2")] use crate::gpio::gpiob::PB2; -#[cfg(feature = "private_pac_stm32l4x6")] +#[cfg(feature = "private_line_stm32l4x6")] use crate::gpio::{ gpioc::{PC1, PC2, PC4, PC5}, gpiof::{PF6, PF7, PF8, PF9}, @@ -707,11 +707,11 @@ impl Qspi<(CLK, NCS, IO0, IO1, IO2, IO3)> { } #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6" + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6" ))] pins!( QUADSPI, @@ -725,10 +725,10 @@ pins!( ); #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x6" + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x6" ))] pins!( QUADSPI, @@ -741,22 +741,22 @@ pins!( IO3: [PD7] ); -#[cfg(feature = "private_pac_stm32l4x2")] +#[cfg(feature = "private_line_stm32l4x2")] impl IO0Pin for PB1> { fn set_speed(self, speed: Speed) -> Self { self.set_speed(speed) } } -#[cfg(feature = "private_pac_stm32l4x2")] +#[cfg(feature = "private_line_stm32l4x2")] impl private::Sealed for PB2> {} -#[cfg(feature = "private_pac_stm32l4x2")] +#[cfg(feature = "private_line_stm32l4x2")] impl IO1Pin for PB2> { fn set_speed(self, speed: Speed) -> Self { self.set_speed(speed) } } -#[cfg(feature = "private_pac_stm32l4x6")] +#[cfg(feature = "private_line_stm32l4x6")] pins!( QUADSPI, AF10, diff --git a/src/rcc.rs b/src/rcc.rs index 9fc0de39..6372249b 100644 --- a/src/rcc.rs +++ b/src/rcc.rs @@ -256,13 +256,13 @@ impl APB1R1 { unsafe { &(*RCC::ptr()).apb1rstr1 } } - #[cfg(not(any(feature = "private_pac_stm32l4x3", feature = "private_pac_stm32l4x5")))] + #[cfg(not(any(feature = "private_line_stm32l4x3", feature = "private_line_stm32l4x5")))] pub(crate) fn enr2(&mut self) -> &rcc::APB1ENR2 { // NOTE(unsafe) this proxy grants exclusive access to this register unsafe { &(*RCC::ptr()).apb1enr2 } } - #[cfg(not(any(feature = "private_pac_stm32l4x3", feature = "private_pac_stm32l4x5")))] + #[cfg(not(any(feature = "private_line_stm32l4x3", feature = "private_line_stm32l4x5")))] pub(crate) fn rstr2(&mut self) -> &rcc::APB1RSTR2 { // NOTE(unsafe) this proxy grants exclusive access to this register unsafe { &(*RCC::ptr()).apb1rstr2 } diff --git a/src/serial.rs b/src/serial.rs index 20d8402f..e2c3b034 100644 --- a/src/serial.rs +++ b/src/serial.rs @@ -21,7 +21,7 @@ use crate::pac; use crate::rcc::{Clocks, APB1R1, APB2}; use crate::time::{Bps, U32Ext}; -#[cfg(any(feature = "private_pac_stm32l4x5", feature = "private_pac_stm32l4x6",))] +#[cfg(any(feature = "private_line_stm32l4x5", feature = "private_line_stm32l4x6",))] use crate::dma::dma2; /// Interrupt event @@ -831,21 +831,21 @@ hal! { } #[cfg(any( - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6", ))] hal! { USART3: (usart3, APB1R1, usart3en, usart3rst, pclk1, tx: (TxDma3, c2s, dma1::C2), rx: (RxDma3, c3s, dma1::C3)), } -#[cfg(any(feature = "private_pac_stm32l4x5", feature = "private_pac_stm32l4x6",))] +#[cfg(any(feature = "private_line_stm32l4x5", feature = "private_line_stm32l4x6",))] hal! { UART4: (uart4, APB1R1, uart4en, uart4rst, pclk1, tx: (TxDma4, c3s, dma2::C3), rx: (RxDma4, c5s, dma2::C5)), } -#[cfg(any(feature = "private_pac_stm32l4x5", feature = "private_pac_stm32l4x6",))] +#[cfg(any(feature = "private_line_stm32l4x5", feature = "private_line_stm32l4x6",))] hal! { UART5: (uart5, APB1R1, uart5en, uart5rst, pclk1, tx: (TxDma5, c1s, dma2::C1), rx: (RxDma5, c2s, dma2::C2)), } @@ -975,10 +975,10 @@ impl_pin_traits! { } #[cfg(any( - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6", ))] impl_pin_traits! { USART3: { @@ -991,7 +991,7 @@ impl_pin_traits! { } } -#[cfg(any(feature = "private_pac_stm32l4x5", feature = "private_pac_stm32l4x6"))] +#[cfg(any(feature = "private_line_stm32l4x5", feature = "private_line_stm32l4x6"))] impl_pin_traits! { UART4: { AF8: { diff --git a/src/spi.rs b/src/spi.rs index e7a98f35..2108d447 100644 --- a/src/spi.rs +++ b/src/spi.rs @@ -269,102 +269,102 @@ macro_rules! hal { } #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6", + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6", ))] use crate::gpio::gpiod::*; -#[cfg(any(feature = "private_pac_stm32l4x5", feature = "private_pac_stm32l4x6"))] +#[cfg(any(feature = "private_line_stm32l4x5", feature = "private_line_stm32l4x6"))] use crate::gpio::gpiog::*; use crate::gpio::{gpioa::*, gpiob::*, gpioc::*, gpioe::*}; use crate::stm32::SPI1; #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6" + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6" ))] hal! { SPI1: (spi1, spi1_slave, APB2, spi1en, spi1rst, pclk2), } #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6" + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6" ))] pins!(SPI1, AF5, SCK: [PA5, PB3, PE13], MISO: [PA6, PB4, PE14], MOSI: [PA7, PB5, PE15]); -#[cfg(any(feature = "private_pac_stm32l4x5", feature = "private_pac_stm32l4x6"))] +#[cfg(any(feature = "private_line_stm32l4x5", feature = "private_line_stm32l4x6"))] pins!(SPI1, AF5, SCK: [PG2], MISO: [PG3], MOSI: [PG4]); #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6", + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6", ))] use crate::{gpio::AF6, stm32::SPI3}; #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6", + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6", ))] hal! { SPI3: (spi3, spi3_slave, APB1R1, spi3en, spi3rst, pclk1), } #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6", + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6", ))] pins!(SPI3, AF6, SCK: [PB3, PC10], MISO: [PB4, PC11], MOSI: [PB5, PC12]); -#[cfg(any(feature = "private_pac_stm32l4x5", feature = "private_pac_stm32l4x6",))] +#[cfg(any(feature = "private_line_stm32l4x5", feature = "private_line_stm32l4x6",))] pins!(SPI3, AF6, SCK: [PG9], MISO: [PG10], MOSI: [PG11]); #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6", + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6", ))] use crate::stm32::SPI2; #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6", + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6", ))] hal! { SPI2: (spi2, spi2_slave, APB1R1, spi2en, spi2rst, pclk1), } #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6", + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6", ))] pins!(SPI2, AF5, SCK: [PB13, PB10, PD1], @@ -779,17 +779,17 @@ macro_rules! spi_dma { spi_dma!(SPI1, dma1::C2, c2s, map1, dma1::C3, c3s, map1); #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x3", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6", + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x3", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6", ))] spi_dma!(SPI2, dma1::C4, c4s, map1, dma1::C5, c5s, map1); // spi_dma!(SPI1, dma2::C3, c3s, map4, dma2::C4, c4s, map4); #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x5", - feature = "private_pac_stm32l4x6", + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6", ))] spi_dma!(SPI3, dma2::C1, c1s, map3, dma2::C2, c2s, map3); diff --git a/src/timer.rs b/src/timer.rs index 7bea75de..03c75db8 100644 --- a/src/timer.rs +++ b/src/timer.rs @@ -2,7 +2,7 @@ use crate::hal::timer::{CountDown, Periodic}; use crate::stm32::{TIM15, TIM16, TIM2, TIM6, TIM7}; -#[cfg(any(feature = "private_pac_stm32l4x5", feature = "private_pac_stm32l4x6",))] +#[cfg(any(feature = "private_line_stm32l4x5", feature = "private_line_stm32l4x6",))] use crate::stm32::{TIM17, TIM4, TIM5}; use cast::{u16, u32}; use void::Void; @@ -219,7 +219,7 @@ hal! { TIM16: (tim16, free_running_tim16, tim16en, tim16rst, APB2, u16), } -#[cfg(any(feature = "private_pac_stm32l4x5", feature = "private_pac_stm32l4x6",))] +#[cfg(any(feature = "private_line_stm32l4x5", feature = "private_line_stm32l4x6",))] hal! { TIM4: (tim4, free_running_tim4, tim4en, tim4rst, APB1R1, u16), TIM5: (tim5, free_running_tim5, tim5en, tim5rst, APB1R1, u32), diff --git a/src/watchdog.rs b/src/watchdog.rs index faaf58cd..08bb4446 100644 --- a/src/watchdog.rs +++ b/src/watchdog.rs @@ -28,12 +28,12 @@ impl IndependentWatchdog { /// Debug independent watchdog stopped when core is halted pub fn stop_on_debug(&self, dbgmcu: &DBGMCU, stop: bool) { #[cfg(any( - feature = "private_pac_stm32l4x1", - feature = "private_pac_stm32l4x2", - feature = "private_pac_stm32l4x3", + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", ))] dbgmcu.apb1fzr1.modify(|_, w| w.dbg_iwdg_stop().bit(stop)); - #[cfg(any(feature = "private_pac_stm32l4x5", feature = "private_pac_stm32l4x6"))] + #[cfg(any(feature = "private_line_stm32l4x5", feature = "private_line_stm32l4x6"))] dbgmcu.apb1_fzr1.modify(|_, w| w.dbg_iwdg_stop().bit(stop)); } From 4dbfae56935079fb51c618fb7f7fd55ff71616fa Mon Sep 17 00:00:00 2001 From: JC <8765278+Crzyrndm@users.noreply.github.com> Date: Sun, 17 Oct 2021 14:56:15 +1300 Subject: [PATCH 11/12] L412 requires changes, L4x9 pac using added --- Cargo.toml | 2 +- src/lib.rs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index c806eff9..4e01c6be 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -105,7 +105,7 @@ stm32l451 = [ "generic_pac_stm32l4x1", "private_product_L45_L46" ] stm32l471 = [ "generic_pac_stm32l4x1", "private_product_L47_L48" ] # L4x2 -stm32l412 = [ "private_line_stm32l4x2", "stm32l4/stm32l412", "private_product_L41_L42" ] # PAC has a L412 specific variation +stm32l412 = [ "generic_pac_stm32l4x2", "private_product_L41_L42" ] stm32l422 = [ "generic_pac_stm32l4x2", "private_product_L41_L42", "private_aes" ] stm32l432 = [ "generic_pac_stm32l4x2", "private_product_L43_L44" ] stm32l442 = [ "generic_pac_stm32l4x2", "private_product_L43_L44", "private_aes" ] diff --git a/src/lib.rs b/src/lib.rs index bcfdd2c1..8d2e7731 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -76,6 +76,9 @@ pub use stm32l4::stm32l4x5 as pac; #[cfg(feature = "private_line_stm32l4x6")] pub use stm32l4::stm32l4x6 as pac; +#[cfg(feature = "private_line_stm32l4x9")] +pub use stm32l4::stm32l4r9 as pac; + #[cfg(feature = "rt")] pub use self::pac::interrupt; From 767e2c0b00650d33c0ae0ca73273d19a047eef8d Mon Sep 17 00:00:00 2001 From: JC <8765278+Crzyrndm@users.noreply.github.com> Date: Sun, 17 Oct 2021 15:03:21 +1300 Subject: [PATCH 12/12] typo --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 4e01c6be..2c5de484 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -90,7 +90,7 @@ private_aes = [] private_sha256 = [] # generics are used by dependants that don't want to specify a specific MCU -# Also used by specific MCU geatures as shorthand for the private and PAC features +# Also used by specific MCU features as shorthand for the private and PAC features generic_pac_stm32l4x1 = ["private_line_stm32l4x1", "stm32l4/stm32l4x1"] generic_pac_stm32l4x2 = ["private_line_stm32l4x2", "stm32l4/stm32l4x2"] generic_pac_stm32l4x3 = ["private_line_stm32l4x3", "stm32l4/stm32l4x3"]