diff options
| -rw-r--r-- | embassy-stm32/src/gpio.rs | 116 |
1 files changed, 111 insertions, 5 deletions
diff --git a/embassy-stm32/src/gpio.rs b/embassy-stm32/src/gpio.rs index a2405c232..6c989b52e 100644 --- a/embassy-stm32/src/gpio.rs +++ b/embassy-stm32/src/gpio.rs | |||
| @@ -657,7 +657,7 @@ mod eh02 { | |||
| 657 | 657 | ||
| 658 | use super::*; | 658 | use super::*; |
| 659 | 659 | ||
| 660 | impl<'d, T: Pin> InputPin for Flex<'d, T> { | 660 | impl<'d, T: Pin> InputPin for Input<'d, T> { |
| 661 | type Error = Infallible; | 661 | type Error = Infallible; |
| 662 | 662 | ||
| 663 | #[inline] | 663 | #[inline] |
| @@ -671,7 +671,7 @@ mod eh02 { | |||
| 671 | } | 671 | } |
| 672 | } | 672 | } |
| 673 | 673 | ||
| 674 | impl<'d, T: Pin> OutputPin for Flex<'d, T> { | 674 | impl<'d, T: Pin> OutputPin for Output<'d, T> { |
| 675 | type Error = Infallible; | 675 | type Error = Infallible; |
| 676 | 676 | ||
| 677 | #[inline] | 677 | #[inline] |
| @@ -685,7 +685,7 @@ mod eh02 { | |||
| 685 | } | 685 | } |
| 686 | } | 686 | } |
| 687 | 687 | ||
| 688 | impl<'d, T: Pin> StatefulOutputPin for Flex<'d, T> { | 688 | impl<'d, T: Pin> StatefulOutputPin for Output<'d, T> { |
| 689 | #[inline] | 689 | #[inline] |
| 690 | fn is_set_high(&self) -> Result<bool, Self::Error> { | 690 | fn is_set_high(&self) -> Result<bool, Self::Error> { |
| 691 | Ok(self.is_set_high()) | 691 | Ok(self.is_set_high()) |
| @@ -698,7 +698,7 @@ mod eh02 { | |||
| 698 | } | 698 | } |
| 699 | } | 699 | } |
| 700 | 700 | ||
| 701 | impl<'d, T: Pin> ToggleableOutputPin for Flex<'d, T> { | 701 | impl<'d, T: Pin> ToggleableOutputPin for Output<'d, T> { |
| 702 | type Error = Infallible; | 702 | type Error = Infallible; |
| 703 | #[inline] | 703 | #[inline] |
| 704 | fn toggle(&mut self) -> Result<(), Self::Error> { | 704 | fn toggle(&mut self) -> Result<(), Self::Error> { |
| @@ -740,6 +740,55 @@ mod eh02 { | |||
| 740 | Ok(self.toggle()) | 740 | Ok(self.toggle()) |
| 741 | } | 741 | } |
| 742 | } | 742 | } |
| 743 | |||
| 744 | impl<'d, T: Pin> InputPin for Flex<'d, T> { | ||
| 745 | type Error = Infallible; | ||
| 746 | |||
| 747 | #[inline] | ||
| 748 | fn is_high(&self) -> Result<bool, Self::Error> { | ||
| 749 | Ok(self.is_high()) | ||
| 750 | } | ||
| 751 | |||
| 752 | #[inline] | ||
| 753 | fn is_low(&self) -> Result<bool, Self::Error> { | ||
| 754 | Ok(self.is_low()) | ||
| 755 | } | ||
| 756 | } | ||
| 757 | |||
| 758 | impl<'d, T: Pin> OutputPin for Flex<'d, T> { | ||
| 759 | type Error = Infallible; | ||
| 760 | |||
| 761 | #[inline] | ||
| 762 | fn set_high(&mut self) -> Result<(), Self::Error> { | ||
| 763 | Ok(self.set_high()) | ||
| 764 | } | ||
| 765 | |||
| 766 | #[inline] | ||
| 767 | fn set_low(&mut self) -> Result<(), Self::Error> { | ||
| 768 | Ok(self.set_low()) | ||
| 769 | } | ||
| 770 | } | ||
| 771 | |||
| 772 | impl<'d, T: Pin> StatefulOutputPin for Flex<'d, T> { | ||
| 773 | #[inline] | ||
| 774 | fn is_set_high(&self) -> Result<bool, Self::Error> { | ||
| 775 | Ok(self.is_set_high()) | ||
| 776 | } | ||
| 777 | |||
| 778 | /// Is the output pin set as low? | ||
| 779 | #[inline] | ||
| 780 | fn is_set_low(&self) -> Result<bool, Self::Error> { | ||
| 781 | Ok(self.is_set_low()) | ||
| 782 | } | ||
| 783 | } | ||
| 784 | |||
| 785 | impl<'d, T: Pin> ToggleableOutputPin for Flex<'d, T> { | ||
| 786 | type Error = Infallible; | ||
| 787 | #[inline] | ||
| 788 | fn toggle(&mut self) -> Result<(), Self::Error> { | ||
| 789 | Ok(self.toggle()) | ||
| 790 | } | ||
| 791 | } | ||
| 743 | } | 792 | } |
| 744 | 793 | ||
| 745 | #[cfg(feature = "unstable-traits")] | 794 | #[cfg(feature = "unstable-traits")] |
| @@ -836,9 +885,66 @@ mod eh1 { | |||
| 836 | Ok(self.toggle()) | 885 | Ok(self.toggle()) |
| 837 | } | 886 | } |
| 838 | } | 887 | } |
| 888 | |||
| 889 | impl<'d, T: Pin> ErrorType for Flex<'d, T> { | ||
| 890 | type Error = Infallible; | ||
| 891 | } | ||
| 892 | |||
| 893 | impl<'d, T: Pin> InputPin for Flex<'d, T> { | ||
| 894 | #[inline] | ||
| 895 | fn is_high(&self) -> Result<bool, Self::Error> { | ||
| 896 | Ok(self.is_high()) | ||
| 897 | } | ||
| 898 | |||
| 899 | #[inline] | ||
| 900 | fn is_low(&self) -> Result<bool, Self::Error> { | ||
| 901 | Ok(self.is_low()) | ||
| 902 | } | ||
| 903 | } | ||
| 904 | |||
| 905 | impl<'d, T: Pin> ErrorType for Flex<'d, T> { | ||
| 906 | type Error = Infallible; | ||
| 907 | } | ||
| 908 | |||
| 909 | impl<'d, T: Pin> OutputPin for Flex<'d, T> { | ||
| 910 | #[inline] | ||
| 911 | fn set_high(&mut self) -> Result<(), Self::Error> { | ||
| 912 | Ok(self.set_high()) | ||
| 913 | } | ||
| 914 | |||
| 915 | #[inline] | ||
| 916 | fn set_low(&mut self) -> Result<(), Self::Error> { | ||
| 917 | Ok(self.set_low()) | ||
| 918 | } | ||
| 919 | } | ||
| 920 | |||
| 921 | impl<'d, T: Pin> ToggleableOutputPin for Flex<'d, T> { | ||
| 922 | #[inline] | ||
| 923 | fn toggle(&mut self) -> Result<(), Self::Error> { | ||
| 924 | Ok(self.toggle()) | ||
| 925 | } | ||
| 926 | } | ||
| 927 | |||
| 928 | impl<'d, T: Pin> ErrorType for Flex<'d, T> { | ||
| 929 | type Error = Infallible; | ||
| 930 | } | ||
| 931 | |||
| 932 | impl<'d, T: Pin> StatefulOutputPin for Flex<'d, T> { | ||
| 933 | #[inline] | ||
| 934 | fn is_set_high(&self) -> Result<bool, Self::Error> { | ||
| 935 | Ok(self.is_set_high()) | ||
| 936 | } | ||
| 937 | |||
| 938 | /// Is the output pin set as low? | ||
| 939 | #[inline] | ||
| 940 | fn is_set_low(&self) -> Result<bool, Self::Error> { | ||
| 941 | Ok(self.is_set_low()) | ||
| 942 | } | ||
| 943 | } | ||
| 944 | |||
| 839 | } | 945 | } |
| 840 | 946 | ||
| 841 | #[cfg(feature = "unstable-pac")] | 947 | #[cfg(feature = "unstable-pac")] |
| 842 | pub mod low_level { | 948 | pub mod low_level { |
| 843 | pub use super::sealed::*; | 949 | pub use super::sealed::*; |
| 844 | } | 950 | } \ No newline at end of file |
