aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrik Alsér <[email protected]>2022-08-31 22:03:34 +0200
committerHenrik Alsér <[email protected]>2022-09-01 15:12:44 +0200
commitb934f3f12e0414ac92ce812b73aca44d0f47a5e9 (patch)
treef0c54dd1df4c47ded41c71d920c1f8fbec4df21a
parent3fce6ec649953fac52b731ea0aa7587ed60e55c9 (diff)
Remove cfg_if
-rw-r--r--embassy-rp/src/spi.rs63
1 files changed, 29 insertions, 34 deletions
diff --git a/embassy-rp/src/spi.rs b/embassy-rp/src/spi.rs
index 9bf6a9119..cd40a4a31 100644
--- a/embassy-rp/src/spi.rs
+++ b/embassy-rp/src/spi.rs
@@ -556,51 +556,46 @@ mod eh1 {
556 } 556 }
557} 557}
558 558
559cfg_if::cfg_if! { 559#[cfg(all(feature = "unstable-traits", feature = "nightly"))]
560 if #[cfg(all(feature = "unstable-traits", feature = "nightly"))] { 560mod eha {
561 use core::future::Future; 561 use super::*;
562 impl<'d, T: Instance> embedded_hal_async::spi::SpiBusFlush for Spi<'d, T, Async> { 562 use core::future::Future;
563 type FlushFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; 563
564 564 impl<'d, T: Instance> embedded_hal_async::spi::SpiBusFlush for Spi<'d, T, Async> {
565 fn flush<'a>(&'a mut self) -> Self::FlushFuture<'a> { 565 type FlushFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a;
566 async { Ok(()) } 566
567 } 567 fn flush<'a>(&'a mut self) -> Self::FlushFuture<'a> {
568 async { Ok(()) }
568 } 569 }
570 }
569 571
570 impl<'d, T: Instance> embedded_hal_async::spi::SpiBusWrite<u8> 572 impl<'d, T: Instance> embedded_hal_async::spi::SpiBusWrite<u8> for Spi<'d, T, Async> {
571 for Spi<'d, T, Async> 573 type WriteFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a;
572 {
573 type WriteFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a;
574 574
575 fn write<'a>(&'a mut self, data: &'a [u8]) -> Self::WriteFuture<'a> { 575 fn write<'a>(&'a mut self, data: &'a [u8]) -> Self::WriteFuture<'a> {
576 self.write(data) 576 self.write(data)
577 }
578 } 577 }
578 }
579 579
580 impl<'d, T: Instance> embedded_hal_async::spi::SpiBusRead<u8> 580 impl<'d, T: Instance> embedded_hal_async::spi::SpiBusRead<u8> for Spi<'d, T, Async> {
581 for Spi<'d, T, Async> 581 type ReadFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a;
582 {
583 type ReadFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a;
584 582
585 fn read<'a>(&'a mut self, data: &'a mut [u8]) -> Self::ReadFuture<'a> { 583 fn read<'a>(&'a mut self, data: &'a mut [u8]) -> Self::ReadFuture<'a> {
586 self.read(data) 584 self.read(data)
587 }
588 } 585 }
586 }
589 587
590 impl<'d, T: Instance> embedded_hal_async::spi::SpiBus<u8> 588 impl<'d, T: Instance> embedded_hal_async::spi::SpiBus<u8> for Spi<'d, T, Async> {
591 for Spi<'d, T, Async> 589 type TransferFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a;
592 {
593 type TransferFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a;
594 590
595 fn transfer<'a>(&'a mut self, rx: &'a mut [u8], tx: &'a [u8]) -> Self::TransferFuture<'a> { 591 fn transfer<'a>(&'a mut self, rx: &'a mut [u8], tx: &'a [u8]) -> Self::TransferFuture<'a> {
596 self.transfer(rx, tx) 592 self.transfer(rx, tx)
597 } 593 }
598 594
599 type TransferInPlaceFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; 595 type TransferInPlaceFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a;
600 596
601 fn transfer_in_place<'a>(&'a mut self, words: &'a mut [u8]) -> Self::TransferInPlaceFuture<'a> { 597 fn transfer_in_place<'a>(&'a mut self, words: &'a mut [u8]) -> Self::TransferInPlaceFuture<'a> {
602 self.transfer_in_place(words) 598 self.transfer_in_place(words)
603 }
604 } 599 }
605 } 600 }
606} 601}