@@ -24,30 +24,26 @@ impl crate::Sealed for RegisterBlockUsart {}
24
24
// Implemented by all USART/UART instances
25
25
pub trait Instance :
26
26
crate :: Sealed
27
+ + crate :: Ptr < RB : RegisterBlockImpl >
28
+ + crate :: Steal
29
+ + core:: ops:: Deref < Target = Self :: RB >
27
30
+ rcc:: Enable
28
31
+ rcc:: Reset
29
32
+ rcc:: BusClock
30
33
+ CommonPins
31
- + core:: ops:: Deref < Target = Self :: RegisterBlock >
32
34
{
33
- type RegisterBlock : RegisterBlockImpl ;
34
-
35
- #[ doc( hidden) ]
36
- fn ptr ( ) -> * const Self :: RegisterBlock ;
37
35
#[ doc( hidden) ]
38
36
fn set_stopbits ( & self , bits : config:: StopBits ) ;
39
37
#[ doc( hidden) ]
40
38
#[ inline( always) ]
41
39
fn peri_address ( ) -> u32 {
42
40
unsafe { & * Self :: ptr ( ) } . peri_address ( )
43
41
}
44
- #[ doc( hidden) ]
45
- unsafe fn steal ( ) -> Self ;
46
42
}
47
43
48
44
pub trait RegisterBlockImpl : crate :: Sealed {
49
45
#[ allow( clippy:: new_ret_no_self) ]
50
- fn new < UART : Instance < RegisterBlock = Self > , WORD > (
46
+ fn new < UART : Instance + crate :: Ptr < RB = Self > , WORD > (
51
47
uart : UART ,
52
48
pins : ( impl Into < UART :: Tx < PushPull > > , impl Into < UART :: Rx < PushPull > > ) ,
53
49
config : impl Into < config:: Config > ,
@@ -267,7 +263,7 @@ macro_rules! uartCommon {
267
263
}
268
264
269
265
impl RegisterBlockImpl for RegisterBlockUsart {
270
- fn new < UART : Instance < RegisterBlock = Self > , WORD > (
266
+ fn new < UART : Instance + crate :: Ptr < RB = Self > , WORD > (
271
267
uart : UART ,
272
268
pins : ( impl Into < UART :: Tx < PushPull > > , impl Into < UART :: Rx < PushPull > > ) ,
273
269
config : impl Into < config:: Config > ,
@@ -408,7 +404,7 @@ where {
408
404
409
405
#[ cfg( feature = "uart4" ) ]
410
406
impl RegisterBlockImpl for RegisterBlockUart {
411
- fn new < UART : Instance < RegisterBlock = Self > , WORD > (
407
+ fn new < UART : Instance + crate :: Ptr < RB = Self > , WORD > (
412
408
uart : UART ,
413
409
pins : ( impl Into < UART :: Tx < PushPull > > , impl Into < UART :: Rx < PushPull > > ) ,
414
410
config : impl Into < config:: Config > ,
0 commit comments