This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SoftDevice 132, sdk 11, enter/exit nvic critical region

Hello,

I would like to ask your help for examples of nRF52 code, when entering and exiting critical regions (disabling interrupts without switching off a bluetooth connection) like:

sd_nvic_critical_region_enter();

//code to execute

sd_nvic_critical_region_exit();

I saw that the definition of the enter function (in nrf_nvic.c) require a pointer of uint8_t :

static inline uint32_t sd_nvic_critical_region_enter(uint8_t * p_is_nested_critical_region)`

How do I choose the p_is_nested_critical_region parameter ?

Thank you in advance

  • Hi Jimmy,

    the p_is_nested_critical_region is an output parameter, not an input , please see the documentation of the SoftDevice NVIC public functions, found here.

    If you call sd_nvic_critical_region_enter within another critical region, then p_is_nested_critical_regionis set to 1.

    If you're not using nested critical regions then just provide a uint8_t pointer as a parameter and ignore the output.

Related