@@ -37,7 +37,15 @@ pub trait Instance:
37
37
#[ doc( hidden) ]
38
38
fn set_stopbits ( & self , bits : config:: StopBits ) ;
39
39
#[ doc( hidden) ]
40
- fn peri_address ( ) -> u32 ;
40
+ #[ inline( always) ]
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 ( )
48
+ }
41
49
#[ doc( hidden) ]
42
50
unsafe fn steal ( ) -> Self ;
43
51
}
@@ -144,8 +152,11 @@ pub trait RegisterBlockImpl: crate::Sealed {
144
152
self . listen_event ( Some ( Event :: TxEmpty . into ( ) ) , None )
145
153
}
146
154
147
- // PeriAddress
148
- 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 ;
149
160
}
150
161
151
162
macro_rules! uartCommon {
@@ -257,7 +268,11 @@ macro_rules! uartCommon {
257
268
} ) ;
258
269
}
259
270
260
- 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 {
261
276
self . dr( ) . as_ptr( ) as u32
262
277
}
263
278
} ;
@@ -706,7 +721,7 @@ impl<UART: Instance, WORD> Serial<UART, WORD> {
706
721
unsafe impl < UART : Instance > PeriAddress for Rx < UART , u8 > {
707
722
#[ inline( always) ]
708
723
fn address ( & self ) -> u32 {
709
- self . usart . peri_address ( )
724
+ self . usart . rx_peri_address ( )
710
725
}
711
726
712
727
type MemSize = u8 ;
@@ -722,7 +737,7 @@ where
722
737
unsafe impl < UART : Instance > PeriAddress for Tx < UART , u8 > {
723
738
#[ inline( always) ]
724
739
fn address ( & self ) -> u32 {
725
- self . usart . peri_address ( )
740
+ self . usart . tx_peri_address ( )
726
741
}
727
742
728
743
type MemSize = u8 ;
0 commit comments