aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Snaider <[email protected]>2024-02-15 18:10:20 -0500
committerAdam Snaider <[email protected]>2024-02-15 19:32:11 -0500
commit72e92647e2634958d2229f35264a3dc696c3d33e (patch)
tree290783b5a24af2ba5c13d6437295eeb75a5040f2
parent5220453d85b1e0f279e94dc1627b7d2434132920 (diff)
Add unsafe constructor for AnyPin
-rw-r--r--embassy-rp/src/gpio.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/embassy-rp/src/gpio.rs b/embassy-rp/src/gpio.rs
index 93b29bbf9..a121a8036 100644
--- a/embassy-rp/src/gpio.rs
+++ b/embassy-rp/src/gpio.rs
@@ -889,6 +889,17 @@ pub struct AnyPin {
889 pin_bank: u8, 889 pin_bank: u8,
890} 890}
891 891
892impl AnyPin {
893 /// Unsafely create a new type-erased pin.
894 ///
895 /// # Safety
896 ///
897 /// You must ensure that you’re only using one instance of this type at a time.
898 pub unsafe fn steal(pin_bank: u8) -> Self {
899 Self { pin_bank }
900 }
901}
902
892impl_peripheral!(AnyPin); 903impl_peripheral!(AnyPin);
893 904
894impl Pin for AnyPin {} 905impl Pin for AnyPin {}