Skip to content

Commit 9d1767e

Browse files
committed
add support for stm32l4r5
1 parent 325a19c commit 9d1767e

File tree

11 files changed

+53
-37
lines changed

11 files changed

+53
-37
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ stm32l4a6 = [ "stm32l4/stm32l4x6" ]
9696
# L4+ series PAC support??
9797
#stm32l4p5 = [ "stm32l4/stm32l4x5" ]
9898
#stm32l4q5 = [ "stm32l4/stm32l4x5" ]
99-
#stm32l4r5 = [ "stm32l4/stm32l4x5" ]
99+
stm32l4r5 = [ "stm32l4/stm32l4r5" ]
100100
#stm32l4s5 = [ "stm32l4/stm32l4x5" ]
101101

102102
# L4x7

src/dma.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ macro_rules! dma {
647647
#[cfg(not(any(
648648
// feature = "stm32l4p5",
649649
// feature = "stm32l4q5",
650-
// feature = "stm32l4r5",
650+
feature = "stm32l4r5",
651651
// feature = "stm32l4s5",
652652
// feature = "stm32l4r7",
653653
// feature = "stm32l4s7",
@@ -1085,7 +1085,7 @@ macro_rules! dma {
10851085
#[cfg(any(
10861086
// feature = "stm32l4p5",
10871087
// feature = "stm32l4q5",
1088-
// feature = "stm32l4r5",
1088+
feature = "stm32l4r5",
10891089
// feature = "stm32l4s5",
10901090
// feature = "stm32l4r7",
10911091
// feature = "stm32l4s7",

src/dmamux.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::dma::{dma1, dma2};
1111
#[cfg(any(
1212
// feature = "stm32l4p5",
1313
// feature = "stm32l4q5",
14-
// feature = "stm32l4r5",
14+
feature = "stm32l4r5",
1515
// feature = "stm32l4s5",
1616
// feature = "stm32l4r7",
1717
// feature = "stm32l4s7",
@@ -132,7 +132,7 @@ pub enum DmaInput {
132132
#[cfg(any(
133133
// feature = "stm32l4p5",
134134
// feature = "stm32l4q5",
135-
// feature = "stm32l4r5",
135+
feature = "stm32l4r5",
136136
// feature = "stm32l4s5",
137137
// feature = "stm32l4r7",
138138
// feature = "stm32l4s7",
@@ -240,7 +240,7 @@ enum DMAREQ_ID_A {
240240
#[cfg(any(
241241
// feature = "stm32l4p5",
242242
// feature = "stm32l4q5",
243-
// feature = "stm32l4r5",
243+
feature = "stm32l4r5",
244244
// feature = "stm32l4s5",
245245
// feature = "stm32l4r7",
246246
// feature = "stm32l4s7",
@@ -256,7 +256,7 @@ impl From<DMAREQ_ID_A> for u8 {
256256
#[cfg(any(
257257
// feature = "stm32l4p5",
258258
// feature = "stm32l4q5",
259-
// feature = "stm32l4r5",
259+
feature = "stm32l4r5",
260260
// feature = "stm32l4s5",
261261
// feature = "stm32l4r7",
262262
// feature = "stm32l4s7",
@@ -372,7 +372,7 @@ impl TryFrom<DmaInput> for DMAREQ_ID_A {
372372
#[cfg(not(any(
373373
// feature = "stm32l4p5",
374374
// feature = "stm32l4q5",
375-
// feature = "stm32l4r5",
375+
feature = "stm32l4r5",
376376
// feature = "stm32l4s5",
377377
// feature = "stm32l4r7",
378378
// feature = "stm32l4s7",
@@ -419,7 +419,7 @@ macro_rules! cselr {
419419
#[cfg(not(any(
420420
// feature = "stm32l4p5",
421421
// feature = "stm32l4q5",
422-
// feature = "stm32l4r5",
422+
feature = "stm32l4r5",
423423
// feature = "stm32l4s5",
424424
// feature = "stm32l4r7",
425425
// feature = "stm32l4s7",
@@ -565,7 +565,7 @@ macro_rules! dmamux {
565565
#[cfg(any(
566566
// feature = "stm32l4p5",
567567
// feature = "stm32l4q5",
568-
// feature = "stm32l4r5",
568+
feature = "stm32l4r5",
569569
// feature = "stm32l4s5",
570570
// feature = "stm32l4r7",
571571
// feature = "stm32l4s7",
@@ -586,7 +586,7 @@ macro_rules! dmamux {
586586
#[cfg(not(any(
587587
// feature = "stm32l4p5",
588588
// feature = "stm32l4q5",
589-
// feature = "stm32l4r5",
589+
feature = "stm32l4r5",
590590
// feature = "stm32l4s5",
591591
// feature = "stm32l4r7",
592592
// feature = "stm32l4s7",

src/gpio.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ gpio!(GPIOE, gpioe, PEx, 'E', 4, [
712712
feature = "stm32l4a6",
713713
// feature = "stm32l4p5",
714714
// feature = "stm32l4q5",
715-
// feature = "stm32l4r5",
715+
feature = "stm32l4r5",
716716
// feature = "stm32l4s5",
717717
// feature = "stm32l4r7",
718718
// feature = "stm32l4s7",
@@ -747,7 +747,7 @@ gpio!(GPIOF, gpiof, PFx, 'F', 5, [
747747
feature = "stm32l4a6",
748748
// feature = "stm32l4p5",
749749
// feature = "stm32l4q5",
750-
// feature = "stm32l4r5",
750+
feature = "stm32l4r5",
751751
// feature = "stm32l4s5",
752752
// feature = "stm32l4r7",
753753
// feature = "stm32l4s7",
@@ -794,7 +794,7 @@ impl<const P: char> Gpio<P> {
794794
feature = "stm32l4a6",
795795
// feature = "stm32l4p5",
796796
// feature = "stm32l4q5",
797-
// feature = "stm32l4r5",
797+
feature = "stm32l4r5",
798798
// feature = "stm32l4s5",
799799
// feature = "stm32l4r7",
800800
// feature = "stm32l4s7",
@@ -812,7 +812,7 @@ impl<const P: char> Gpio<P> {
812812
feature = "stm32l4a6",
813813
// feature = "stm32l4p5",
814814
// feature = "stm32l4q5",
815-
// feature = "stm32l4r5",
815+
feature = "stm32l4r5",
816816
// feature = "stm32l4s5",
817817
// feature = "stm32l4r7",
818818
// feature = "stm32l4s7",

src/i2c.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::hal::blocking::i2c::{Read, Write, WriteRead};
1212
feature = "stm32l4a6",
1313
// feature = "stm32l4p5",
1414
// feature = "stm32l4q5",
15-
// feature = "stm32l4r5",
15+
feature = "stm32l4r5",
1616
// feature = "stm32l4s5",
1717
// feature = "stm32l4r7",
1818
// feature = "stm32l4s7",
@@ -208,7 +208,7 @@ hal!(I2C3, i2c3);
208208
feature = "stm32l4a6",
209209
// feature = "stm32l4p5",
210210
// feature = "stm32l4q5",
211-
// feature = "stm32l4r5",
211+
feature = "stm32l4r5",
212212
// feature = "stm32l4s5",
213213
// feature = "stm32l4r7",
214214
// feature = "stm32l4s7",
@@ -613,7 +613,7 @@ mod stm32l4x6_pins {
613613
#[cfg(any(
614614
// feature = "stm32l4p5",
615615
// feature = "stm32l4q5",
616-
// feature = "stm32l4r5",
616+
feature = "stm32l4r5",
617617
// feature = "stm32l4s5",
618618
// feature = "stm32l4r7",
619619
// feature = "stm32l4s7",

src/lib.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
// note L4+ PAC support is mostly missing so other than r9/s9 these features don't actually exist yet
3131
// feature = "stm32l4p5",
3232
// feature = "stm32l4q5",
33-
// feature = "stm32l4r5",
33+
feature = "stm32l4r5",
3434
// feature = "stm32l4s5",
3535
// feature = "stm32l4r7",
3636
// feature = "stm32l4s7",
@@ -44,7 +44,8 @@ This crate requires one of the following features enabled:
4444
stm32l431, stm32l451, stm32l471
4545
stm32l412, stm32l422, stm32l432, stm32l442, stm32l452, stm32l462
4646
stm32l433, stm32l443
47-
stm32l475,
47+
stm32l475,
48+
stm32l4r5,
4849
stm32l476, stm32l486, stm32l496, stm32l4a6
4950
stm32l4r9, stm32l4s9
5051
"
@@ -110,6 +111,9 @@ pub use stm32l4::stm32l4x5 as pac;
110111
))]
111112
pub use stm32l4::stm32l4x6 as pac;
112113

114+
#[cfg(any(feature = "stm32l4r5"))]
115+
pub use stm32l4::stm32l4r5 as pac;
116+
113117
#[cfg(any(feature = "stm32l4r9", feature = "stm32l4s9",))]
114118
pub use stm32l4::stm32l4r9 as pac;
115119

@@ -123,7 +127,7 @@ pub mod traits;
123127

124128
#[cfg(not(any(feature = "stm32l4r9", feature = "stm32l4s9",)))]
125129
pub mod adc;
126-
#[cfg(not(any(feature = "stm32l4r9", feature = "stm32l4s9",)))]
130+
#[cfg(not(any(feature = "stm32lr5", feature = "stm32l4r9", feature = "stm32l4s9",)))]
127131
#[cfg(not(any(feature = "stm32l412",)))]
128132
pub mod can;
129133
pub mod crc;
@@ -152,6 +156,7 @@ pub mod pwr;
152156
#[cfg(not(any(
153157
feature = "stm32l433",
154158
feature = "stm32l443",
159+
feature = "stm32l4r5",
155160
feature = "stm32l4r9",
156161
feature = "stm32l4s9",
157162
)))]

src/rcc/enable.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ bus! {
143143
#[cfg(not(any(
144144
// feature = "stm32l4p5",
145145
// feature = "stm32l4q5",
146-
// feature = "stm32l4r5",
146+
feature = "stm32l4r5",
147147
// feature = "stm32l4s5",
148148
// feature = "stm32l4r7",
149149
// feature = "stm32l4s7",
@@ -161,10 +161,17 @@ bus! {
161161
}
162162

163163
// L4+
164+
#[cfg(any(feature = "stm32l4r5"))]
165+
bus! {
166+
ADC1 => (AHB2, adcen, adcfssmen, adcrst), // 13
167+
168+
FIREWALL => (APB2, fwen,,), // 7
169+
LTCD => (APB2, ltdcen, ltdcsmen, ltdcrst), // 26
170+
}
171+
164172
#[cfg(any(
165173
// feature = "stm32l4p5",
166174
// feature = "stm32l4q5",
167-
// feature = "stm32l4r5",
168175
// feature = "stm32l4s5",
169176
// feature = "stm32l4r7",
170177
// feature = "stm32l4s7",
@@ -188,7 +195,7 @@ bus! {
188195
feature = "stm32l4a6",
189196
// feature = "stm32l4p5",
190197
// feature = "stm32l4q5",
191-
// feature = "stm32l4r5",
198+
feature = "stm32l4r5",
192199
// feature = "stm32l4s5",
193200
// feature = "stm32l4r7",
194201
// feature = "stm32l4s7",
@@ -257,7 +264,7 @@ bus! {
257264
feature = "stm32l443",
258265
// feature = "stm32l4p5",
259266
// feature = "stm32l4q5",
260-
// feature = "stm32l4r5",
267+
feature = "stm32l4r5",
261268
// feature = "stm32l4s5",
262269
// feature = "stm32l4r7",
263270
// feature = "stm32l4s7",
@@ -324,7 +331,7 @@ bus! {
324331
feature = "stm32l4a6",
325332
// feature = "stm32l4p5",
326333
// feature = "stm32l4q5",
327-
// feature = "stm32l4r5",
334+
feature = "stm32l4r5",
328335
// feature = "stm32l4s5",
329336
// feature = "stm32l4r7",
330337
// feature = "stm32l4s7",
@@ -361,7 +368,7 @@ bus! {
361368
#[cfg(any(
362369
// feature = "stm32l4p5",
363370
// feature = "stm32l4q5",
364-
// feature = "stm32l4r5",
371+
feature = "stm32l4r5",
365372
// feature = "stm32l4s5",
366373
// feature = "stm32l4r7",
367374
// feature = "stm32l4s7",

src/serial.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use crate::time::{Bps, U32Ext};
3535
feature = "stm32l4a6",
3636
// feature = "stm32l4p5",
3737
// feature = "stm32l4q5",
38-
// feature = "stm32l4r5",
38+
feature = "stm32l4r5",
3939
// feature = "stm32l4s5",
4040
// feature = "stm32l4r7",
4141
// feature = "stm32l4s7",
@@ -869,7 +869,7 @@ hal! {
869869
feature = "stm32l4a6",
870870
// feature = "stm32l4p5",
871871
// feature = "stm32l4q5",
872-
// feature = "stm32l4r5",
872+
feature = "stm32l4r5",
873873
// feature = "stm32l4s5",
874874
// feature = "stm32l4r7",
875875
// feature = "stm32l4s7",
@@ -890,7 +890,7 @@ hal! {
890890
feature = "stm32l4a6",
891891
// feature = "stm32l4p5",
892892
// feature = "stm32l4q5",
893-
// feature = "stm32l4r5",
893+
feature = "stm32l4r5",
894894
// feature = "stm32l4s5",
895895
// feature = "stm32l4r7",
896896
// feature = "stm32l4s7",
@@ -1046,7 +1046,7 @@ impl_pin_traits! {
10461046
feature = "stm32l4a6",
10471047
// feature = "stm32l4p5",
10481048
// feature = "stm32l4q5",
1049-
// feature = "stm32l4r5",
1049+
feature = "stm32l4r5",
10501050
// feature = "stm32l4s5",
10511051
// feature = "stm32l4r7",
10521052
// feature = "stm32l4s7",
@@ -1074,7 +1074,7 @@ impl_pin_traits! {
10741074
feature = "stm32l4a6",
10751075
// feature = "stm32l4p5",
10761076
// feature = "stm32l4q5",
1077-
// feature = "stm32l4r5",
1077+
feature = "stm32l4r5",
10781078
// feature = "stm32l4s5",
10791079
// feature = "stm32l4r7",
10801080
// feature = "stm32l4s7",

src/spi.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ macro_rules! hal {
191191
/// Change the baud rate of the SPI
192192
pub fn reclock(&mut self, freq: Hertz, clocks: Clocks) {
193193
self.spi.cr1.modify(|_, w| w.spe().clear_bit());
194-
self.spi.cr1.modify(|_, w| {
194+
self.spi.cr1.modify(|_, w| unsafe {
195195
w.br().bits(Self::compute_baud_rate(clocks.$pclkX(), freq.into()));
196196
w.spe().set_bit()
197197
});
@@ -277,7 +277,7 @@ use crate::gpio::gpiod::*;
277277
feature = "stm32l4a6",
278278
// feature = "stm32l4p5",
279279
// feature = "stm32l4q5",
280-
// feature = "stm32l4r5",
280+
feature = "stm32l4r5",
281281
// feature = "stm32l4s5",
282282
// feature = "stm32l4r7",
283283
// feature = "stm32l4s7",
@@ -307,7 +307,7 @@ pins!(SPI1, 5,
307307
feature = "stm32l4a6",
308308
// feature = "stm32l4p5",
309309
// feature = "stm32l4q5",
310-
// feature = "stm32l4r5",
310+
feature = "stm32l4r5",
311311
// feature = "stm32l4s5",
312312
// feature = "stm32l4r7",
313313
// feature = "stm32l4s7",
@@ -340,7 +340,7 @@ pins!(SPI3, 6,
340340
feature = "stm32l4a6",
341341
// feature = "stm32l4p5",
342342
// feature = "stm32l4q5",
343-
// feature = "stm32l4r5",
343+
feature = "stm32l4r5",
344344
// feature = "stm32l4s5",
345345
// feature = "stm32l4r7",
346346
// feature = "stm32l4s7",

src/timer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ use crate::stm32::{TIM15, TIM16, TIM2, TIM6};
4444
feature = "stm32l4a6",
4545
// feature = "stm32l4p5",
4646
// feature = "stm32l4q5",
47-
// feature = "stm32l4r5",
47+
feature = "stm32l4r5",
4848
// feature = "stm32l4s5",
4949
// feature = "stm32l4r7",
5050
// feature = "stm32l4s7",

src/watchdog.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ impl IndependentWatchdog {
3939
feature = "stm32l462",
4040
feature = "stm32l433",
4141
feature = "stm32l443",
42+
feature = "stm32l4r5",
43+
feature = "stm32l4r9",
4244
))]
4345
dbgmcu.apb1fzr1.modify(|_, w| w.dbg_iwdg_stop().bit(stop));
4446
#[cfg(not(any(
@@ -53,6 +55,8 @@ impl IndependentWatchdog {
5355
feature = "stm32l462",
5456
feature = "stm32l433",
5557
feature = "stm32l443",
58+
feature = "stm32l4r5",
59+
feature = "stm32l4r9",
5660
)))]
5761
dbgmcu.apb1_fzr1.modify(|_, w| w.dbg_iwdg_stop().bit(stop));
5862
}

0 commit comments

Comments
 (0)