@@ -36,8 +36,13 @@ pub trait Instance:
36
36
fn set_stopbits ( & self , bits : config:: StopBits ) ;
37
37
#[ doc( hidden) ]
38
38
#[ inline( always) ]
39
- fn peri_address ( ) -> u32 {
40
- unsafe { & * Self :: ptr ( ) } . peri_address ( )
39
+ fn tx_peri_address ( ) -> u32 {
40
+ unsafe { & * Self :: ptr ( ) } . tx_peri_address ( )
41
+ }
42
+ #[ doc( hidden) ]
43
+ #[ inline( always) ]
44
+ fn rx_peri_address ( ) -> u32 {
45
+ unsafe { & * Self :: ptr ( ) } . rx_peri_address ( )
41
46
}
42
47
}
43
48
@@ -143,8 +148,11 @@ pub trait RegisterBlockImpl: crate::Sealed {
143
148
self . listen_event ( Some ( Event :: TxEmpty . into ( ) ) , None )
144
149
}
145
150
146
- // PeriAddress
147
- fn peri_address ( & self ) -> u32 ;
151
+ // PeriAddress for transfer data
152
+ fn tx_peri_address ( & self ) -> u32 ;
153
+
154
+ // PeriAddress for receive data
155
+ fn rx_peri_address ( & self ) -> u32 ;
148
156
149
157
fn enable_dma ( & self , dc : config:: DmaConfig ) ;
150
158
@@ -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
@@ -636,7 +648,7 @@ impl<UART: Instance, WORD> Serial<UART, WORD> {
636
648
unsafe impl < UART : Instance > PeriAddress for Rx < UART , u8 > {
637
649
#[ inline( always) ]
638
650
fn address ( & self ) -> u32 {
639
- self . usart . peri_address ( )
651
+ self . usart . rx_peri_address ( )
640
652
}
641
653
642
654
type MemSize = u8 ;
@@ -652,7 +664,7 @@ where
652
664
unsafe impl < UART : Instance > PeriAddress for Tx < UART , u8 > {
653
665
#[ inline( always) ]
654
666
fn address ( & self ) -> u32 {
655
- self . usart . peri_address ( )
667
+ self . usart . tx_peri_address ( )
656
668
}
657
669
658
670
type MemSize = u8 ;
0 commit comments