We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recently on NRF52832 I needed to route interrupt to one of two handlers - buffered uart driver, unbuffered uart driver - depending on program state.
I came up up with this solution:
static UARTE0_UART_IRQ_TARGET: AtomicBool = AtomicBool::new(false); struct Uarte0Uart0Irq {} unsafe impl typelevel::Binding<typelevel::UARTE0_UART0, uarte::InterruptHandler<peripherals::UARTE0>> for Uarte0Uart0Irq { } unsafe impl typelevel::Binding< typelevel::UARTE0_UART0, buffered_uarte::InterruptHandler<peripherals::UARTE0>, > for Uarte0Uart0Irq { } #[allow(non_snake_case)] #[no_mangle] unsafe extern "C" fn UARTE0_UART0() { if UARTE0_UART_IRQ_TARGET.load(atomic::Ordering::SeqCst) { buffered_uarte::InterruptHandler::<peripherals::UARTE0>::on_interrupt() } else { uarte::InterruptHandler::<peripherals::UARTE0>::on_interrupt() } }
This works good, but it's quite large and ugly code. Maybe I'm completely missing some already available abstraction.
Could it be replaced with something more elegant?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Recently on NRF52832 I needed to route interrupt to one of two handlers - buffered uart driver, unbuffered uart driver - depending on program state.
I came up up with this solution:
This works good, but it's quite large and ugly code.
Maybe I'm completely missing some already available abstraction.
Could it be replaced with something more elegant?
The text was updated successfully, but these errors were encountered: