@@ -120,17 +120,24 @@ pub struct DMA;
120120
121121#[ allow( non_upper_case_globals) ]  
122122pub  trait  SerialExt < Config > :  Sized  + Instance  { 
123-     const  NoTx :  Option < Self :: Tx < PushPull > >  = None ; 
124-     const  NoRx :  Option < Self :: Rx < PushPull > >  = None ; 
125123    fn  usart < Otype > ( 
126124        self , 
127-         pins :  ( 
128-             Option < impl  Into < Self :: Tx < Otype > > > , 
129-             Option < impl  Into < Self :: Rx < PushPull > > > , 
130-         ) , 
125+         pins :  ( impl  Into < Self :: Tx < Otype > > ,  impl  Into < Self :: Rx < PushPull > > ) , 
131126        config :  impl  Into < Config > , 
132127        rcc :  & mut  Rcc , 
133128    )  -> Result < Serial < Self ,  Otype > ,  InvalidConfig > ; 
129+     fn  tx < Otype > ( 
130+         self , 
131+         tx :  impl  Into < Self :: Tx < Otype > > , 
132+         config :  impl  Into < Config > , 
133+         rcc :  & mut  Rcc , 
134+     )  -> Result < Serial < Self ,  Otype > ,  InvalidConfig > ; 
135+     fn  rx ( 
136+         self , 
137+         rx :  impl  Into < Self :: Rx < PushPull > > , 
138+         config :  impl  Into < Config > , 
139+         rcc :  & mut  Rcc , 
140+     )  -> Result < Serial < Self > ,  InvalidConfig > ; 
134141} 
135142
136143impl < USART :  Instance ,  Otype >  fmt:: Write  for  Serial < USART ,  Otype > 
@@ -501,19 +508,43 @@ macro_rules! uart_lp {
501508        impl  SerialExt <LowPowerConfig > for  $USARTX { 
502509            fn  usart<Otype >( 
503510                self , 
504-                 pins:  ( 
505-                     Option <impl  Into <Self :: Tx <Otype >>>, 
506-                     Option <impl  Into <Self :: Rx <PushPull >>>, 
507-                 ) , 
511+                 pins:  ( impl  Into <Self :: Tx <Otype >>,  impl  Into <Self :: Rx <PushPull >>) , 
508512                config:  impl  Into <LowPowerConfig >, 
509513                rcc:  & mut  Rcc , 
510514            )  -> Result <Serial <Self ,  Otype >,  InvalidConfig > { 
511515                Serial :: $usartX( self ,  pins,  config,  rcc) 
512516            } 
517+             fn  tx<Otype >( 
518+                 self , 
519+                 tx:  impl  Into <Self :: Tx <Otype >>, 
520+                 config:  impl  Into <LowPowerConfig >, 
521+                 rcc:  & mut  Rcc , 
522+             )  -> Result <Serial <Self ,  Otype >,  InvalidConfig > { 
523+                 Serial :: <Self ,  _>:: _new( self ,  ( Some ( tx) ,  None :: <Self :: Rx <PushPull >>) ,  config,  rcc) 
524+             } 
525+             fn  rx( 
526+                 self , 
527+                 rx:  impl  Into <Self :: Rx <PushPull >>, 
528+                 config:  impl  Into <LowPowerConfig >, 
529+                 rcc:  & mut  Rcc , 
530+             )  -> Result <Serial <Self >,  InvalidConfig > { 
531+                 Serial :: <Self ,  _>:: _new( self ,  ( None :: <Self :: Tx <PushPull >>,  Some ( rx) ) ,  config,  rcc) 
532+             } 
513533        } 
514534
515535        impl <Otype > Serial <$USARTX,  Otype > { 
516536            pub  fn  $usartX( 
537+                 usart:  $USARTX, 
538+                 pins:  ( 
539+                     impl  Into <<$USARTX as  CommonPins >:: Tx <Otype >>, 
540+                     impl  Into <<$USARTX as  CommonPins >:: Rx <PushPull >>, 
541+                 ) , 
542+                 config:  impl  Into <LowPowerConfig >, 
543+                 rcc:  & mut  Rcc , 
544+             )  -> Result <Self ,  InvalidConfig > { 
545+                 Self :: _new( usart,  ( Some ( pins. 0 ) ,  Some ( pins. 1 ) ) ,  config,  rcc) 
546+             } 
547+             fn  _new( 
517548                usart:  $USARTX, 
518549                pins:  ( 
519550                    Option <impl  Into <<$USARTX as  CommonPins >:: Tx <Otype >>>, 
@@ -629,19 +660,43 @@ macro_rules! uart_full {
629660        impl  SerialExt <FullConfig > for  $USARTX { 
630661            fn  usart<Otype >( 
631662                self , 
632-                 pins:  ( 
633-                     Option <impl  Into <Self :: Tx <Otype >>>, 
634-                     Option <impl  Into <Self :: Rx <PushPull >>>, 
635-                 ) , 
663+                 pins:  ( impl  Into <Self :: Tx <Otype >>,  impl  Into <Self :: Rx <PushPull >>) , 
636664                config:  impl  Into <FullConfig >, 
637665                rcc:  & mut  Rcc , 
638666            )  -> Result <Serial <Self ,  Otype >,  InvalidConfig > { 
639667                Serial :: $usartX( self ,  pins,  config,  rcc) 
640668            } 
669+             fn  tx<Otype >( 
670+                 self , 
671+                 tx:  impl  Into <Self :: Tx <Otype >>, 
672+                 config:  impl  Into <FullConfig >, 
673+                 rcc:  & mut  Rcc , 
674+             )  -> Result <Serial <Self ,  Otype >,  InvalidConfig > { 
675+                 Serial :: <Self ,  _>:: _new( self ,  ( Some ( tx) ,  None :: <Self :: Rx <PushPull >>) ,  config,  rcc) 
676+             } 
677+             fn  rx( 
678+                 self , 
679+                 rx:  impl  Into <Self :: Rx <PushPull >>, 
680+                 config:  impl  Into <FullConfig >, 
681+                 rcc:  & mut  Rcc , 
682+             )  -> Result <Serial <Self >,  InvalidConfig > { 
683+                 Serial :: <Self ,  _>:: _new( self ,  ( None :: <Self :: Tx <PushPull >>,  Some ( rx) ) ,  config,  rcc) 
684+             } 
641685        } 
642686
643687        impl <Otype > Serial <$USARTX,  Otype > { 
644688            pub  fn  $usartX( 
689+                 usart:  $USARTX, 
690+                 pins:  ( 
691+                     impl  Into <<$USARTX as  CommonPins >:: Tx <Otype >>, 
692+                     impl  Into <<$USARTX as  CommonPins >:: Rx <PushPull >>, 
693+                 ) , 
694+                 config:  impl  Into <FullConfig >, 
695+                 rcc:  & mut  Rcc , 
696+             )  -> Result <Self ,  InvalidConfig > { 
697+                 Self :: _new( usart,  ( Some ( pins. 0 ) ,  Some ( pins. 1 ) ) ,  config,  rcc) 
698+             } 
699+             fn  _new( 
645700                usart:  $USARTX, 
646701                pins:  ( 
647702                    Option <impl  Into <<$USARTX as  CommonPins >:: Tx <Otype >>>, 
0 commit comments