It might be useful to revisit the concept of data "owned" by an ISR, and a container of some type that gives access to that.
I did this with cmim using the VECTACTIVE field of cortex-m: https://docs.rs/cmim/latest/cmim/, it might be nice to have a container like that with an API that lets you:
Make a container that starts empty, not with any ISR attached, like static CONTAINER: VectorCell<Uart> = VectorCell::new();
CONTAINER.give(Interrupt::Uart, data);, which you can use in main, which uses a critical section to move data into the cell and "register" that it should only be accessible by that interrupt
CONTAINER.get() -> Option<&mut T> which only works in the registered ISR
CONTAINER.take() -> Option<T> which uses a critical section to take the data back out
It might be useful to revisit the concept of data "owned" by an ISR, and a container of some type that gives access to that.
I did this with
cmim
using the VECTACTIVE field of cortex-m: https://docs.rs/cmim/latest/cmim/, it might be nice to have a container like that with an API that lets you:static CONTAINER: VectorCell<Uart> = VectorCell::new();
CONTAINER.give(Interrupt::Uart, data);
, which you can use in main, which uses a critical section to move data into the cell and "register" that it should only be accessible by that interruptCONTAINER.get() -> Option<&mut T>
which only works in the registered ISRCONTAINER.take() -> Option<T>
which uses a critical section to take the data back out