`/**
- @brief Macro for checking if the specified identifier is defined and it has
- a non-zero value.
*
- Normally, preprocessors treat all undefined identifiers as having the value
- zero. However, some tools, like static code analyzers, may issue a warning
- when such identifier is evaluated. This macro gives the possibility to suppress
- such warnings only in places where this macro is used for evaluation, not in
- the whole analyzed code.
*/
#define NRFX_CHECK(module_enabled) (module_enabled)`
看看 NRF 是怎么用 的 , 用了 条件编译 ,判断 NRFX_POWER_ENABLED && NRFX_CLOCK_ENABLED 是否定义
#if NRFX_CHECK(NRFX_POWER_ENABLED) && NRFX_CHECK(NRFX_CLOCK_ENABLED)
#if NRFX_POWER_CONFIG_IRQ_PRIORITY != NRFX_CLOCK_CONFIG_IRQ_PRIORITY
#error "IRQ priority for POWER and CLOCK have to be the same. Check <nrfx_config.h>."
#endif
priority = NRFX_POWER_CONFIG_IRQ_PRIORITY;
#elif NRFX_CHECK(NRFX_POWER_ENABLED)
priority = NRFX_POWER_CONFIG_IRQ_PRIORITY;
#elif NRFX_CHECK(NRFX_CLOCK_ENABLED)
priority = NRFX_CLOCK_CONFIG_IRQ_PRIORITY;
#endif