From 9f9d808948858eb6960c7fe37b2a76be9a02bde5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Kr=C3=B6ger?= Date: Sun, 17 Jan 2021 17:28:46 +0100 Subject: [PATCH] Fix IRQ numbers The raw enum values are not always equal to the interrupt number fixes #23 --- embassy-macros/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/embassy-macros/src/lib.rs b/embassy-macros/src/lib.rs index 86140639..cb16f65a 100644 --- a/embassy-macros/src/lib.rs +++ b/embassy-macros/src/lib.rs @@ -115,7 +115,9 @@ pub fn interrupt_declare(item: TokenStream) -> TokenStream { unsafe impl OwnedInterrupt for #name_interrupt { type Priority = Priority; fn number(&self) -> u8 { - Interrupt::#name as u8 + use cortex_m::interrupt::Nr; + let irq = Interrupt::#name; + irq.nr() as u8 } unsafe fn __handler(&self) -> &'static ::embassy::interrupt::Handler { #[export_name = #name_handler]