diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-08-31 02:46:52 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-08-31 03:11:21 +0200 |
| commit | 8ba421f324f0971b2394f497d8fbbee65847f583 (patch) | |
| tree | 81c4f1f6d62fdc85f17c466e26d8bb16198a7301 /embassy-nrf/src | |
| parent | fe08bdf0d81e784c3af642128b91a53514b79a63 (diff) | |
Do not use cfg_if for embedded-hal-async feature gates.
Old code used `cfg_if!` because rustc still parses code inside disabled cfg's, and Rust stable at that time couldn't parse the new GAT where-clause location. This is not the case anymore.
Diffstat (limited to 'embassy-nrf/src')
| -rw-r--r-- | embassy-nrf/src/gpiote.rs | 91 | ||||
| -rw-r--r-- | embassy-nrf/src/spim.rs | 58 | ||||
| -rw-r--r-- | embassy-nrf/src/twim.rs | 60 | ||||
| -rw-r--r-- | embassy-nrf/src/uarte.rs | 99 |
4 files changed, 154 insertions, 154 deletions
diff --git a/embassy-nrf/src/gpiote.rs b/embassy-nrf/src/gpiote.rs index b52035705..d99f592b0 100644 --- a/embassy-nrf/src/gpiote.rs +++ b/embassy-nrf/src/gpiote.rs | |||
| @@ -469,72 +469,73 @@ mod eh1 { | |||
| 469 | } | 469 | } |
| 470 | } | 470 | } |
| 471 | 471 | ||
| 472 | cfg_if::cfg_if! { | 472 | #[cfg(all(feature = "unstable-traits", feature = "nightly"))] |
| 473 | if #[cfg(all(feature = "unstable-traits", feature = "nightly"))] { | 473 | mod eha { |
| 474 | use futures::FutureExt; | 474 | use futures::FutureExt; |
| 475 | 475 | ||
| 476 | impl<'d, T: GpioPin> embedded_hal_async::digital::Wait for Input<'d, T> { | 476 | use super::*; |
| 477 | type WaitForHighFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | ||
| 478 | 477 | ||
| 479 | fn wait_for_high<'a>(&'a mut self) -> Self::WaitForHighFuture<'a> { | 478 | impl<'d, T: GpioPin> embedded_hal_async::digital::Wait for Input<'d, T> { |
| 480 | self.wait_for_high().map(Ok) | 479 | type WaitForHighFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; |
| 481 | } | ||
| 482 | 480 | ||
| 483 | type WaitForLowFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | 481 | fn wait_for_high<'a>(&'a mut self) -> Self::WaitForHighFuture<'a> { |
| 482 | self.wait_for_high().map(Ok) | ||
| 483 | } | ||
| 484 | 484 | ||
| 485 | fn wait_for_low<'a>(&'a mut self) -> Self::WaitForLowFuture<'a> { | 485 | type WaitForLowFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; |
| 486 | self.wait_for_low().map(Ok) | ||
| 487 | } | ||
| 488 | 486 | ||
| 489 | type WaitForRisingEdgeFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | 487 | fn wait_for_low<'a>(&'a mut self) -> Self::WaitForLowFuture<'a> { |
| 488 | self.wait_for_low().map(Ok) | ||
| 489 | } | ||
| 490 | 490 | ||
| 491 | fn wait_for_rising_edge<'a>(&'a mut self) -> Self::WaitForRisingEdgeFuture<'a> { | 491 | type WaitForRisingEdgeFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; |
| 492 | self.wait_for_rising_edge().map(Ok) | ||
| 493 | } | ||
| 494 | 492 | ||
| 495 | type WaitForFallingEdgeFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | 493 | fn wait_for_rising_edge<'a>(&'a mut self) -> Self::WaitForRisingEdgeFuture<'a> { |
| 494 | self.wait_for_rising_edge().map(Ok) | ||
| 495 | } | ||
| 496 | 496 | ||
| 497 | fn wait_for_falling_edge<'a>(&'a mut self) -> Self::WaitForFallingEdgeFuture<'a> { | 497 | type WaitForFallingEdgeFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; |
| 498 | self.wait_for_falling_edge().map(Ok) | ||
| 499 | } | ||
| 500 | 498 | ||
| 501 | type WaitForAnyEdgeFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | 499 | fn wait_for_falling_edge<'a>(&'a mut self) -> Self::WaitForFallingEdgeFuture<'a> { |
| 500 | self.wait_for_falling_edge().map(Ok) | ||
| 501 | } | ||
| 502 | 502 | ||
| 503 | fn wait_for_any_edge<'a>(&'a mut self) -> Self::WaitForAnyEdgeFuture<'a> { | 503 | type WaitForAnyEdgeFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; |
| 504 | self.wait_for_any_edge().map(Ok) | 504 | |
| 505 | } | 505 | fn wait_for_any_edge<'a>(&'a mut self) -> Self::WaitForAnyEdgeFuture<'a> { |
| 506 | self.wait_for_any_edge().map(Ok) | ||
| 506 | } | 507 | } |
| 508 | } | ||
| 507 | 509 | ||
| 508 | impl<'d, T: GpioPin> embedded_hal_async::digital::Wait for Flex<'d, T> { | 510 | impl<'d, T: GpioPin> embedded_hal_async::digital::Wait for Flex<'d, T> { |
| 509 | type WaitForHighFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | 511 | type WaitForHighFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; |
| 510 | 512 | ||
| 511 | fn wait_for_high<'a>(&'a mut self) -> Self::WaitForHighFuture<'a> { | 513 | fn wait_for_high<'a>(&'a mut self) -> Self::WaitForHighFuture<'a> { |
| 512 | self.wait_for_high().map(Ok) | 514 | self.wait_for_high().map(Ok) |
| 513 | } | 515 | } |
| 514 | 516 | ||
| 515 | type WaitForLowFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | 517 | type WaitForLowFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; |
| 516 | 518 | ||
| 517 | fn wait_for_low<'a>(&'a mut self) -> Self::WaitForLowFuture<'a> { | 519 | fn wait_for_low<'a>(&'a mut self) -> Self::WaitForLowFuture<'a> { |
| 518 | self.wait_for_low().map(Ok) | 520 | self.wait_for_low().map(Ok) |
| 519 | } | 521 | } |
| 520 | 522 | ||
| 521 | type WaitForRisingEdgeFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | 523 | type WaitForRisingEdgeFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; |
| 522 | 524 | ||
| 523 | fn wait_for_rising_edge<'a>(&'a mut self) -> Self::WaitForRisingEdgeFuture<'a> { | 525 | fn wait_for_rising_edge<'a>(&'a mut self) -> Self::WaitForRisingEdgeFuture<'a> { |
| 524 | self.wait_for_rising_edge().map(Ok) | 526 | self.wait_for_rising_edge().map(Ok) |
| 525 | } | 527 | } |
| 526 | 528 | ||
| 527 | type WaitForFallingEdgeFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | 529 | type WaitForFallingEdgeFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; |
| 528 | 530 | ||
| 529 | fn wait_for_falling_edge<'a>(&'a mut self) -> Self::WaitForFallingEdgeFuture<'a> { | 531 | fn wait_for_falling_edge<'a>(&'a mut self) -> Self::WaitForFallingEdgeFuture<'a> { |
| 530 | self.wait_for_falling_edge().map(Ok) | 532 | self.wait_for_falling_edge().map(Ok) |
| 531 | } | 533 | } |
| 532 | 534 | ||
| 533 | type WaitForAnyEdgeFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | 535 | type WaitForAnyEdgeFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; |
| 534 | 536 | ||
| 535 | fn wait_for_any_edge<'a>(&'a mut self) -> Self::WaitForAnyEdgeFuture<'a> { | 537 | fn wait_for_any_edge<'a>(&'a mut self) -> Self::WaitForAnyEdgeFuture<'a> { |
| 536 | self.wait_for_any_edge().map(Ok) | 538 | self.wait_for_any_edge().map(Ok) |
| 537 | } | ||
| 538 | } | 539 | } |
| 539 | } | 540 | } |
| 540 | } | 541 | } |
diff --git a/embassy-nrf/src/spim.rs b/embassy-nrf/src/spim.rs index be2fc02fc..2955182e4 100644 --- a/embassy-nrf/src/spim.rs +++ b/embassy-nrf/src/spim.rs | |||
| @@ -475,49 +475,47 @@ mod eh1 { | |||
| 475 | } | 475 | } |
| 476 | } | 476 | } |
| 477 | 477 | ||
| 478 | cfg_if::cfg_if! { | 478 | #[cfg(all(feature = "unstable-traits", feature = "nightly"))] |
| 479 | if #[cfg(all(feature = "unstable-traits", feature = "nightly"))] { | 479 | mod eha { |
| 480 | use core::future::Future; | 480 | use core::future::Future; |
| 481 | 481 | ||
| 482 | impl<'d, T: Instance> embedded_hal_async::spi::SpiBusFlush for Spim<'d, T> { | 482 | use super::*; |
| 483 | type FlushFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | ||
| 484 | 483 | ||
| 485 | fn flush<'a>(&'a mut self) -> Self::FlushFuture<'a> { | 484 | impl<'d, T: Instance> embedded_hal_async::spi::SpiBusFlush for Spim<'d, T> { |
| 486 | async move { Ok(()) } | 485 | type FlushFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; |
| 487 | } | 486 | |
| 487 | fn flush<'a>(&'a mut self) -> Self::FlushFuture<'a> { | ||
| 488 | async move { Ok(()) } | ||
| 488 | } | 489 | } |
| 490 | } | ||
| 489 | 491 | ||
| 490 | impl<'d, T: Instance> embedded_hal_async::spi::SpiBusRead<u8> for Spim<'d, T> { | 492 | impl<'d, T: Instance> embedded_hal_async::spi::SpiBusRead<u8> for Spim<'d, T> { |
| 491 | type ReadFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | 493 | type ReadFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; |
| 492 | 494 | ||
| 493 | fn read<'a>(&'a mut self, words: &'a mut [u8]) -> Self::ReadFuture<'a> { | 495 | fn read<'a>(&'a mut self, words: &'a mut [u8]) -> Self::ReadFuture<'a> { |
| 494 | self.read(words) | 496 | self.read(words) |
| 495 | } | ||
| 496 | } | 497 | } |
| 498 | } | ||
| 497 | 499 | ||
| 498 | impl<'d, T: Instance> embedded_hal_async::spi::SpiBusWrite<u8> for Spim<'d, T> { | 500 | impl<'d, T: Instance> embedded_hal_async::spi::SpiBusWrite<u8> for Spim<'d, T> { |
| 499 | type WriteFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | 501 | type WriteFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; |
| 500 | 502 | ||
| 501 | fn write<'a>(&'a mut self, data: &'a [u8]) -> Self::WriteFuture<'a> { | 503 | fn write<'a>(&'a mut self, data: &'a [u8]) -> Self::WriteFuture<'a> { |
| 502 | self.write(data) | 504 | self.write(data) |
| 503 | } | ||
| 504 | } | 505 | } |
| 506 | } | ||
| 505 | 507 | ||
| 506 | impl<'d, T: Instance> embedded_hal_async::spi::SpiBus<u8> for Spim<'d, T> { | 508 | impl<'d, T: Instance> embedded_hal_async::spi::SpiBus<u8> for Spim<'d, T> { |
| 507 | type TransferFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | 509 | type TransferFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; |
| 508 | 510 | ||
| 509 | fn transfer<'a>(&'a mut self, rx: &'a mut [u8], tx: &'a [u8]) -> Self::TransferFuture<'a> { | 511 | fn transfer<'a>(&'a mut self, rx: &'a mut [u8], tx: &'a [u8]) -> Self::TransferFuture<'a> { |
| 510 | self.transfer(rx, tx) | 512 | self.transfer(rx, tx) |
| 511 | } | 513 | } |
| 512 | 514 | ||
| 513 | type TransferInPlaceFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | 515 | type TransferInPlaceFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; |
| 514 | 516 | ||
| 515 | fn transfer_in_place<'a>( | 517 | fn transfer_in_place<'a>(&'a mut self, words: &'a mut [u8]) -> Self::TransferInPlaceFuture<'a> { |
| 516 | &'a mut self, | 518 | self.transfer_in_place(words) |
| 517 | words: &'a mut [u8], | ||
| 518 | ) -> Self::TransferInPlaceFuture<'a> { | ||
| 519 | self.transfer_in_place(words) | ||
| 520 | } | ||
| 521 | } | 519 | } |
| 522 | } | 520 | } |
| 523 | } | 521 | } |
diff --git a/embassy-nrf/src/twim.rs b/embassy-nrf/src/twim.rs index 850f6d0fa..3d4af753a 100644 --- a/embassy-nrf/src/twim.rs +++ b/embassy-nrf/src/twim.rs | |||
| @@ -838,43 +838,43 @@ mod eh1 { | |||
| 838 | } | 838 | } |
| 839 | } | 839 | } |
| 840 | 840 | ||
| 841 | cfg_if::cfg_if! { | 841 | #[cfg(all(feature = "unstable-traits", feature = "nightly"))] |
| 842 | if #[cfg(all(feature = "unstable-traits", feature = "nightly"))] { | 842 | mod eha { |
| 843 | impl<'d, T: Instance> embedded_hal_async::i2c::I2c for Twim<'d, T> { | 843 | use super::*; |
| 844 | type ReadFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | 844 | impl<'d, T: Instance> embedded_hal_async::i2c::I2c for Twim<'d, T> { |
| 845 | type ReadFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | ||
| 845 | 846 | ||
| 846 | fn read<'a>(&'a mut self, address: u8, buffer: &'a mut [u8]) -> Self::ReadFuture<'a> { | 847 | fn read<'a>(&'a mut self, address: u8, buffer: &'a mut [u8]) -> Self::ReadFuture<'a> { |
| 847 | self.read(address, buffer) | 848 | self.read(address, buffer) |
| 848 | } | 849 | } |
| 849 | 850 | ||
| 850 | type WriteFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | 851 | type WriteFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; |
| 851 | 852 | ||
| 852 | fn write<'a>(&'a mut self, address: u8, bytes: &'a [u8]) -> Self::WriteFuture<'a> { | 853 | fn write<'a>(&'a mut self, address: u8, bytes: &'a [u8]) -> Self::WriteFuture<'a> { |
| 853 | self.write(address, bytes) | 854 | self.write(address, bytes) |
| 854 | } | 855 | } |
| 855 | 856 | ||
| 856 | type WriteReadFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | 857 | type WriteReadFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; |
| 857 | 858 | ||
| 858 | fn write_read<'a>( | 859 | fn write_read<'a>( |
| 859 | &'a mut self, | 860 | &'a mut self, |
| 860 | address: u8, | 861 | address: u8, |
| 861 | wr_buffer: &'a [u8], | 862 | wr_buffer: &'a [u8], |
| 862 | rd_buffer: &'a mut [u8], | 863 | rd_buffer: &'a mut [u8], |
| 863 | ) -> Self::WriteReadFuture<'a> { | 864 | ) -> Self::WriteReadFuture<'a> { |
| 864 | self.write_read(address, wr_buffer, rd_buffer) | 865 | self.write_read(address, wr_buffer, rd_buffer) |
| 865 | } | 866 | } |
| 866 | 867 | ||
| 867 | type TransactionFuture<'a, 'b> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a, 'b: 'a; | 868 | type TransactionFuture<'a, 'b> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a, 'b: 'a; |
| 868 | 869 | ||
| 869 | fn transaction<'a, 'b>( | 870 | fn transaction<'a, 'b>( |
| 870 | &'a mut self, | 871 | &'a mut self, |
| 871 | address: u8, | 872 | address: u8, |
| 872 | operations: &'a mut [embedded_hal_async::i2c::Operation<'b>], | 873 | operations: &'a mut [embedded_hal_async::i2c::Operation<'b>], |
| 873 | ) -> Self::TransactionFuture<'a, 'b> { | 874 | ) -> Self::TransactionFuture<'a, 'b> { |
| 874 | let _ = address; | 875 | let _ = address; |
| 875 | let _ = operations; | 876 | let _ = operations; |
| 876 | async move { todo!() } | 877 | async move { todo!() } |
| 877 | } | ||
| 878 | } | 878 | } |
| 879 | } | 879 | } |
| 880 | } | 880 | } |
diff --git a/embassy-nrf/src/uarte.rs b/embassy-nrf/src/uarte.rs index 4347ea558..c250e24ca 100644 --- a/embassy-nrf/src/uarte.rs +++ b/embassy-nrf/src/uarte.rs | |||
| @@ -1073,78 +1073,79 @@ mod eh1 { | |||
| 1073 | } | 1073 | } |
| 1074 | } | 1074 | } |
| 1075 | 1075 | ||
| 1076 | cfg_if::cfg_if! { | 1076 | #[cfg(all( |
| 1077 | if #[cfg(all(feature = "unstable-traits", feature = "nightly", feature = "_todo_embedded_hal_serial"))] { | 1077 | feature = "unstable-traits", |
| 1078 | use core::future::Future; | 1078 | feature = "nightly", |
| 1079 | feature = "_todo_embedded_hal_serial" | ||
| 1080 | ))] | ||
| 1081 | mod eha { | ||
| 1082 | use core::future::Future; | ||
| 1079 | 1083 | ||
| 1080 | impl<'d, T: Instance> embedded_hal_async::serial::Read for Uarte<'d, T> { | 1084 | use super::*; |
| 1081 | type ReadFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | ||
| 1082 | 1085 | ||
| 1083 | fn read<'a>(&'a mut self, buffer: &'a mut [u8]) -> Self::ReadFuture<'a> { | 1086 | impl<'d, T: Instance> embedded_hal_async::serial::Read for Uarte<'d, T> { |
| 1084 | self.read(buffer) | 1087 | type ReadFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; |
| 1085 | } | 1088 | |
| 1089 | fn read<'a>(&'a mut self, buffer: &'a mut [u8]) -> Self::ReadFuture<'a> { | ||
| 1090 | self.read(buffer) | ||
| 1086 | } | 1091 | } |
| 1092 | } | ||
| 1087 | 1093 | ||
| 1088 | impl<'d, T: Instance> embedded_hal_async::serial::Write for Uarte<'d, T> { | 1094 | impl<'d, T: Instance> embedded_hal_async::serial::Write for Uarte<'d, T> { |
| 1089 | type WriteFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | 1095 | type WriteFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; |
| 1090 | 1096 | ||
| 1091 | fn write<'a>(&'a mut self, buffer: &'a [u8]) -> Self::WriteFuture<'a> { | 1097 | fn write<'a>(&'a mut self, buffer: &'a [u8]) -> Self::WriteFuture<'a> { |
| 1092 | self.write(buffer) | 1098 | self.write(buffer) |
| 1093 | } | 1099 | } |
| 1094 | 1100 | ||
| 1095 | type FlushFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | 1101 | type FlushFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; |
| 1096 | 1102 | ||
| 1097 | fn flush<'a>(&'a mut self) -> Self::FlushFuture<'a> { | 1103 | fn flush<'a>(&'a mut self) -> Self::FlushFuture<'a> { |
| 1098 | async move { Ok(()) } | 1104 | async move { Ok(()) } |
| 1099 | } | ||
| 1100 | } | 1105 | } |
| 1106 | } | ||
| 1101 | 1107 | ||
| 1102 | impl<'d, T: Instance> embedded_hal_async::serial::Write for UarteTx<'d, T> { | 1108 | impl<'d, T: Instance> embedded_hal_async::serial::Write for UarteTx<'d, T> { |
| 1103 | type WriteFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | 1109 | type WriteFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; |
| 1104 | 1110 | ||
| 1105 | fn write<'a>(&'a mut self, buffer: &'a [u8]) -> Self::WriteFuture<'a> { | 1111 | fn write<'a>(&'a mut self, buffer: &'a [u8]) -> Self::WriteFuture<'a> { |
| 1106 | self.write(buffer) | 1112 | self.write(buffer) |
| 1107 | } | 1113 | } |
| 1108 | 1114 | ||
| 1109 | type FlushFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | 1115 | type FlushFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; |
| 1110 | 1116 | ||
| 1111 | fn flush<'a>(&'a mut self) -> Self::FlushFuture<'a> { | 1117 | fn flush<'a>(&'a mut self) -> Self::FlushFuture<'a> { |
| 1112 | async move { Ok(()) } | 1118 | async move { Ok(()) } |
| 1113 | } | ||
| 1114 | } | 1119 | } |
| 1120 | } | ||
| 1115 | 1121 | ||
| 1116 | impl<'d, T: Instance> embedded_hal_async::serial::Read for UarteRx<'d, T> { | 1122 | impl<'d, T: Instance> embedded_hal_async::serial::Read for UarteRx<'d, T> { |
| 1117 | type ReadFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | 1123 | type ReadFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; |
| 1118 | 1124 | ||
| 1119 | fn read<'a>(&'a mut self, buffer: &'a mut [u8]) -> Self::ReadFuture<'a> { | 1125 | fn read<'a>(&'a mut self, buffer: &'a mut [u8]) -> Self::ReadFuture<'a> { |
| 1120 | self.read(buffer) | 1126 | self.read(buffer) |
| 1121 | } | ||
| 1122 | } | 1127 | } |
| 1128 | } | ||
| 1123 | 1129 | ||
| 1124 | impl<'d, U: Instance, T: TimerInstance> embedded_hal_async::serial::Read | 1130 | impl<'d, U: Instance, T: TimerInstance> embedded_hal_async::serial::Read for UarteWithIdle<'d, U, T> { |
| 1125 | for UarteWithIdle<'d, U, T> | 1131 | type ReadFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; |
| 1126 | { | ||
| 1127 | type ReadFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | ||
| 1128 | 1132 | ||
| 1129 | fn read<'a>(&'a mut self, buffer: &'a mut [u8]) -> Self::ReadFuture<'a> { | 1133 | fn read<'a>(&'a mut self, buffer: &'a mut [u8]) -> Self::ReadFuture<'a> { |
| 1130 | self.read(buffer) | 1134 | self.read(buffer) |
| 1131 | } | ||
| 1132 | } | 1135 | } |
| 1136 | } | ||
| 1133 | 1137 | ||
| 1134 | impl<'d, U: Instance, T: TimerInstance> embedded_hal_async::serial::Write | 1138 | impl<'d, U: Instance, T: TimerInstance> embedded_hal_async::serial::Write for UarteWithIdle<'d, U, T> { |
| 1135 | for UarteWithIdle<'d, U, T> | 1139 | type WriteFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; |
| 1136 | { | ||
| 1137 | type WriteFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | ||
| 1138 | 1140 | ||
| 1139 | fn write<'a>(&'a mut self, buffer: &'a [u8]) -> Self::WriteFuture<'a> { | 1141 | fn write<'a>(&'a mut self, buffer: &'a [u8]) -> Self::WriteFuture<'a> { |
| 1140 | self.write(buffer) | 1142 | self.write(buffer) |
| 1141 | } | 1143 | } |
| 1142 | 1144 | ||
| 1143 | type FlushFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | 1145 | type FlushFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; |
| 1144 | 1146 | ||
| 1145 | fn flush<'a>(&'a mut self) -> Self::FlushFuture<'a> { | 1147 | fn flush<'a>(&'a mut self) -> Self::FlushFuture<'a> { |
| 1146 | async move { Ok(()) } | 1148 | async move { Ok(()) } |
| 1147 | } | ||
| 1148 | } | 1149 | } |
| 1149 | } | 1150 | } |
| 1150 | } | 1151 | } |
