Skip to content

Commit 6245385

Browse files
author
Tomas Kukosa
committed
Add LPUART1, USART4, USART5 support for stm32l0x3
1 parent ae16616 commit 6245385

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

src/gpio.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,26 @@ gpio!(GPIOC, gpioc, iopcen, PC, [
516516
PC15: (pc15, 15, Input<Floating>),
517517
]);
518518

519+
#[cfg(any(feature = "stm32l0x2", feature = "stm32l0x3"))]
520+
gpio!(GPIOD, gpiod, iopcen, PC, [
521+
PD0: (pd0, 0, Input<Floating>),
522+
PD1: (pd1, 1, Input<Floating>),
523+
PD2: (pd2, 2, Input<Floating>),
524+
PD3: (pd3, 3, Input<Floating>),
525+
PD4: (pd4, 4, Input<Floating>),
526+
PD5: (pd5, 5, Input<Floating>),
527+
PD6: (pd6, 6, Input<Floating>),
528+
PD7: (pd7, 7, Input<Floating>),
529+
PD8: (pd8, 8, Input<Floating>),
530+
PD9: (pd9, 9, Input<Floating>),
531+
PD10: (pd10, 10, Input<Floating>),
532+
PD11: (pd11, 11, Input<Floating>),
533+
PD12: (pd12, 12, Input<Floating>),
534+
PD13: (pd13, 13, Input<Floating>),
535+
PD14: (pd14, 14, Input<Floating>),
536+
PD15: (pd15, 15, Input<Floating>),
537+
]);
538+
519539
#[cfg(any(feature = "stm32l0x2", feature = "stm32l0x3"))]
520540
gpio!(GPIOE, gpioe, iopeen, PE, [
521541
PE0: (pe0, 0, Input<Floating>),

src/serial.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ use as_slice::{AsMutSlice, AsSlice};
2525
#[cfg(any(feature = "stm32l0x2", feature = "stm32l0x3"))]
2626
pub use crate::{
2727
dma,
28-
gpio::gpiob::{PB6, PB7},
29-
pac::USART1,
28+
gpio::gpiob::*,
29+
gpio::gpioc::*,
30+
gpio::gpiod::*,
31+
gpio::gpioe::*,
32+
pac::{LPUART1, USART1, USART4, USART5},
3033
};
3134

3235
/// Serial error
@@ -163,10 +166,17 @@ impl_pins!(
163166

164167
#[cfg(any(feature = "stm32l0x2", feature = "stm32l0x3"))]
165168
impl_pins!(
169+
LPUART1, PA2, PA3, AF6;
166170
USART1, PA9, PA10, AF4;
167171
USART1, PB6, PB7, AF0;
168172
USART2, PA2, PA3, AF4;
169173
USART2, PA14, PA15, AF4;
174+
USART2, PD5, PD6, AF0;
175+
USART4, PA0, PA1, AF6;
176+
USART4, PC10, PC11, AF6;
177+
USART4, PE8, PE9, AF6;
178+
USART5, PB3, PB4, AF6;
179+
USART5, PE10, PE11, AF6;
170180
);
171181

172182
/// Serial abstraction
@@ -514,8 +524,11 @@ usart! {
514524

515525
#[cfg(any(feature = "stm32l0x2", feature = "stm32l0x3"))]
516526
usart! {
527+
LPUART1: (lpuart1, apb1enr, lpuart1en, apb1_clk, Serial1LpExt),
517528
USART1: (usart1, apb2enr, usart1en, apb1_clk, Serial1Ext),
518529
USART2: (usart2, apb1enr, usart2en, apb1_clk, Serial2Ext),
530+
USART4: (usart4, apb1enr, usart4en, apb1_clk, Serial4Ext),
531+
USART5: (usart5, apb1enr, usart5en, apb1_clk, Serial5Ext),
519532
}
520533

521534
impl<USART> fmt::Write for Serial<USART>

0 commit comments

Comments
 (0)