Module prelude

Source
Expand description

In the prelude, we export helper macros.

Macros§

access_global
Syntax helper for getting global variables of the form Mutex<RefCell<Option>>> from an interrupt-free context - eg in interrupt handlers.
access_globals
Similar to access_global, but combining multiple calls.
copy_be
Syntax helper for converting primitives to multi-byte fields.
copy_le
Syntax helper for converting primitives to multi-byte fields.
init_globals
Initialize one or more globals inside a critical section.
make_globals
Syntax helper for setting global variables of the form Mutex<RefCell<Option>>>. eg in interrupt handlers. Ideal for non-copy-type variables that can’t be initialized immediatiately.
make_simple_globals
Syntax helper for setting global variables of the form Mutex<Cell<>>>. eg in interrupt handlers. Ideal for copy-type variables.
parse_be
Syntax helper for parsing multi-byte fields into primitives.
parse_le
Syntax helper for parsing multi-byte fields into primitives.
setup_nvic
Automates Cortex-M NVIC setup. The second value is NVIC priority; lower is higher priority. Example use: setup_nvic!([ (TIM2, 6), (TIM3, 7), (EXTI0, 4), ], cp);