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 and stm32l4s5 #324

Open
wants to merge 3 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
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ edition = "2018"
[dependencies]
cortex-m = "0.7"
nb = "0.1.1"
stm32l4 = "0.14.0"
stm32l4 = "0.15.0"
embedded-dma = "0.1"
bxcan = ">=0.4, <0.7"
fugit = "0.3.5"
Expand Down Expand Up @@ -98,11 +98,11 @@ stm32l486 = [ "stm32l4/stm32l4x6" ]
stm32l496 = [ "stm32l4/stm32l4x6" ]
stm32l4a6 = [ "stm32l4/stm32l4x6" ]

# L4+ series PAC support??
# L4+
#stm32l4p5 = [ "stm32l4/stm32l4x5" ]
#stm32l4q5 = [ "stm32l4/stm32l4x5" ]
#stm32l4r5 = [ "stm32l4/stm32l4x5" ]
#stm32l4s5 = [ "stm32l4/stm32l4x5" ]
stm32l4r5 = [ "stm32l4/stm32l4r5" ]
stm32l4s5 = [ "stm32l4/stm32l4r5" ]

# L4x7
#stm32l4r7 = [ "stm32l4/stm32l4x7" ]
Expand Down
8 changes: 4 additions & 4 deletions src/adc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -916,8 +916,8 @@ adc_pins!(
feature = "stm32l443",
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
// feature = "stm32l4s5",
feature = "stm32l4r5",
feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
feature = "stm32l4r9",
Expand All @@ -930,8 +930,8 @@ adc!(ADC2 => (adc2, ADC_COMMON));
feature = "stm32l443",
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
// feature = "stm32l4s5",
feature = "stm32l4r5",
feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
feature = "stm32l4r9",
Expand Down
8 changes: 4 additions & 4 deletions src/dma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -694,8 +694,8 @@ macro_rules! dma {
#[cfg(not(any(
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
// feature = "stm32l4s5",
feature = "stm32l4r5",
feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
feature = "stm32l4r9",
Expand Down Expand Up @@ -1126,8 +1126,8 @@ macro_rules! dma {
#[cfg(any(
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
// feature = "stm32l4s5",
feature = "stm32l4r5",
feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
feature = "stm32l4r9",
Expand Down
32 changes: 16 additions & 16 deletions src/dmamux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use crate::dma::{dma1, dma2};
#[cfg(any(
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
// feature = "stm32l4s5",
feature = "stm32l4r5",
feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
feature = "stm32l4r9",
Expand Down Expand Up @@ -132,8 +132,8 @@ pub enum DmaInput {
#[cfg(any(
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
// feature = "stm32l4s5",
feature = "stm32l4r5",
feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
feature = "stm32l4r9",
Expand Down Expand Up @@ -240,8 +240,8 @@ enum DMAREQ_ID_A {
#[cfg(any(
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
// feature = "stm32l4s5",
feature = "stm32l4r5",
feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
feature = "stm32l4r9",
Expand All @@ -256,8 +256,8 @@ impl From<DMAREQ_ID_A> for u8 {
#[cfg(any(
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
// feature = "stm32l4s5",
feature = "stm32l4r5",
feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
feature = "stm32l4r9",
Expand Down Expand Up @@ -372,8 +372,8 @@ impl TryFrom<DmaInput> for DMAREQ_ID_A {
#[cfg(not(any(
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
// feature = "stm32l4s5",
feature = "stm32l4r5",
feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
feature = "stm32l4r9",
Expand Down Expand Up @@ -419,8 +419,8 @@ macro_rules! cselr {
#[cfg(not(any(
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
// feature = "stm32l4s5",
feature = "stm32l4r5",
feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
feature = "stm32l4r9",
Expand Down Expand Up @@ -565,8 +565,8 @@ macro_rules! dmamux {
#[cfg(any(
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
// feature = "stm32l4s5",
feature = "stm32l4r5",
feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
feature = "stm32l4r9",
Expand All @@ -586,8 +586,8 @@ macro_rules! dmamux {
#[cfg(not(any(
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
// feature = "stm32l4s5",
feature = "stm32l4r5",
feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
feature = "stm32l4r9",
Expand Down
16 changes: 8 additions & 8 deletions src/gpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -727,8 +727,8 @@ gpio!(GPIOE, gpioe, PEx, 'E', 4, [
feature = "stm32l4a6",
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
// feature = "stm32l4s5",
feature = "stm32l4r5",
feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
feature = "stm32l4r9",
Expand Down Expand Up @@ -762,8 +762,8 @@ gpio!(GPIOF, gpiof, PFx, 'F', 5, [
feature = "stm32l4a6",
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
// feature = "stm32l4s5",
feature = "stm32l4r5",
feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
feature = "stm32l4r9",
Expand Down Expand Up @@ -801,7 +801,7 @@ gpio!(GPIOG, gpiog, PGx, 'G', 6,
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
// feature = "stm32l4s5",
feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
feature = "stm32l4r9",
Expand Down Expand Up @@ -846,7 +846,7 @@ impl<const P: char> Gpio<P> {
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
// feature = "stm32l4s5",
feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
feature = "stm32l4r9",
Expand All @@ -864,7 +864,7 @@ impl<const P: char> Gpio<P> {
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
// feature = "stm32l4s5",
feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
feature = "stm32l4r9",
Expand All @@ -882,7 +882,7 @@ impl<const P: char> Gpio<P> {
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
// feature = "stm32l4s5",
feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
feature = "stm32l4r9",
Expand Down
12 changes: 6 additions & 6 deletions src/i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ use crate::hal::blocking::i2c::{Read, Write, WriteRead};
feature = "stm32l4a6",
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
// feature = "stm32l4s5",
feature = "stm32l4r5",
feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
feature = "stm32l4r9",
Expand Down Expand Up @@ -208,8 +208,8 @@ hal!(I2C3, i2c3);
feature = "stm32l4a6",
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
// feature = "stm32l4s5",
feature = "stm32l4r5",
feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
feature = "stm32l4r9",
Expand Down Expand Up @@ -613,8 +613,8 @@ mod stm32l4x6_pins {
#[cfg(any(
// feature = "stm32l4p5",
// feature = "stm32l4q5",
// feature = "stm32l4r5",
// feature = "stm32l4s5",
feature = "stm32l4r5",
feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
feature = "stm32l4r9",
Expand Down
12 changes: 9 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@
feature = "stm32l486",
feature = "stm32l496",
feature = "stm32l4a6",
// 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 = "stm32l4s5",
feature = "stm32l4r5",
feature = "stm32l4s5",
// feature = "stm32l4r7",
// feature = "stm32l4s7",
// these have PAC support. Hal integration is very slim though
Expand All @@ -46,6 +45,7 @@ This crate requires one of the following features enabled:
stm32l433, stm32l443
stm32l475,
stm32l476, stm32l486, stm32l496, stm32l4a6
stm32l4r5, stm32l4s5
stm32l4r9, stm32l4s9
"
);
Expand Down Expand Up @@ -110,6 +110,12 @@ pub use stm32l4::stm32l4x5 as pac;
))]
pub use stm32l4::stm32l4x6 as pac;

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

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

Expand Down
4 changes: 2 additions & 2 deletions src/pwm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ macro_rules! pwm_channels {

#[inline(always)]
fn get_duty(&self) -> Self::Duty {
unsafe { (*$TIMX::ptr()).$ccrX.read().$ccr().bits() }
unsafe { (*$TIMX::ptr()).$ccrX().read().$ccr().bits() }
}

#[inline(always)]
Expand All @@ -380,7 +380,7 @@ macro_rules! pwm_channels {

#[inline(always)]
fn set_duty(&mut self, duty: Self::Duty) {
unsafe { (*$TIMX::ptr()).$ccrX.write(|w| w.$ccr().bits(duty)) }
unsafe { (*$TIMX::ptr()).$ccrX().write(|w| w.$ccr().bits(duty)) }
}
}
)+
Expand Down
Loading