@@ -38,8 +38,13 @@ pub trait Instance:
38
38
fn set_stopbits ( & self , bits : config:: StopBits ) ;
39
39
#[ doc( hidden) ]
40
40
#[ inline( always) ]
41
- fn peri_address ( ) -> u32 {
42
- unsafe { & * Self :: ptr ( ) } . peri_address ( )
41
+ fn tx_peri_address ( ) -> u32 {
42
+ unsafe { & * Self :: ptr ( ) } . tx_peri_address ( )
43
+ }
44
+ #[ doc( hidden) ]
45
+ #[ inline( always) ]
46
+ fn rx_peri_address ( ) -> u32 {
47
+ unsafe { & * Self :: ptr ( ) } . rx_peri_address ( )
43
48
}
44
49
#[ doc( hidden) ]
45
50
unsafe fn steal ( ) -> Self ;
@@ -147,8 +152,11 @@ pub trait RegisterBlockImpl: crate::Sealed {
147
152
self . listen_event ( Some ( Event :: TxEmpty . into ( ) ) , None )
148
153
}
149
154
150
- // PeriAddress
151
- fn peri_address ( & self ) -> u32 ;
155
+ // PeriAddress for transfer data
156
+ fn tx_peri_address ( & self ) -> u32 ;
157
+
158
+ // PeriAddress for receive data
159
+ fn rx_peri_address ( & self ) -> u32 ;
152
160
}
153
161
154
162
macro_rules! uartCommon {
@@ -260,7 +268,11 @@ macro_rules! uartCommon {
260
268
} ) ;
261
269
}
262
270
263
- fn peri_address( & self ) -> u32 {
271
+ fn tx_peri_address( & self ) -> u32 {
272
+ self . dr( ) . as_ptr( ) as u32
273
+ }
274
+
275
+ fn rx_peri_address( & self ) -> u32 {
264
276
self . dr( ) . as_ptr( ) as u32
265
277
}
266
278
} ;
@@ -709,7 +721,7 @@ impl<UART: Instance, WORD> Serial<UART, WORD> {
709
721
unsafe impl < UART : Instance > PeriAddress for Rx < UART , u8 > {
710
722
#[ inline( always) ]
711
723
fn address ( & self ) -> u32 {
712
- self . usart . peri_address ( )
724
+ self . usart . rx_peri_address ( )
713
725
}
714
726
715
727
type MemSize = u8 ;
@@ -725,7 +737,7 @@ where
725
737
unsafe impl < UART : Instance > PeriAddress for Tx < UART , u8 > {
726
738
#[ inline( always) ]
727
739
fn address ( & self ) -> u32 {
728
- self . usart . peri_address ( )
740
+ self . usart . tx_peri_address ( )
729
741
}
730
742
731
743
type MemSize = u8 ;
0 commit comments