aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-rp/Cargo.toml2
-rw-r--r--embassy-rp/src/gpio.rs120
-rw-r--r--embassy-rp/src/lib.rs3
3 files changed, 64 insertions, 61 deletions
diff --git a/embassy-rp/Cargo.toml b/embassy-rp/Cargo.toml
index ffb4c9148..6529e1a37 100644
--- a/embassy-rp/Cargo.toml
+++ b/embassy-rp/Cargo.toml
@@ -27,7 +27,7 @@ nightly = ["embassy/nightly", "embedded-hal-1", "embedded-hal-async", "embassy-e
27unstable-traits = ["embedded-hal-1"] 27unstable-traits = ["embedded-hal-1"]
28 28
29[dependencies] 29[dependencies]
30embassy = { version = "0.1.0", path = "../embassy", features = [ "time-tick-1mhz", "nightly"] } 30embassy = { version = "0.1.0", path = "../embassy", features = [ "time-tick-1mhz" ] }
31embassy-cortex-m = { version = "0.1.0", path = "../embassy-cortex-m", features = ["prio-bits-3"]} 31embassy-cortex-m = { version = "0.1.0", path = "../embassy-cortex-m", features = ["prio-bits-3"]}
32embassy-hal-common = {version = "0.1.0", path = "../embassy-hal-common" } 32embassy-hal-common = {version = "0.1.0", path = "../embassy-hal-common" }
33embassy-embedded-hal = {version = "0.1.0", path = "../embassy-embedded-hal" } 33embassy-embedded-hal = {version = "0.1.0", path = "../embassy-embedded-hal" }
diff --git a/embassy-rp/src/gpio.rs b/embassy-rp/src/gpio.rs
index ef15a5eff..f205063c6 100644
--- a/embassy-rp/src/gpio.rs
+++ b/embassy-rp/src/gpio.rs
@@ -1,4 +1,3 @@
1use core::convert::Infallible;
2use core::future::Future; 1use core::future::Future;
3use core::marker::PhantomData; 2use core::marker::PhantomData;
4use core::pin::Pin as FuturePin; 3use core::pin::Pin as FuturePin;
@@ -720,7 +719,7 @@ impl_pin!(PIN_QSPI_SD3, Bank::Qspi, 5);
720// ==================== 719// ====================
721 720
722mod eh02 { 721mod eh02 {
723 use futures::FutureExt; 722 use core::convert::Infallible;
724 723
725 use super::*; 724 use super::*;
726 725
@@ -839,66 +838,15 @@ mod eh02 {
839 Ok(self.toggle()) 838 Ok(self.toggle())
840 } 839 }
841 } 840 }
842
843 use core::convert::Infallible;
844
845 impl<'d, T: Pin> embedded_hal_async::digital::Wait for Flex<'d, T> {
846 type WaitForHighFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a;
847 fn wait_for_high<'a>(&'a mut self) -> Self::WaitForHighFuture<'a> {
848 self.wait_for_high().map(Ok)
849 }
850
851 type WaitForLowFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a;
852 fn wait_for_low<'a>(&'a mut self) -> Self::WaitForLowFuture<'a> {
853 self.wait_for_low().map(Ok)
854 }
855
856 type WaitForRisingEdgeFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a;
857 fn wait_for_rising_edge<'a>(&'a mut self) -> Self::WaitForRisingEdgeFuture<'a> {
858 self.wait_for_rising_edge().map(Ok)
859 }
860
861 type WaitForFallingEdgeFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a;
862 fn wait_for_falling_edge<'a>(&'a mut self) -> Self::WaitForFallingEdgeFuture<'a> {
863 self.wait_for_falling_edge().map(Ok)
864 }
865
866 type WaitForAnyEdgeFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a;
867 fn wait_for_any_edge<'a>(&'a mut self) -> Self::WaitForAnyEdgeFuture<'a> {
868 self.wait_for_any_edge().map(Ok)
869 }
870 }
871
872 impl<'d, T: Pin> embedded_hal_async::digital::Wait for Input<'d, T> {
873 type WaitForHighFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a;
874 fn wait_for_high<'a>(&'a mut self) -> Self::WaitForHighFuture<'a> {
875 self.wait_for_high().map(Ok)
876 }
877
878 type WaitForLowFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a;
879 fn wait_for_low<'a>(&'a mut self) -> Self::WaitForLowFuture<'a> {
880 self.wait_for_low().map(Ok)
881 }
882
883 type WaitForRisingEdgeFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a;
884 fn wait_for_rising_edge<'a>(&'a mut self) -> Self::WaitForRisingEdgeFuture<'a> {
885 self.wait_for_rising_edge().map(Ok)
886 }
887
888 type WaitForFallingEdgeFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a;
889 fn wait_for_falling_edge<'a>(&'a mut self) -> Self::WaitForFallingEdgeFuture<'a> {
890 self.wait_for_falling_edge().map(Ok)
891 }
892
893 type WaitForAnyEdgeFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a;
894 fn wait_for_any_edge<'a>(&'a mut self) -> Self::WaitForAnyEdgeFuture<'a> {
895 self.wait_for_any_edge().map(Ok)
896 }
897 }
898} 841}
899 842
900#[cfg(feature = "unstable-traits")] 843#[cfg(feature = "unstable-traits")]
901mod eh1 { 844mod eh1 {
845 use core::convert::Infallible;
846
847 #[cfg(feature = "nightly")]
848 use futures::FutureExt;
849
902 use super::*; 850 use super::*;
903 851
904 impl<'d, T: Pin> embedded_hal_1::digital::ErrorType for Input<'d, T> { 852 impl<'d, T: Pin> embedded_hal_1::digital::ErrorType for Input<'d, T> {
@@ -1014,4 +962,60 @@ mod eh1 {
1014 Ok(self.toggle()) 962 Ok(self.toggle())
1015 } 963 }
1016 } 964 }
965
966 #[cfg(feature = "nightly")]
967 impl<'d, T: Pin> embedded_hal_async::digital::Wait for Flex<'d, T> {
968 type WaitForHighFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a;
969 fn wait_for_high<'a>(&'a mut self) -> Self::WaitForHighFuture<'a> {
970 self.wait_for_high().map(Ok)
971 }
972
973 type WaitForLowFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a;
974 fn wait_for_low<'a>(&'a mut self) -> Self::WaitForLowFuture<'a> {
975 self.wait_for_low().map(Ok)
976 }
977
978 type WaitForRisingEdgeFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a;
979 fn wait_for_rising_edge<'a>(&'a mut self) -> Self::WaitForRisingEdgeFuture<'a> {
980 self.wait_for_rising_edge().map(Ok)
981 }
982
983 type WaitForFallingEdgeFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a;
984 fn wait_for_falling_edge<'a>(&'a mut self) -> Self::WaitForFallingEdgeFuture<'a> {
985 self.wait_for_falling_edge().map(Ok)
986 }
987
988 type WaitForAnyEdgeFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a;
989 fn wait_for_any_edge<'a>(&'a mut self) -> Self::WaitForAnyEdgeFuture<'a> {
990 self.wait_for_any_edge().map(Ok)
991 }
992 }
993
994 #[cfg(feature = "nightly")]
995 impl<'d, T: Pin> embedded_hal_async::digital::Wait for Input<'d, T> {
996 type WaitForHighFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a;
997 fn wait_for_high<'a>(&'a mut self) -> Self::WaitForHighFuture<'a> {
998 self.wait_for_high().map(Ok)
999 }
1000
1001 type WaitForLowFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a;
1002 fn wait_for_low<'a>(&'a mut self) -> Self::WaitForLowFuture<'a> {
1003 self.wait_for_low().map(Ok)
1004 }
1005
1006 type WaitForRisingEdgeFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a;
1007 fn wait_for_rising_edge<'a>(&'a mut self) -> Self::WaitForRisingEdgeFuture<'a> {
1008 self.wait_for_rising_edge().map(Ok)
1009 }
1010
1011 type WaitForFallingEdgeFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a;
1012 fn wait_for_falling_edge<'a>(&'a mut self) -> Self::WaitForFallingEdgeFuture<'a> {
1013 self.wait_for_falling_edge().map(Ok)
1014 }
1015
1016 type WaitForAnyEdgeFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a;
1017 fn wait_for_any_edge<'a>(&'a mut self) -> Self::WaitForAnyEdgeFuture<'a> {
1018 self.wait_for_any_edge().map(Ok)
1019 }
1020 }
1017} 1021}
diff --git a/embassy-rp/src/lib.rs b/embassy-rp/src/lib.rs
index 90ef1b170..7da0d30c1 100644
--- a/embassy-rp/src/lib.rs
+++ b/embassy-rp/src/lib.rs
@@ -1,6 +1,5 @@
1#![no_std] 1#![no_std]
2#![feature(generic_associated_types)] 2#![cfg_attr(feature = "nightly", feature(generic_associated_types, type_alias_impl_trait))]
3#![feature(type_alias_impl_trait)]
4 3
5// This mod MUST go first, so that the others see its macros. 4// This mod MUST go first, so that the others see its macros.
6pub(crate) mod fmt; 5pub(crate) mod fmt;