Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for stm32l4r5 #292

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,14 @@ jobs:
command: test
args: --lib --target x86_64-unknown-linux-gnu --features rt,unproven,${{ matrix.mcu.id }}${{ matrix.mcu.additional-features }}

ci-r9:
ci-rx:
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
mcu:
- { id: stm32l4r5, additional-features: "" }
- { id: stm32l4r9, additional-features: "" }
- { id: stm32l4s9, additional-features: "" }

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ stm32l4a6 = [ "stm32l4/stm32l4x6" ]
# L4+ series PAC support??
#stm32l4p5 = [ "stm32l4/stm32l4x5" ]
#stm32l4q5 = [ "stm32l4/stm32l4x5" ]
#stm32l4r5 = [ "stm32l4/stm32l4x5" ]
stm32l4r5 = [ "stm32l4/stm32l4r5" ]
#stm32l4s5 = [ "stm32l4/stm32l4x5" ]

# L4x7
Expand Down
4 changes: 2 additions & 2 deletions src/dma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ macro_rules! dma {
#[cfg(not(any(
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
feature = "stm32l4r5",
// feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
Expand Down Expand Up @@ -1085,7 +1085,7 @@ macro_rules! dma {
#[cfg(any(
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
feature = "stm32l4r5",
// feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
Expand Down
16 changes: 8 additions & 8 deletions src/dmamux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::dma::{dma1, dma2};
#[cfg(any(
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
feature = "stm32l4r5",
// feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
Expand Down Expand Up @@ -132,7 +132,7 @@ pub enum DmaInput {
#[cfg(any(
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
feature = "stm32l4r5",
// feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
Expand Down Expand Up @@ -240,7 +240,7 @@ enum DMAREQ_ID_A {
#[cfg(any(
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
feature = "stm32l4r5",
// feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
Expand All @@ -256,7 +256,7 @@ impl From<DMAREQ_ID_A> for u8 {
#[cfg(any(
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
feature = "stm32l4r5",
// feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
Expand Down Expand Up @@ -372,7 +372,7 @@ impl TryFrom<DmaInput> for DMAREQ_ID_A {
#[cfg(not(any(
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
feature = "stm32l4r5",
// feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
Expand Down Expand Up @@ -419,7 +419,7 @@ macro_rules! cselr {
#[cfg(not(any(
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
feature = "stm32l4r5",
// feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
Expand Down Expand Up @@ -565,7 +565,7 @@ macro_rules! dmamux {
#[cfg(any(
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
feature = "stm32l4r5",
// feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
Expand All @@ -586,7 +586,7 @@ macro_rules! dmamux {
#[cfg(not(any(
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
feature = "stm32l4r5",
// feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
Expand Down
8 changes: 4 additions & 4 deletions src/gpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ gpio!(GPIOE, gpioe, PEx, 'E', 4, [
feature = "stm32l4a6",
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
feature = "stm32l4r5",
// feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
Expand Down Expand Up @@ -747,7 +747,7 @@ gpio!(GPIOF, gpiof, PFx, 'F', 5, [
feature = "stm32l4a6",
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
feature = "stm32l4r5",
// feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
Expand Down Expand Up @@ -794,7 +794,7 @@ impl<const P: char> Gpio<P> {
feature = "stm32l4a6",
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
feature = "stm32l4r5",
// feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
Expand All @@ -812,7 +812,7 @@ impl<const P: char> Gpio<P> {
feature = "stm32l4a6",
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
feature = "stm32l4r5",
// feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
Expand Down
8 changes: 4 additions & 4 deletions src/i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::hal::blocking::i2c::{Read, Write, WriteRead};
feature = "stm32l4a6",
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
feature = "stm32l4r5",
// feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
Expand Down Expand Up @@ -208,7 +208,7 @@ hal!(I2C3, i2c3);
feature = "stm32l4a6",
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
feature = "stm32l4r5",
// feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
Expand Down Expand Up @@ -303,7 +303,7 @@ where

fn write(&mut self, addr: u8, bytes: &[u8]) -> Result<(), Error> {
// TODO support transfers of more than 255 bytes
assert!(bytes.len() < 256 && bytes.len() > 0);
assert!(bytes.len() < 256);

// Wait for any previous address sequence to end
// automatically. This could be up to 50% of a bus
Expand Down Expand Up @@ -613,7 +613,7 @@ mod stm32l4x6_pins {
#[cfg(any(
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
feature = "stm32l4r5",
// feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
Expand Down
12 changes: 9 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
// note L4+ PAC support is mostly missing so other than r9/s9 these features don't actually exist yet
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
feature = "stm32l4r5",
// feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
Expand All @@ -44,7 +44,8 @@ This crate requires one of the following features enabled:
stm32l431, stm32l451, stm32l471
stm32l412, stm32l422, stm32l432, stm32l442, stm32l452, stm32l462
stm32l433, stm32l443
stm32l475,
stm32l475,
stm32l4r5,
stm32l476, stm32l486, stm32l496, stm32l4a6
stm32l4r9, stm32l4s9
"
Expand Down Expand Up @@ -110,6 +111,9 @@ pub use stm32l4::stm32l4x5 as pac;
))]
pub use stm32l4::stm32l4x6 as pac;

#[cfg(any(feature = "stm32l4r5"))]
pub use stm32l4::stm32l4r5 as pac;

#[cfg(any(feature = "stm32l4r9", feature = "stm32l4s9",))]
pub use stm32l4::stm32l4r9 as pac;

Expand All @@ -123,7 +127,7 @@ pub mod traits;

#[cfg(not(any(feature = "stm32l4r9", feature = "stm32l4s9",)))]
pub mod adc;
#[cfg(not(any(feature = "stm32l4r9", feature = "stm32l4s9",)))]
#[cfg(not(any(feature = "stm32lr5", feature = "stm32l4r9", feature = "stm32l4s9",)))]
#[cfg(not(any(feature = "stm32l412",)))]
pub mod can;
pub mod crc;
Expand All @@ -143,6 +147,7 @@ pub mod lptimer;
feature = "stm32l486",
feature = "stm32l496",
feature = "stm32l4a6",
feature = "stm32l4r5",
)
))]
pub mod otg_fs;
Expand All @@ -152,6 +157,7 @@ pub mod pwr;
#[cfg(not(any(
feature = "stm32l433",
feature = "stm32l443",
feature = "stm32l4r5",
feature = "stm32l4r9",
feature = "stm32l4s9",
)))]
Expand Down
19 changes: 13 additions & 6 deletions src/rcc/enable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ bus! {
#[cfg(not(any(
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
feature = "stm32l4r5",
// feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
Expand All @@ -161,10 +161,17 @@ bus! {
}

// L4+
#[cfg(any(feature = "stm32l4r5"))]
bus! {
ADC1 => (AHB2, adcen, adcfssmen, adcrst), // 13

FIREWALL => (APB2, fwen,,), // 7
LTCD => (APB2, ltdcen, ltdcsmen, ltdcrst), // 26
}

#[cfg(any(
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
// feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
Expand All @@ -188,7 +195,7 @@ bus! {
feature = "stm32l4a6",
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
feature = "stm32l4r5",
// feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
Expand Down Expand Up @@ -257,7 +264,7 @@ bus! {
feature = "stm32l443",
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
feature = "stm32l4r5",
// feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
Expand Down Expand Up @@ -324,7 +331,7 @@ bus! {
feature = "stm32l4a6",
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
feature = "stm32l4r5",
// feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
Expand Down Expand Up @@ -361,7 +368,7 @@ bus! {
#[cfg(any(
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
feature = "stm32l4r5",
// feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
Expand Down
10 changes: 5 additions & 5 deletions src/serial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use crate::time::{Bps, U32Ext};
feature = "stm32l4a6",
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
feature = "stm32l4r5",
// feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
Expand Down Expand Up @@ -869,7 +869,7 @@ hal! {
feature = "stm32l4a6",
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
feature = "stm32l4r5",
// feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
Expand All @@ -890,7 +890,7 @@ hal! {
feature = "stm32l4a6",
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
feature = "stm32l4r5",
// feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
Expand Down Expand Up @@ -1046,7 +1046,7 @@ impl_pin_traits! {
feature = "stm32l4a6",
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
feature = "stm32l4r5",
// feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
Expand Down Expand Up @@ -1074,7 +1074,7 @@ impl_pin_traits! {
feature = "stm32l4a6",
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
feature = "stm32l4r5",
// feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
Expand Down
6 changes: 3 additions & 3 deletions src/spi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ use crate::gpio::gpiod::*;
feature = "stm32l4a6",
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
feature = "stm32l4r5",
// feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
Expand Down Expand Up @@ -307,7 +307,7 @@ pins!(SPI1, 5,
feature = "stm32l4a6",
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
feature = "stm32l4r5",
// feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
Expand Down Expand Up @@ -340,7 +340,7 @@ pins!(SPI3, 6,
feature = "stm32l4a6",
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
feature = "stm32l4r5",
// feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
Expand Down
Loading