@@ -37,7 +37,15 @@ pub trait Instance:
3737 #[ doc( hidden) ]
3838 fn set_stopbits ( & self , bits : config:: StopBits ) ;
3939 #[ 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+ }
4149 #[ doc( hidden) ]
4250 unsafe fn steal ( ) -> Self ;
4351}
@@ -144,8 +152,11 @@ pub trait RegisterBlockImpl: crate::Sealed {
144152 self . listen_event ( Some ( Event :: TxEmpty . into ( ) ) , None )
145153 }
146154
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 ;
149160}
150161
151162macro_rules! uartCommon {
@@ -257,7 +268,11 @@ macro_rules! uartCommon {
257268 } ) ;
258269 }
259270
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 {
261276 self . dr( ) . as_ptr( ) as u32
262277 }
263278 } ;
@@ -706,7 +721,7 @@ impl<UART: Instance, WORD> Serial<UART, WORD> {
706721unsafe impl < UART : Instance > PeriAddress for Rx < UART , u8 > {
707722 #[ inline( always) ]
708723 fn address ( & self ) -> u32 {
709- self . usart . peri_address ( )
724+ self . usart . rx_peri_address ( )
710725 }
711726
712727 type MemSize = u8 ;
@@ -722,7 +737,7 @@ where
722737unsafe impl < UART : Instance > PeriAddress for Tx < UART , u8 > {
723738 #[ inline( always) ]
724739 fn address ( & self ) -> u32 {
725- self . usart . peri_address ( )
740+ self . usart . tx_peri_address ( )
726741 }
727742
728743 type MemSize = u8 ;
0 commit comments