@@ -2,13 +2,14 @@ use core::fmt;
2
2
use core:: marker:: PhantomData ;
3
3
use core:: ptr;
4
4
5
+ use nb:: block;
6
+
5
7
use crate :: gpio:: { gpioa:: * , gpiob:: * , gpioc:: * , gpiod:: * , gpioe:: * } ;
6
8
use crate :: gpio:: { PinMode , AltMode } ;
7
9
use crate :: hal;
8
10
use crate :: hal:: prelude:: * ;
9
11
pub use crate :: pac:: { LPUART1 , USART1 , USART2 , USART4 , USART5 } ;
10
12
use crate :: rcc:: Rcc ;
11
- use nb:: block;
12
13
13
14
#[ cfg( any( feature = "stm32l0x2" , feature = "stm32l0x3" ) ) ]
14
15
use core:: {
@@ -23,7 +24,7 @@ use as_slice::{AsMutSlice, AsSlice};
23
24
pub use crate :: dma;
24
25
25
26
#[ cfg( any( feature = "stm32l0x2" , feature = "stm32l0x3" ) ) ]
26
- use dma:: Buffer ;
27
+ use crate :: dma:: Buffer ;
27
28
28
29
/// Serial error
29
30
#[ derive( Debug ) ]
@@ -581,7 +582,7 @@ macro_rules! usart {
581
582
}
582
583
}
583
584
584
- #[ cfg( any( feature = "stm32l0x2" , feature = "stm32l0x3" ) ) ]
585
+ #[ cfg( any( feature = "stm32l0x2" , feature = "stm32l0x3" ) ) ]
585
586
impl Tx <$USARTX> {
586
587
pub fn write_all<Buffer , Channel >( self ,
587
588
dma: & mut dma:: Handle ,
@@ -638,17 +639,27 @@ macro_rules! usart {
638
639
}
639
640
}
640
641
641
- #[ cfg( feature = "stm32l0x1" ) ]
642
+ // LPUART1 and USART2 are available on category 1/2/3/5 MCUs
643
+ #[ cfg( any(
644
+ feature = "io-STM32L021" ,
645
+ feature = "io-STM32L031" ,
646
+ feature = "io-STM32L051" ,
647
+ feature = "io-STM32L071" ,
648
+ ) ) ]
642
649
usart ! {
643
- LPUART1 : ( lpuart1, apb1enr, lpuart1en, apb1_clk, Serial1Ext ) ,
650
+ LPUART1 : ( lpuart1, apb1enr, lpuart1en, apb1_clk, Serial1LpExt ) ,
644
651
USART2 : ( usart2, apb1enr, usart2en, apb1_clk, Serial2Ext ) ,
645
652
}
646
653
647
- #[ cfg( any( feature = "stm32l0x2" , feature = "stm32l0x3" ) ) ]
654
+ // USART1 is available on category 3/5 MCUs
655
+ #[ cfg( any( feature = "io-STM32L051" , feature = "io-STM32L071" ) ) ]
648
656
usart ! {
649
- LPUART1 : ( lpuart1, apb1enr, lpuart1en, apb1_clk, Serial1LpExt ) ,
650
657
USART1 : ( usart1, apb2enr, usart1en, apb1_clk, Serial1Ext ) ,
651
- USART2 : ( usart2, apb1enr, usart2en, apb1_clk, Serial2Ext ) ,
658
+ }
659
+
660
+ // USART4 and USART5 are available on category 5 MCUs
661
+ #[ cfg( feature = "io-STM32L071" ) ]
662
+ usart ! {
652
663
USART4 : ( usart4, apb1enr, usart4en, apb1_clk, Serial4Ext ) ,
653
664
USART5 : ( usart5, apb1enr, usart5en, apb1_clk, Serial5Ext ) ,
654
665
}
0 commit comments