@@ -203,7 +203,7 @@ macro_rules! hal {
203
203
$usartXen: ident,
204
204
$usartXrst: ident,
205
205
$pclkX: ident,
206
- tx: ( $dmacst: ident, $tx_chan: path) ,
206
+ tx: ( $dmacst: ident, $dmareq : literal , $ tx_chan: path) ,
207
207
rx: ( $dmacsr: ident, $rx_chan: path) ,
208
208
$is_full_uart: ident,
209
209
) ,
@@ -654,13 +654,12 @@ macro_rules! hal {
654
654
655
655
/// Checks to see if the USART peripheral has detected an receiver timeout and
656
656
/// clears the flag
657
- pub fn is_receiver_timeout( & mut self , clear: bool ) -> bool {
658
- let isr = unsafe { & ( * pac:: $USARTX:: ptr( ) ) . isr. read( ) } ;
659
- let icr = unsafe { & ( * pac:: $USARTX:: ptr( ) ) . icr } ;
660
-
657
+ pub fn is_receiver_timeout( & mut self , _clear: bool ) -> bool {
661
658
potentially_uncompilable!( $is_full_uart, {
659
+ let isr = unsafe { & ( * pac:: $USARTX:: ptr( ) ) . isr. read( ) } ;
660
+ let icr = unsafe { & ( * pac:: $USARTX:: ptr( ) ) . icr } ;
662
661
if isr. rtof( ) . bit_is_set( ) {
663
- if clear {
662
+ if _clear {
664
663
icr. write( |w| w. rtocf( ) . set_bit( ) ) ;
665
664
}
666
665
true
@@ -719,7 +718,7 @@ macro_rules! hal {
719
718
720
719
// Tell DMA to request from serial
721
720
channel. cselr( ) . modify( |_, w| {
722
- w. $dmacst( ) . bits( 0b0010 ) // TODO: Fix this, not valid for DMA2
721
+ w. $dmacst( ) . bits( $dmareq )
723
722
} ) ;
724
723
725
724
channel. ccr( ) . modify( |_, w| unsafe {
@@ -747,8 +746,8 @@ macro_rules! hal {
747
746
}
748
747
749
748
hal ! {
750
- USART1 : ( usart1, APB2 , usart1en, usart1rst, pclk2, tx: ( c4s, dma1:: C4 ) , rx: ( c5s, dma1:: C5 ) , true , ) ,
751
- USART2 : ( usart2, APB1R1 , usart2en, usart2rst, pclk1, tx: ( c7s, dma1:: C7 ) , rx: ( c6s, dma1:: C6 ) , true , ) ,
749
+ USART1 : ( usart1, APB2 , usart1en, usart1rst, pclk2, tx: ( c4s, 0b0010 , dma1:: C4 ) , rx: ( c5s, dma1:: C5 ) , true , ) ,
750
+ USART2 : ( usart2, APB1R1 , usart2en, usart2rst, pclk1, tx: ( c7s, 0b0010 , dma1:: C7 ) , rx: ( c6s, dma1:: C6 ) , true , ) ,
752
751
}
753
752
754
753
#[ cfg( any(
@@ -758,22 +757,22 @@ hal! {
758
757
feature = "stm32l4x6" ,
759
758
) ) ]
760
759
hal ! {
761
- USART3 : ( usart3, APB1R1 , usart3en, usart3rst, pclk1, tx: ( c2s, dma1:: C2 ) , rx: ( c3s, dma1:: C3 ) , true , ) ,
760
+ USART3 : ( usart3, APB1R1 , usart3en, usart3rst, pclk1, tx: ( c2s, 0b0010 , dma1:: C2 ) , rx: ( c3s, dma1:: C3 ) , true , ) ,
762
761
}
763
762
764
763
#[ cfg( any( feature = "stm32l4x5" , feature = "stm32l4x6" , ) ) ]
765
764
hal ! {
766
- UART4 : ( uart4, APB1R1 , uart4en, uart4rst, pclk1, tx: ( c3s, dma2:: C3 ) , rx: ( c5s, dma2:: C5 ) , true , ) ,
765
+ UART4 : ( uart4, APB1R1 , uart4en, uart4rst, pclk1, tx: ( c3s, 0b0010 , dma2:: C3 ) , rx: ( c5s, dma2:: C5 ) , true , ) ,
767
766
}
768
767
769
768
#[ cfg( any( feature = "stm32l4x5" , feature = "stm32l4x6" , ) ) ]
770
769
hal ! {
771
- UART5 : ( uart5, APB1R1 , uart5en, uart5rst, pclk1, tx: ( c1s, dma2:: C1 ) , rx: ( c2s, dma2:: C2 ) , true , ) ,
770
+ UART5 : ( uart5, APB1R1 , uart5en, uart5rst, pclk1, tx: ( c1s, 0b0010 , dma2:: C1 ) , rx: ( c2s, dma2:: C2 ) , true , ) ,
772
771
}
773
772
774
773
#[ cfg( feature = "stm32l4x6" ) ]
775
774
hal ! {
776
- LPUART1 : ( lpuart1, APB1R2 , lpuart1en, lpuart1rst, pclk1, tx: ( c6s, dma2:: C6 ) , rx: ( c7s, dma2:: C7 ) , false , ) ,
775
+ LPUART1 : ( lpuart1, APB1R2 , lpuart1en, lpuart1rst, pclk1, tx: ( c6s, 0b0100 , dma2:: C6 ) , rx: ( c7s, dma2:: C7 ) , false , ) ,
777
776
}
778
777
779
778
impl < USART , PINS > fmt:: Write for Serial < USART , PINS >
0 commit comments