From 72e92647e2634958d2229f35264a3dc696c3d33e Mon Sep 17 00:00:00 2001 From: Adam Snaider Date: Thu, 15 Feb 2024 18:10:20 -0500 Subject: [PATCH] Add unsafe constructor for AnyPin --- embassy-rp/src/gpio.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 { pin_bank: u8, } +impl AnyPin { + /// Unsafely create a new type-erased pin. + /// + /// # Safety + /// + /// You must ensure that you’re only using one instance of this type at a time. + pub unsafe fn steal(pin_bank: u8) -> Self { + Self { pin_bank } + } +} + impl_peripheral!(AnyPin); impl Pin for AnyPin {}