nRF5 SDK v13.0.0
Macros
FIFO instance macros

Macros

#define APP_ATFIFO_BUF_NAME(fifo_id)   CONCAT_2(fifo_id, _data)
 Macro to generate the name for data buffer. More...
 
#define APP_ATFIFO_INST_NAME(fifo_id)   CONCAT_2(fifo_id, _inst)
 Macro to generate the name for FIFO instance. More...
 
#define APP_ATFIFO_DEF(fifo_id, storage_type, item_cnt)
 Instance creation macro. More...
 
#define APP_ATFIFO_INIT(fifo_id)
 Use this macro to initialize FIFO declared previously by the macro. More...
 

Detailed Description

A group of macros helpful for FIFO instance creation and initialization. They may be used to create and initialize instances for most use cases.

FIFO may also be created and initialized directly using app_atfifo_init function.

Macro Definition Documentation

#define APP_ATFIFO_BUF_NAME (   fifo_id)    CONCAT_2(fifo_id, _data)

Macro to generate the name for data buffer.

The name of the data buffer that would be created by APP_ATFIFO_DEF macro.

Parameters
[in]fifo_idThe identifier of the FIFO object.
Returns
The name of the buffer variable.
#define APP_ATFIFO_DEF (   fifo_id,
  storage_type,
  item_cnt 
)
Value:
static storage_type APP_ATFIFO_BUF_NAME(fifo_id)[(item_cnt)+1]; \
static app_atfifo_t * const fifo_id = &APP_ATFIFO_INST_NAME(fifo_id)

Instance creation macro.

Creates FIFO object variable itself and

Use example:

APP_ATFIFO_DEF(my_fifo, uint16_t, 12);
APP_ATFIFO_INIT(my_fifo);
uint16_t some_val = 45;
app_atfifo_put(my_fifo, &some_val, sizeof(some_val), NULL);
app_atfifo_get(my_fifo, &some_val, sizeof(some_val), NULL);
Parameters
[in]fifo_idThe identifier of FIFO object. This identifier would be a pointer to the instance. It makes it possible to use this directly for the functions that operates on the FIFO. Because it is static const object, it should be optimized by the compiler.
[in]storage_typeThe type of data that would be stored in the FIFO.
[in]item_cntThe capacity of created FIFO in maximum number of items that may be stored. The phisical size of the buffer would be 1 element bigger.
#define APP_ATFIFO_INIT (   fifo_id)
Value:
fifo_id, \
&APP_ATFIFO_BUF_NAME(fifo_id), \
sizeof(APP_ATFIFO_BUF_NAME(fifo_id)), \
sizeof(APP_ATFIFO_BUF_NAME(fifo_id)[0]) \
)

Use this macro to initialize FIFO declared previously by the macro.

Use this macro to simplify FIFO initialization.

Note
This macro can be only used on FIFO object defined by APP_ATFIFO_DEF macro.
Parameters
[in]fifo_idThe identifier of the FIFO object.
Returns
The value from app_atfifo_init function.
#define APP_ATFIFO_INST_NAME (   fifo_id)    CONCAT_2(fifo_id, _inst)

Macro to generate the name for FIFO instance.

The name of instance variable that would be created by APP_ATFIFO_DEF macro.

Parameters
[in]fifo_idThe identifier of the FIFO object.
Returns
The name of the instance variable.

Documentation feedback | Developer Zone | Subscribe | Updated