@@ -123,17 +123,17 @@ pub struct NoDMA;
123123#[ derive( Debug ) ]  
124124pub  struct  DMA ; 
125125
126- pub  trait  SerialExt < USART ,   Config >  { 
126+ pub  trait  SerialExt < Config > :   Sized  { 
127127    fn  usart < TX ,  RX > ( 
128128        self , 
129129        tx :  TX , 
130130        rx :  RX , 
131-         config :  Config , 
131+         config :  impl   Into < Config > , 
132132        rcc :  & mut  Rcc , 
133-     )  -> Result < Serial < USART ,  TX ,  RX > ,  InvalidConfig > 
133+     )  -> Result < Serial < Self ,  TX ,  RX > ,  InvalidConfig > 
134134    where 
135-         TX :  TxPin < USART > , 
136-         RX :  RxPin < USART > ; 
135+         TX :  TxPin < Self > , 
136+         RX :  RxPin < Self > ; 
137137} 
138138
139139impl < USART ,  TX ,  RX >  fmt:: Write  for  Serial < USART ,  TX ,  RX > 
@@ -526,17 +526,17 @@ macro_rules! uart_lp {
526526    ( $USARTX: ident, 
527527        $usartX: ident,  $clk_mul: expr
528528    )  => { 
529-         impl  SerialExt <$USARTX ,   LowPowerConfig > for  $USARTX { 
529+         impl  SerialExt <LowPowerConfig > for  $USARTX { 
530530            fn  usart<TX ,  RX >( 
531531                self , 
532532                tx:  TX , 
533533                rx:  RX , 
534-                 config:  LowPowerConfig , 
534+                 config:  impl   Into < LowPowerConfig > , 
535535                rcc:  & mut  Rcc , 
536-             )  -> Result <Serial <$USARTX ,  TX ,  RX >,  InvalidConfig >
536+             )  -> Result <Serial <Self ,  TX ,  RX >,  InvalidConfig >
537537            where 
538-                 TX :  TxPin <$USARTX >, 
539-                 RX :  RxPin <$USARTX >, 
538+                 TX :  TxPin <Self >, 
539+                 RX :  RxPin <Self >, 
540540            { 
541541                Serial :: $usartX( self ,  tx,  rx,  config,  rcc) 
542542            } 
@@ -551,9 +551,11 @@ macro_rules! uart_lp {
551551                usart:  $USARTX, 
552552                tx:  TX , 
553553                rx:  RX , 
554-                 config:  LowPowerConfig , 
554+                 config:  impl   Into < LowPowerConfig > , 
555555                rcc:  & mut  Rcc , 
556556            )  -> Result <Self ,  InvalidConfig > { 
557+                 let  config = config. into( ) ; 
558+ 
557559                // Enable clock for USART 
558560                $USARTX:: enable( rcc) ; 
559561                $USARTX:: reset( rcc) ; 
@@ -670,17 +672,17 @@ macro_rules! uart_full {
670672    ( $USARTX: ident, 
671673        $usartX: ident
672674    )  => { 
673-         impl  SerialExt <$USARTX ,   FullConfig > for  $USARTX { 
675+         impl  SerialExt <FullConfig > for  $USARTX { 
674676            fn  usart<TX ,  RX >( 
675677                self , 
676678                tx:  TX , 
677679                rx:  RX , 
678-                 config:  FullConfig , 
680+                 config:  impl   Into < FullConfig > , 
679681                rcc:  & mut  Rcc , 
680-             )  -> Result <Serial <$USARTX ,  TX ,  RX >,  InvalidConfig >
682+             )  -> Result <Serial <Self ,  TX ,  RX >,  InvalidConfig >
681683            where 
682-                 TX :  TxPin <$USARTX >, 
683-                 RX :  RxPin <$USARTX >, 
684+                 TX :  TxPin <Self >, 
685+                 RX :  RxPin <Self >, 
684686            { 
685687                Serial :: $usartX( self ,  tx,  rx,  config,  rcc) 
686688            } 
@@ -695,9 +697,11 @@ macro_rules! uart_full {
695697                usart:  $USARTX, 
696698                tx:  TX , 
697699                rx:  RX , 
698-                 config:  FullConfig , 
700+                 config:  impl   Into < FullConfig > , 
699701                rcc:  & mut  Rcc , 
700702            )  -> Result <Self ,  InvalidConfig > { 
703+                 let  config = config. into( ) ; 
704+ 
701705                // Enable clock for USART 
702706                $USARTX:: enable( rcc) ; 
703707                $USARTX:: reset( rcc) ; 
0 commit comments