aboutsummaryrefslogtreecommitdiff
path: root/embassy-nrf/src/uarte.rs
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2025-09-27 18:37:33 +0200
committerDario Nieuwenhuis <[email protected]>2025-09-28 21:05:37 +0200
commitb07192079f0fc6ce210104786540aa7be8938d40 (patch)
tree659f336f177367fb82757c5b775c0f6c63894eb9 /embassy-nrf/src/uarte.rs
parente5328c78259c7e288bf54c83bc80c2d2311abdf2 (diff)
nrf/uart,timer: erase instance generics.
Diffstat (limited to 'embassy-nrf/src/uarte.rs')
-rw-r--r--embassy-nrf/src/uarte.rs148
1 files changed, 91 insertions, 57 deletions
diff --git a/embassy-nrf/src/uarte.rs b/embassy-nrf/src/uarte.rs
index 927a0ac08..66fb3b3f2 100644
--- a/embassy-nrf/src/uarte.rs
+++ b/embassy-nrf/src/uarte.rs
@@ -132,28 +132,32 @@ impl<T: Instance> interrupt::typelevel::Handler<T::Interrupt> for InterruptHandl
132} 132}
133 133
134/// UARTE driver. 134/// UARTE driver.
135pub struct Uarte<'d, T: Instance> { 135pub struct Uarte<'d> {
136 tx: UarteTx<'d, T>, 136 tx: UarteTx<'d>,
137 rx: UarteRx<'d, T>, 137 rx: UarteRx<'d>,
138} 138}
139 139
140/// Transmitter part of the UARTE driver. 140/// Transmitter part of the UARTE driver.
141/// 141///
142/// This can be obtained via [`Uarte::split`], or created directly. 142/// This can be obtained via [`Uarte::split`], or created directly.
143pub struct UarteTx<'d, T: Instance> { 143pub struct UarteTx<'d> {
144 _p: Peri<'d, T>, 144 r: pac::uarte::Uarte,
145 state: &'static State,
146 _p: PhantomData<&'d ()>,
145} 147}
146 148
147/// Receiver part of the UARTE driver. 149/// Receiver part of the UARTE driver.
148/// 150///
149/// This can be obtained via [`Uarte::split`], or created directly. 151/// This can be obtained via [`Uarte::split`], or created directly.
150pub struct UarteRx<'d, T: Instance> { 152pub struct UarteRx<'d> {
151 _p: Peri<'d, T>, 153 r: pac::uarte::Uarte,
154 state: &'static State,
155 _p: PhantomData<&'d ()>,
152} 156}
153 157
154impl<'d, T: Instance> Uarte<'d, T> { 158impl<'d> Uarte<'d> {
155 /// Create a new UARTE without hardware flow control 159 /// Create a new UARTE without hardware flow control
156 pub fn new( 160 pub fn new<T: Instance>(
157 uarte: Peri<'d, T>, 161 uarte: Peri<'d, T>,
158 rxd: Peri<'d, impl GpioPin>, 162 rxd: Peri<'d, impl GpioPin>,
159 txd: Peri<'d, impl GpioPin>, 163 txd: Peri<'d, impl GpioPin>,
@@ -164,7 +168,7 @@ impl<'d, T: Instance> Uarte<'d, T> {
164 } 168 }
165 169
166 /// Create a new UARTE with hardware flow control (RTS/CTS) 170 /// Create a new UARTE with hardware flow control (RTS/CTS)
167 pub fn new_with_rtscts( 171 pub fn new_with_rtscts<T: Instance>(
168 uarte: Peri<'d, T>, 172 uarte: Peri<'d, T>,
169 rxd: Peri<'d, impl GpioPin>, 173 rxd: Peri<'d, impl GpioPin>,
170 txd: Peri<'d, impl GpioPin>, 174 txd: Peri<'d, impl GpioPin>,
@@ -183,8 +187,8 @@ impl<'d, T: Instance> Uarte<'d, T> {
183 ) 187 )
184 } 188 }
185 189
186 fn new_inner( 190 fn new_inner<T: Instance>(
187 uarte: Peri<'d, T>, 191 _uarte: Peri<'d, T>,
188 rxd: Peri<'d, AnyPin>, 192 rxd: Peri<'d, AnyPin>,
189 txd: Peri<'d, AnyPin>, 193 txd: Peri<'d, AnyPin>,
190 cts: Option<Peri<'d, AnyPin>>, 194 cts: Option<Peri<'d, AnyPin>>,
@@ -211,16 +215,22 @@ impl<'d, T: Instance> Uarte<'d, T> {
211 215
212 Self { 216 Self {
213 tx: UarteTx { 217 tx: UarteTx {
214 _p: unsafe { uarte.clone_unchecked() }, 218 r: T::regs(),
219 state: T::state(),
220 _p: PhantomData {},
221 },
222 rx: UarteRx {
223 r: T::regs(),
224 state: T::state(),
225 _p: PhantomData {},
215 }, 226 },
216 rx: UarteRx { _p: uarte },
217 } 227 }
218 } 228 }
219 229
220 /// Split the Uarte into the transmitter and receiver parts. 230 /// Split the Uarte into the transmitter and receiver parts.
221 /// 231 ///
222 /// This is useful to concurrently transmit and receive from independent tasks. 232 /// This is useful to concurrently transmit and receive from independent tasks.
223 pub fn split(self) -> (UarteTx<'d, T>, UarteRx<'d, T>) { 233 pub fn split(self) -> (UarteTx<'d>, UarteRx<'d>) {
224 (self.tx, self.rx) 234 (self.tx, self.rx)
225 } 235 }
226 236
@@ -228,7 +238,7 @@ impl<'d, T: Instance> Uarte<'d, T> {
228 /// 238 ///
229 /// The returned halves borrow from `self`, so you can drop them and go back to using 239 /// The returned halves borrow from `self`, so you can drop them and go back to using
230 /// the "un-split" `self`. This allows temporarily splitting the UART. 240 /// the "un-split" `self`. This allows temporarily splitting the UART.
231 pub fn split_by_ref(&mut self) -> (&mut UarteTx<'d, T>, &mut UarteRx<'d, T>) { 241 pub fn split_by_ref(&mut self) -> (&mut UarteTx<'d>, &mut UarteRx<'d>) {
232 (&mut self.tx, &mut self.rx) 242 (&mut self.tx, &mut self.rx)
233 } 243 }
234 244
@@ -240,13 +250,13 @@ impl<'d, T: Instance> Uarte<'d, T> {
240 timer: Peri<'d, U>, 250 timer: Peri<'d, U>,
241 ppi_ch1: Peri<'d, impl ConfigurableChannel + 'd>, 251 ppi_ch1: Peri<'d, impl ConfigurableChannel + 'd>,
242 ppi_ch2: Peri<'d, impl ConfigurableChannel + 'd>, 252 ppi_ch2: Peri<'d, impl ConfigurableChannel + 'd>,
243 ) -> (UarteTx<'d, T>, UarteRxWithIdle<'d, T, U>) { 253 ) -> (UarteTx<'d>, UarteRxWithIdle<'d>) {
244 (self.tx, self.rx.with_idle(timer, ppi_ch1, ppi_ch2)) 254 (self.tx, self.rx.with_idle(timer, ppi_ch1, ppi_ch2))
245 } 255 }
246 256
247 /// Return the endtx event for use with PPI 257 /// Return the endtx event for use with PPI
248 pub fn event_endtx(&self) -> Event<'_> { 258 pub fn event_endtx(&self) -> Event<'_> {
249 let r = T::regs(); 259 let r = self.tx.r;
250 Event::from_reg(r.events_endtx()) 260 Event::from_reg(r.events_endtx())
251 } 261 }
252 262
@@ -343,9 +353,9 @@ pub(crate) fn configure(r: pac::uarte::Uarte, config: Config, hardware_flow_cont
343 apply_workaround_for_enable_anomaly(r); 353 apply_workaround_for_enable_anomaly(r);
344} 354}
345 355
346impl<'d, T: Instance> UarteTx<'d, T> { 356impl<'d> UarteTx<'d> {
347 /// Create a new tx-only UARTE without hardware flow control 357 /// Create a new tx-only UARTE without hardware flow control
348 pub fn new( 358 pub fn new<T: Instance>(
349 uarte: Peri<'d, T>, 359 uarte: Peri<'d, T>,
350 _irq: impl interrupt::typelevel::Binding<T::Interrupt, InterruptHandler<T>> + 'd, 360 _irq: impl interrupt::typelevel::Binding<T::Interrupt, InterruptHandler<T>> + 'd,
351 txd: Peri<'d, impl GpioPin>, 361 txd: Peri<'d, impl GpioPin>,
@@ -355,7 +365,7 @@ impl<'d, T: Instance> UarteTx<'d, T> {
355 } 365 }
356 366
357 /// Create a new tx-only UARTE with hardware flow control (RTS/CTS) 367 /// Create a new tx-only UARTE with hardware flow control (RTS/CTS)
358 pub fn new_with_rtscts( 368 pub fn new_with_rtscts<T: Instance>(
359 uarte: Peri<'d, T>, 369 uarte: Peri<'d, T>,
360 _irq: impl interrupt::typelevel::Binding<T::Interrupt, InterruptHandler<T>> + 'd, 370 _irq: impl interrupt::typelevel::Binding<T::Interrupt, InterruptHandler<T>> + 'd,
361 txd: Peri<'d, impl GpioPin>, 371 txd: Peri<'d, impl GpioPin>,
@@ -365,7 +375,12 @@ impl<'d, T: Instance> UarteTx<'d, T> {
365 Self::new_inner(uarte, txd.into(), Some(cts.into()), config) 375 Self::new_inner(uarte, txd.into(), Some(cts.into()), config)
366 } 376 }
367 377
368 fn new_inner(uarte: Peri<'d, T>, txd: Peri<'d, AnyPin>, cts: Option<Peri<'d, AnyPin>>, config: Config) -> Self { 378 fn new_inner<T: Instance>(
379 _uarte: Peri<'d, T>,
380 txd: Peri<'d, AnyPin>,
381 cts: Option<Peri<'d, AnyPin>>,
382 config: Config,
383 ) -> Self {
369 let r = T::regs(); 384 let r = T::regs();
370 385
371 configure(r, config, cts.is_some()); 386 configure(r, config, cts.is_some());
@@ -378,7 +393,11 @@ impl<'d, T: Instance> UarteTx<'d, T> {
378 let s = T::state(); 393 let s = T::state();
379 s.tx_rx_refcount.store(1, Ordering::Relaxed); 394 s.tx_rx_refcount.store(1, Ordering::Relaxed);
380 395
381 Self { _p: uarte } 396 Self {
397 r: T::regs(),
398 state: T::state(),
399 _p: PhantomData {},
400 }
382 } 401 }
383 402
384 /// Write all bytes in the buffer. 403 /// Write all bytes in the buffer.
@@ -409,8 +428,8 @@ impl<'d, T: Instance> UarteTx<'d, T> {
409 let ptr = buffer.as_ptr(); 428 let ptr = buffer.as_ptr();
410 let len = buffer.len(); 429 let len = buffer.len();
411 430
412 let r = T::regs(); 431 let r = self.r;
413 let s = T::state(); 432 let s = self.state;
414 433
415 let drop = OnDrop::new(move || { 434 let drop = OnDrop::new(move || {
416 trace!("write drop: stopping"); 435 trace!("write drop: stopping");
@@ -479,7 +498,7 @@ impl<'d, T: Instance> UarteTx<'d, T> {
479 let ptr = buffer.as_ptr(); 498 let ptr = buffer.as_ptr();
480 let len = buffer.len(); 499 let len = buffer.len();
481 500
482 let r = T::regs(); 501 let r = self.r;
483 502
484 r.txd().ptr().write_value(ptr as u32); 503 r.txd().ptr().write_value(ptr as u32);
485 r.txd().maxcnt().write(|w| w.set_maxcnt(len as _)); 504 r.txd().maxcnt().write(|w| w.set_maxcnt(len as _));
@@ -501,11 +520,11 @@ impl<'d, T: Instance> UarteTx<'d, T> {
501 } 520 }
502} 521}
503 522
504impl<'a, T: Instance> Drop for UarteTx<'a, T> { 523impl<'a> Drop for UarteTx<'a> {
505 fn drop(&mut self) { 524 fn drop(&mut self) {
506 trace!("uarte tx drop"); 525 trace!("uarte tx drop");
507 526
508 let r = T::regs(); 527 let r = self.r;
509 528
510 let did_stoptx = r.events_txstarted().read() != 0; 529 let did_stoptx = r.events_txstarted().read() != 0;
511 trace!("did_stoptx {}", did_stoptx); 530 trace!("did_stoptx {}", did_stoptx);
@@ -513,15 +532,15 @@ impl<'a, T: Instance> Drop for UarteTx<'a, T> {
513 // Wait for txstopped, if needed. 532 // Wait for txstopped, if needed.
514 while did_stoptx && r.events_txstopped().read() == 0 {} 533 while did_stoptx && r.events_txstopped().read() == 0 {}
515 534
516 let s = T::state(); 535 let s = self.state;
517 536
518 drop_tx_rx(r, s); 537 drop_tx_rx(r, s);
519 } 538 }
520} 539}
521 540
522impl<'d, T: Instance> UarteRx<'d, T> { 541impl<'d> UarteRx<'d> {
523 /// Create a new rx-only UARTE without hardware flow control 542 /// Create a new rx-only UARTE without hardware flow control
524 pub fn new( 543 pub fn new<T: Instance>(
525 uarte: Peri<'d, T>, 544 uarte: Peri<'d, T>,
526 _irq: impl interrupt::typelevel::Binding<T::Interrupt, InterruptHandler<T>> + 'd, 545 _irq: impl interrupt::typelevel::Binding<T::Interrupt, InterruptHandler<T>> + 'd,
527 rxd: Peri<'d, impl GpioPin>, 546 rxd: Peri<'d, impl GpioPin>,
@@ -531,7 +550,7 @@ impl<'d, T: Instance> UarteRx<'d, T> {
531 } 550 }
532 551
533 /// Create a new rx-only UARTE with hardware flow control (RTS/CTS) 552 /// Create a new rx-only UARTE with hardware flow control (RTS/CTS)
534 pub fn new_with_rtscts( 553 pub fn new_with_rtscts<T: Instance>(
535 uarte: Peri<'d, T>, 554 uarte: Peri<'d, T>,
536 _irq: impl interrupt::typelevel::Binding<T::Interrupt, InterruptHandler<T>> + 'd, 555 _irq: impl interrupt::typelevel::Binding<T::Interrupt, InterruptHandler<T>> + 'd,
537 rxd: Peri<'d, impl GpioPin>, 556 rxd: Peri<'d, impl GpioPin>,
@@ -543,13 +562,18 @@ impl<'d, T: Instance> UarteRx<'d, T> {
543 562
544 /// Check for errors and clear the error register if an error occured. 563 /// Check for errors and clear the error register if an error occured.
545 fn check_and_clear_errors(&mut self) -> Result<(), Error> { 564 fn check_and_clear_errors(&mut self) -> Result<(), Error> {
546 let r = T::regs(); 565 let r = self.r;
547 let err_bits = r.errorsrc().read(); 566 let err_bits = r.errorsrc().read();
548 r.errorsrc().write_value(err_bits); 567 r.errorsrc().write_value(err_bits);
549 ErrorSource::from_bits_truncate(err_bits.0).check() 568 ErrorSource::from_bits_truncate(err_bits.0).check()
550 } 569 }
551 570
552 fn new_inner(uarte: Peri<'d, T>, rxd: Peri<'d, AnyPin>, rts: Option<Peri<'d, AnyPin>>, config: Config) -> Self { 571 fn new_inner<T: Instance>(
572 _uarte: Peri<'d, T>,
573 rxd: Peri<'d, AnyPin>,
574 rts: Option<Peri<'d, AnyPin>>,
575 config: Config,
576 ) -> Self {
553 let r = T::regs(); 577 let r = T::regs();
554 578
555 configure(r, config, rts.is_some()); 579 configure(r, config, rts.is_some());
@@ -562,7 +586,11 @@ impl<'d, T: Instance> UarteRx<'d, T> {
562 let s = T::state(); 586 let s = T::state();
563 s.tx_rx_refcount.store(1, Ordering::Relaxed); 587 s.tx_rx_refcount.store(1, Ordering::Relaxed);
564 588
565 Self { _p: uarte } 589 Self {
590 r: T::regs(),
591 state: T::state(),
592 _p: PhantomData {},
593 }
566 } 594 }
567 595
568 /// Upgrade to an instance that supports idle line detection. 596 /// Upgrade to an instance that supports idle line detection.
@@ -571,10 +599,10 @@ impl<'d, T: Instance> UarteRx<'d, T> {
571 timer: Peri<'d, U>, 599 timer: Peri<'d, U>,
572 ppi_ch1: Peri<'d, impl ConfigurableChannel + 'd>, 600 ppi_ch1: Peri<'d, impl ConfigurableChannel + 'd>,
573 ppi_ch2: Peri<'d, impl ConfigurableChannel + 'd>, 601 ppi_ch2: Peri<'d, impl ConfigurableChannel + 'd>,
574 ) -> UarteRxWithIdle<'d, T, U> { 602 ) -> UarteRxWithIdle<'d> {
575 let timer = Timer::new(timer); 603 let timer = Timer::new(timer);
576 604
577 let r = T::regs(); 605 let r = self.r;
578 606
579 // BAUDRATE register values are `baudrate * 2^32 / 16000000` 607 // BAUDRATE register values are `baudrate * 2^32 / 16000000`
580 // source: https://devzone.nordicsemi.com/f/nordic-q-a/391/uart-baudrate-register-values 608 // source: https://devzone.nordicsemi.com/f/nordic-q-a/391/uart-baudrate-register-values
@@ -605,11 +633,15 @@ impl<'d, T: Instance> UarteRx<'d, T> {
605 ); 633 );
606 ppi_ch2.enable(); 634 ppi_ch2.enable();
607 635
636 let state = self.state;
637
608 UarteRxWithIdle { 638 UarteRxWithIdle {
609 rx: self, 639 rx: self,
610 timer, 640 timer,
611 ppi_ch1, 641 ppi_ch1: ppi_ch1,
612 _ppi_ch2: ppi_ch2, 642 _ppi_ch2: ppi_ch2,
643 r: r,
644 state: state,
613 } 645 }
614 } 646 }
615 647
@@ -625,8 +657,8 @@ impl<'d, T: Instance> UarteRx<'d, T> {
625 let ptr = buffer.as_ptr(); 657 let ptr = buffer.as_ptr();
626 let len = buffer.len(); 658 let len = buffer.len();
627 659
628 let r = T::regs(); 660 let r = self.r;
629 let s = T::state(); 661 let s = self.state;
630 662
631 let drop = OnDrop::new(move || { 663 let drop = OnDrop::new(move || {
632 trace!("read drop: stopping"); 664 trace!("read drop: stopping");
@@ -692,7 +724,7 @@ impl<'d, T: Instance> UarteRx<'d, T> {
692 let ptr = buffer.as_ptr(); 724 let ptr = buffer.as_ptr();
693 let len = buffer.len(); 725 let len = buffer.len();
694 726
695 let r = T::regs(); 727 let r = self.r;
696 728
697 r.rxd().ptr().write_value(ptr as u32); 729 r.rxd().ptr().write_value(ptr as u32);
698 r.rxd().maxcnt().write(|w| w.set_maxcnt(len as _)); 730 r.rxd().maxcnt().write(|w| w.set_maxcnt(len as _));
@@ -718,11 +750,11 @@ impl<'d, T: Instance> UarteRx<'d, T> {
718 } 750 }
719} 751}
720 752
721impl<'a, T: Instance> Drop for UarteRx<'a, T> { 753impl<'a> Drop for UarteRx<'a> {
722 fn drop(&mut self) { 754 fn drop(&mut self) {
723 trace!("uarte rx drop"); 755 trace!("uarte rx drop");
724 756
725 let r = T::regs(); 757 let r = self.r;
726 758
727 let did_stoprx = r.events_rxstarted().read() != 0; 759 let did_stoprx = r.events_rxstarted().read() != 0;
728 trace!("did_stoprx {}", did_stoprx); 760 trace!("did_stoprx {}", did_stoprx);
@@ -730,7 +762,7 @@ impl<'a, T: Instance> Drop for UarteRx<'a, T> {
730 // Wait for rxto, if needed. 762 // Wait for rxto, if needed.
731 while did_stoprx && r.events_rxto().read() == 0 {} 763 while did_stoprx && r.events_rxto().read() == 0 {}
732 764
733 let s = T::state(); 765 let s = self.state;
734 766
735 drop_tx_rx(r, s); 767 drop_tx_rx(r, s);
736 } 768 }
@@ -739,14 +771,16 @@ impl<'a, T: Instance> Drop for UarteRx<'a, T> {
739/// Receiver part of the UARTE driver, with `read_until_idle` support. 771/// Receiver part of the UARTE driver, with `read_until_idle` support.
740/// 772///
741/// This can be obtained via [`Uarte::split_with_idle`]. 773/// This can be obtained via [`Uarte::split_with_idle`].
742pub struct UarteRxWithIdle<'d, T: Instance, U: TimerInstance> { 774pub struct UarteRxWithIdle<'d> {
743 rx: UarteRx<'d, T>, 775 rx: UarteRx<'d>,
744 timer: Timer<'d, U>, 776 timer: Timer<'d>,
745 ppi_ch1: Ppi<'d, AnyConfigurableChannel, 1, 2>, 777 ppi_ch1: Ppi<'d, AnyConfigurableChannel, 1, 2>,
746 _ppi_ch2: Ppi<'d, AnyConfigurableChannel, 1, 1>, 778 _ppi_ch2: Ppi<'d, AnyConfigurableChannel, 1, 1>,
779 r: pac::uarte::Uarte,
780 state: &'static State,
747} 781}
748 782
749impl<'d, T: Instance, U: TimerInstance> UarteRxWithIdle<'d, T, U> { 783impl<'d> UarteRxWithIdle<'d> {
750 /// Read bytes until the buffer is filled. 784 /// Read bytes until the buffer is filled.
751 pub async fn read(&mut self, buffer: &mut [u8]) -> Result<(), Error> { 785 pub async fn read(&mut self, buffer: &mut [u8]) -> Result<(), Error> {
752 self.ppi_ch1.disable(); 786 self.ppi_ch1.disable();
@@ -773,8 +807,8 @@ impl<'d, T: Instance, U: TimerInstance> UarteRxWithIdle<'d, T, U> {
773 let ptr = buffer.as_ptr(); 807 let ptr = buffer.as_ptr();
774 let len = buffer.len(); 808 let len = buffer.len();
775 809
776 let r = T::regs(); 810 let r = self.r;
777 let s = T::state(); 811 let s = self.state;
778 812
779 self.ppi_ch1.enable(); 813 self.ppi_ch1.enable();
780 814
@@ -846,7 +880,7 @@ impl<'d, T: Instance, U: TimerInstance> UarteRxWithIdle<'d, T, U> {
846 let ptr = buffer.as_ptr(); 880 let ptr = buffer.as_ptr();
847 let len = buffer.len(); 881 let len = buffer.len();
848 882
849 let r = T::regs(); 883 let r = self.r;
850 884
851 self.ppi_ch1.enable(); 885 self.ppi_ch1.enable();
852 886
@@ -997,7 +1031,7 @@ macro_rules! impl_uarte {
997mod eh02 { 1031mod eh02 {
998 use super::*; 1032 use super::*;
999 1033
1000 impl<'d, T: Instance> embedded_hal_02::blocking::serial::Write<u8> for Uarte<'d, T> { 1034 impl<'d> embedded_hal_02::blocking::serial::Write<u8> for Uarte<'d> {
1001 type Error = Error; 1035 type Error = Error;
1002 1036
1003 fn bwrite_all(&mut self, buffer: &[u8]) -> Result<(), Self::Error> { 1037 fn bwrite_all(&mut self, buffer: &[u8]) -> Result<(), Self::Error> {
@@ -1009,7 +1043,7 @@ mod eh02 {
1009 } 1043 }
1010 } 1044 }
1011 1045
1012 impl<'d, T: Instance> embedded_hal_02::blocking::serial::Write<u8> for UarteTx<'d, T> { 1046 impl<'d> embedded_hal_02::blocking::serial::Write<u8> for UarteTx<'d> {
1013 type Error = Error; 1047 type Error = Error;
1014 1048
1015 fn bwrite_all(&mut self, buffer: &[u8]) -> Result<(), Self::Error> { 1049 fn bwrite_all(&mut self, buffer: &[u8]) -> Result<(), Self::Error> {
@@ -1038,22 +1072,22 @@ mod _embedded_io {
1038 } 1072 }
1039 } 1073 }
1040 1074
1041 impl<'d, U: Instance> embedded_io_async::ErrorType for Uarte<'d, U> { 1075 impl<'d> embedded_io_async::ErrorType for Uarte<'d> {
1042 type Error = Error; 1076 type Error = Error;
1043 } 1077 }
1044 1078
1045 impl<'d, U: Instance> embedded_io_async::ErrorType for UarteTx<'d, U> { 1079 impl<'d> embedded_io_async::ErrorType for UarteTx<'d> {
1046 type Error = Error; 1080 type Error = Error;
1047 } 1081 }
1048 1082
1049 impl<'d, U: Instance> embedded_io_async::Write for Uarte<'d, U> { 1083 impl<'d> embedded_io_async::Write for Uarte<'d> {
1050 async fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error> { 1084 async fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error> {
1051 self.write(buf).await?; 1085 self.write(buf).await?;
1052 Ok(buf.len()) 1086 Ok(buf.len())
1053 } 1087 }
1054 } 1088 }
1055 1089
1056 impl<'d: 'd, U: Instance> embedded_io_async::Write for UarteTx<'d, U> { 1090 impl<'d> embedded_io_async::Write for UarteTx<'d> {
1057 async fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error> { 1091 async fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error> {
1058 self.write(buf).await?; 1092 self.write(buf).await?;
1059 Ok(buf.len()) 1093 Ok(buf.len())