rust-embedded / msp430-rt

Minimal startup / runtime for MSP430 microcontrollers
Apache License 2.0
15 stars 4 forks source link

Introduce optional CriticalSection arguments to main() and interrupt handlers #10

Closed YuhanLiin closed 4 years ago

YuhanLiin commented 4 years ago

The proc macros entry and interrupt are modified to allow the main and interrupt handling functions to accept a single CriticalSection parameter. This change, along with a new enable_with_cs(CriticalSection) API that I've yet to implement, allows interrupts to be enabled safely from any context and reduces unnecessary calls to interrupt::free. Additionally, the old function signatures still work, so this is not a breaking change.

YuhanLiin commented 4 years ago

Will this change even be useful for pre_init, since it can't access any statics anyways?

cr1901 commented 4 years ago

@YuhanLiin Hmmm, good point. Merging.