Merge pull request #2581 from adsnaider/main

Add unsafe constructor for AnyPin
This commit is contained in:
Dario Nieuwenhuis 2024-02-17 01:46:12 +00:00 committed by GitHub
commit e19bed921d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -889,6 +889,17 @@ pub struct AnyPin {
pin_bank: u8, pin_bank: u8,
} }
impl AnyPin {
/// Unsafely create a new type-erased pin.
///
/// # Safety
///
/// You must ensure that youre 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_peripheral!(AnyPin);
impl Pin for AnyPin {} impl Pin for AnyPin {}