diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bcd0bd30..ce57d481 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,11 +13,11 @@ jobs: rust: - stable mcu: - - stm32l4x1 - - stm32l4x2 - - stm32l4x3 - - stm32l4x5 - - stm32l4x6 + - generic_pac_stm32l4x1 + - generic_pac_stm32l4x2 + - generic_pac_stm32l4x3 + - generic_pac_stm32l4x5 + - generic_pac_stm32l4x6 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 diff --git a/Cargo.toml b/Cargo.toml index c19aaea3..2c5de484 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,18 +57,89 @@ features = ["cortex-m", "fs"] optional = true [package.metadata.docs.rs] -features = ["rt", "stm32l4x2", "stm32-usbd"] +features = ["rt", "stm32l432", "stm32-usbd"] [features] rt = ["stm32l4/rt"] -stm32l4x1 = ["stm32l4/stm32l4x1"] -stm32l4x2 = ["stm32l4/stm32l4x2"] -stm32l4x3 = ["stm32l4/stm32l4x3"] -stm32l4x5 = ["stm32l4/stm32l4x5"] -stm32l4x6 = ["stm32l4/stm32l4x6"] unproven = ["embedded-hal/unproven"] otg_fs = ["synopsys-usb-otg"] +# private features are for internal use only +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 = [] +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 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 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 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"] +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 = [ "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 = [ "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" ] +stm32l452 = [ "generic_pac_stm32l4x2", "private_product_L45_L46" ] +stm32l462 = [ "generic_pac_stm32l4x2", "private_product_L45_L46", "private_aes" ] + +# L4x3 +stm32l433 = [ "generic_pac_stm32l4x3", "private_product_L43_L44" ] +stm32l443 = [ "generic_pac_stm32l4x3", "private_product_L43_L44" ] + +# L4x5 +stm32l475 = [ "generic_pac_stm32l4x5", "private_product_L47_L48" ] +# L4+ series PAC support?? +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 = [ "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 = [ "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_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" panic-semihosting = "0.5.0" @@ -103,11 +174,11 @@ lto = true [[example]] name = "adc" -required-features = ["rt", "stm32l4x3"] +required-features = ["rt", "private_line_stm32l4x3"] [[example]] name = "can-loopback" -required-features = ["rt", "stm32l4x1"] +required-features = ["rt", "private_line_stm32l4x1"] [[example]] name = "irq_button" @@ -115,7 +186,7 @@ required-features = ["rt"] [[example]] name = "qspi" -required-features = ["rt", "stm32l4x5"] +required-features = ["rt", "private_line_stm32l4x5"] [[example]] name = "rng" @@ -127,15 +198,15 @@ required-features = ["rt"] [[example]] name = "rtic_frame_serial_dma" -required-features = ["rt", "stm32l4x2"] +required-features = ["rt", "private_line_stm32l4x2"] [[example]] name = "spi_dma_rxtx" -required-features = ["rt", "stm32l4x2"] +required-features = ["rt", "private_line_stm32l4x2"] [[example]] name = "serial_echo_rtic" -required-features = ["rt", "stm32l4x3"] +required-features = ["rt", "private_line_stm32l4x3"] [[example]] name = "timer" @@ -143,20 +214,20 @@ required-features = ["rt"] [[example]] name = "usb_serial" -required-features = ["rt", "stm32l4x2", "stm32-usbd"] +required-features = ["rt", "private_line_stm32l4x2", "stm32-usbd"] [[example]] name = "otg_fs_serial" -required-features = ["rt", "stm32l4x6", "otg_fs"] +required-features = ["rt", "private_line_stm32l4x6", "otg_fs"] [[example]] name = "i2c_write" -required-features = ["stm32l4x1"] +required-features = ["private_line_stm32l4x1"] [[example]] name = "lptim_rtic" -required-features = ["rt", "stm32l4x2"] +required-features = ["rt", "private_line_stm32l4x2"] [[example]] name = "adc_dma" -required-features = ["rt", "stm32l4x1"] +required-features = ["rt", "private_line_stm32l4x1"] diff --git a/src/can.rs b/src/can.rs index 209a1152..6c71bc3a 100644 --- a/src/can.rs +++ b/src/can.rs @@ -45,7 +45,7 @@ mod common_pins { } } -#[cfg(feature = "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 1381c6ac..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 = "stm32l4x5", feature = "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 = "stm32l4x5", feature = "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 868757cd..78e5d7bc 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_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_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_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x6" +))] hal!(I2C4, enr2, rstr2, i2c4, i2c4en, i2c4rst); impl I2c @@ -443,7 +451,7 @@ where } } -#[cfg(feature = "stm32l4x1")] +#[cfg(feature = "private_line_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_line_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_line_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_line_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_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 c478f205..8d2e7731 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,239 +11,283 @@ #![no_std] #[cfg(not(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x4", - feature = "stm32l4x5", - feature = "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", + 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: 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, 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 = "stm32l4x1")] +#[cfg(feature = "private_line_stm32l4x1")] pub use stm32l4::stm32l4x1 as pac; -#[cfg(feature = "stm32l4x2")] +#[cfg(feature = "private_line_stm32l4x2")] pub use stm32l4::stm32l4x2 as pac; -#[cfg(feature = "stm32l4x3")] +#[cfg(feature = "private_line_stm32l4x3")] pub use stm32l4::stm32l4x3 as pac; -#[cfg(feature = "stm32l4x5")] +#[cfg(feature = "private_line_stm32l4x5")] pub use stm32l4::stm32l4x5 as pac; -#[cfg(feature = "stm32l4x6")] +#[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; #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "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 = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "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 = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "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 = "stm32l4x1", feature = "stm32l4x5",))] +#[cfg(any(feature = "private_line_stm32l4x1", feature = "private_line_stm32l4x5",))] pub mod can; #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "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 = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "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 = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "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 = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "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 = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "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 = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "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 = "stm32l4x5", feature = "stm32l4x6")))] +#[cfg(all( + feature = "otg_fs", + any(feature = "private_line_stm32l4x5", feature = "private_line_stm32l4x6") +))] pub mod otg_fs; #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "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 = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "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 = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "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 = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "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 = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x5", - feature = "stm32l4x6" + feature = "private_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x5", + feature = "private_line_stm32l4x6" ))] pub mod qspi; #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "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 = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "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 = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "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 = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "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 = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "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 = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "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 = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "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 = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "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 = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "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 = "stm32l4x2", feature = "stm32l4x3") + any(feature = "private_line_stm32l4x2", feature = "private_line_stm32l4x3") ))] pub mod usb; #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "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 cde5ad2c..7b5f9c53 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_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 = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "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 = "stm32l4x2")] +#[cfg(feature = "private_line_stm32l4x2")] use crate::gpio::gpiob::PB2; -#[cfg(feature = "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 = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "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 = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "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 = "stm32l4x2")] +#[cfg(feature = "private_line_stm32l4x2")] impl IO0Pin for PB1> { fn set_speed(self, speed: Speed) -> Self { self.set_speed(speed) } } -#[cfg(feature = "stm32l4x2")] +#[cfg(feature = "private_line_stm32l4x2")] impl private::Sealed for PB2> {} -#[cfg(feature = "stm32l4x2")] +#[cfg(feature = "private_line_stm32l4x2")] impl IO1Pin for PB2> { fn set_speed(self, speed: Speed) -> Self { self.set_speed(speed) } } -#[cfg(feature = "stm32l4x6")] +#[cfg(feature = "private_line_stm32l4x6")] pins!( QUADSPI, AF10, diff --git a/src/rcc.rs b/src/rcc.rs index ae15582f..6372249b 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_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 = "stm32l4x3", feature = "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 8986eb61..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 = "stm32l4x5", feature = "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 = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "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 = "stm32l4x5", feature = "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 = "stm32l4x5", feature = "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 = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "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 = "stm32l4x5", feature = "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 6b6b18f0..2108d447 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_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 = "stm32l4x5", feature = "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 = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "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 = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "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 = "stm32l4x5", feature = "stm32l4x6"))] +#[cfg(any(feature = "private_line_stm32l4x5", feature = "private_line_stm32l4x6"))] pins!(SPI1, AF5, SCK: [PG2], MISO: [PG3], MOSI: [PG4]); #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x5", - feature = "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 = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x5", - feature = "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 = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x5", - feature = "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 = "stm32l4x5", feature = "stm32l4x6",))] +#[cfg(any(feature = "private_line_stm32l4x5", feature = "private_line_stm32l4x6",))] pins!(SPI3, AF6, SCK: [PG9], MISO: [PG10], MOSI: [PG11]); #[cfg(any( - feature = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "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 = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "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 = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "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 = "stm32l4x1", - feature = "stm32l4x3", - feature = "stm32l4x5", - feature = "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 = "stm32l4x1", - feature = "stm32l4x2", - feature = "stm32l4x5", - feature = "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 a3d5e3f3..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 = "stm32l4x5", feature = "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 = "stm32l4x5", feature = "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 af9df25f..08bb4446 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_line_stm32l4x1", + feature = "private_line_stm32l4x2", + feature = "private_line_stm32l4x3", + ))] dbgmcu.apb1fzr1.modify(|_, w| w.dbg_iwdg_stop().bit(stop)); - #[cfg(any(feature = "stm32l4x5", feature = "stm32l4x6"))] + #[cfg(any(feature = "private_line_stm32l4x5", feature = "private_line_stm32l4x6"))] dbgmcu.apb1_fzr1.modify(|_, w| w.dbg_iwdg_stop().bit(stop)); }