nRF5 SDK v15.0.0
Macros | Typedefs | Enumerations | Functions
Common module

Common module. More...

Macros

#define NRFX_CHECK(module_enabled)   (module_enabled)
 Macro for checking if the specified identifier is defined and it has a non-zero value. More...
 
#define NRFX_CONCAT_2(p1, p2)   NRFX_CONCAT_2_(p1, p2)
 Macro for concatenating two tokens in macro expansion. More...
 
#define NRFX_CONCAT_2_(p1, p2)   p1 ## p2
 Internal macro used by NRFX_CONCAT_2 to perform the expansion in two steps.
 
#define NRFX_CONCAT_3(p1, p2, p3)   NRFX_CONCAT_3_(p1, p2, p3)
 Macro for concatenating three tokens in macro expansion. More...
 
#define NRFX_CONCAT_3_(p1, p2, p3)   p1 ## p2 ## p3
 Internal macro used by NRFX_CONCAT_3 to perform the expansion in two steps.
 
#define NRFX_ROUNDED_DIV(a, b)   (((a) + ((b) / 2)) / (b))
 Macro for performing rounded integer division (as opposed to truncating the result). More...
 
#define NRFX_EASYDMA_LENGTH_VALIDATE(peripheral, length1, length2)
 Macro for checking if given lengths of EasyDMA transfers do not exceed the limit of the specified peripheral. More...
 
#define NRFX_WAIT_FOR(condition, attempts, delay_us, result)
 Macro for waiting until condition is met. More...
 

Typedefs

typedef void(* nrfx_irq_handler_t )(void)
 IRQ handler type.
 

Enumerations

enum  nrfx_drv_state_t {
  NRFX_DRV_STATE_UNINITIALIZED,
  NRFX_DRV_STATE_INITIALIZED,
  NRFX_DRV_STATE_POWERED_ON
}
 Driver state. More...
 

Functions

__STATIC_INLINE bool nrfx_is_in_ram (void const *p_object)
 Function for checking if an object is placed in the Data RAM region. More...
 
__STATIC_INLINE IRQn_Type nrfx_get_irq_number (void const *p_reg)
 Function for getting the interrupt number for a specific peripheral. More...
 
__STATIC_INLINE uint32_t nrfx_bitpos_to_event (uint32_t bit)
 Function for converting an INTEN register bit position to the corresponding event identifier. More...
 
__STATIC_INLINE uint32_t nrfx_event_to_bitpos (uint32_t event)
 Function for converting an event identifier to the corresponding INTEN register bit position. More...
 

Detailed Description

Common module.

Macro Definition Documentation

#define NRFX_CHECK (   module_enabled)    (module_enabled)

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_CONCAT_2 (   p1,
  p2 
)    NRFX_CONCAT_2_(p1, p2)

Macro for concatenating two tokens in macro expansion.

Note
This macro is expanded in two steps so that tokens given as macros themselves are fully expanded before they are merged.
Parameters
p1First token.
p2Second token.
Returns
The two tokens merged into one, unless they cannot together form a valid token (in such case, the preprocessor issues a warning and does not perform the concatenation).
See Also
NRFX_CONCAT_3
#define NRFX_CONCAT_3 (   p1,
  p2,
  p3 
)    NRFX_CONCAT_3_(p1, p2, p3)

Macro for concatenating three tokens in macro expansion.

Note
This macro is expanded in two steps so that tokens given as macros themselves are fully expanded before they are merged.
Parameters
p1First token.
p2Second token.
p3Third token.
Returns
The three tokens merged into one, unless they cannot together form a valid token (in such case, the preprocessor issues a warning and does not perform the concatenation).
See Also
NRFX_CONCAT_2
#define NRFX_EASYDMA_LENGTH_VALIDATE (   peripheral,
  length1,
  length2 
)
Value:
(((length1) < (1U << NRFX_CONCAT_2(peripheral, _EASYDMA_MAXCNT_SIZE))) && \
((length2) < (1U << NRFX_CONCAT_2(peripheral, _EASYDMA_MAXCNT_SIZE))))

Macro for checking if given lengths of EasyDMA transfers do not exceed the limit of the specified peripheral.

Parameters
peripheralPeripheral to check the lengths against.
length1First length to be checked.
length2Second length to be checked (pass 0 if not needed).
Returns
#define NRFX_ROUNDED_DIV (   a,
 
)    (((a) + ((b) / 2)) / (b))

Macro for performing rounded integer division (as opposed to truncating the result).

Parameters
aNumerator.
bDenominator.
Returns
Rounded (integer) result of dividing a by b.
#define NRFX_WAIT_FOR (   condition,
  attempts,
  delay_us,
  result 
)
Value:
do { \
result = false; \
uint32_t remaining_attempts = (attempts); \
do { \
if (condition) \
{ \
result = true; \
break; \
} \
NRFX_DELAY_US(delay_us); \
} while (--remaining_attempts); \
} while(0)

Macro for waiting until condition is met.

Parameters
[in]conditionCondition to meet.
[in]attemptsMaximum number of condition checks. Must not be 0.
[in]delay_usDelay between consecutive checks, in microseconds.
[out]resultBoolean variable to store the result of the wait process. Set to true if the condition is met or false otherwise.

Enumeration Type Documentation

Driver state.

Enumerator
NRFX_DRV_STATE_UNINITIALIZED 

Uninitialized.

NRFX_DRV_STATE_INITIALIZED 

Initialized but powered off.

NRFX_DRV_STATE_POWERED_ON 

Initialized and powered on.

Function Documentation

__STATIC_INLINE uint32_t nrfx_bitpos_to_event ( uint32_t  bit)

Function for converting an INTEN register bit position to the corresponding event identifier.

The event identifier is the offset between the event register address and the peripheral base address, and is equal (thus, can be directly cast) to the corresponding value of the enumerated type from HAL (nrf_*_event_t).

Parameters
bitINTEN register bit position.
Returns
Event identifier.
See Also
nrfx_event_to_bitpos
__STATIC_INLINE uint32_t nrfx_event_to_bitpos ( uint32_t  event)

Function for converting an event identifier to the corresponding INTEN register bit position.

The event identifier is the offset between the event register address and the peripheral base address, and is equal (thus, can be directly cast) to the corresponding value of the enumerated type from HAL (nrf_*_event_t).

Parameters
eventEvent identifier.
Returns
INTEN register bit position.
See Also
nrfx_bitpos_to_event
__STATIC_INLINE IRQn_Type nrfx_get_irq_number ( void const *  p_reg)

Function for getting the interrupt number for a specific peripheral.

Parameters
[in]p_regPeripheral base pointer.
Returns
Interrupt number associated with the pointed peripheral.
__STATIC_INLINE bool nrfx_is_in_ram ( void const *  p_object)

Function for checking if an object is placed in the Data RAM region.

Several peripherals (the ones using EasyDMA) require the transfer buffers to be placed in the Data RAM region. This function can be used to check if this condition is met.

Parameters
[in]p_objectPointer to an object whose location is to be checked.
Return values
trueIf the pointed object is located in the Data RAM region.
falseOtherwise.

Documentation feedback | Developer Zone | Subscribe | Updated