Block allocator library

nRF5 SDK v16.0.0

The block allocator library enables the application to create a fixed-size block pool in RAM.

Usage

Use the macro NRF_BALLOC_DEF to declare a new pool. To create API for accessing the pool, use NRF_BALLOC_INTERFACE_DEC and NRF_BALLOC_INTERFACE_DEF .

NRF_BALLOC_DEF (m_app_pool, sizeof (uint8_t), POOL_SIZE);
NRF_BALLOC_INTERFACE_DEC (uint8_t, app_pool);
NRF_BALLOC_INTERFACE_DEF (uint8_t, app_pool, &m_app_pool);
int main( void )
{
nrf_balloc_init (&m_app_pool);
uint8_t * p_data = app_pool_alloc();