Implement PeripheralBorrow for interrupts.

This commit is contained in:
Dario Nieuwenhuis 2021-03-19 04:02:56 +01:00
parent 9c4087ac5c
commit d9aaa0edf8

View File

@ -137,6 +137,20 @@ pub fn interrupt_declare(item: TokenStream) -> TokenStream {
&HANDLER
}
}
impl ::embassy::util::PeripheralBorrow for #name_interrupt {
type Target = #name_interrupt;
unsafe fn unborrow(self) -> #name_interrupt {
self
}
}
impl ::embassy::util::PeripheralBorrow for &mut #name_interrupt {
type Target = #name_interrupt;
unsafe fn unborrow(self) -> #name_interrupt {
::core::ptr::read(self)
}
}
};
result.into()
}