How can one define and use a dynamically allocated array, whose members are static const
?
Background: I need to do the above, to store the several transaction that are requested at runtime. The snipet bellow exemplifies how to define a transaction. This code uses the Nordic Semiicondictor nRF5x SDK.
static app_twi_transfer_t const transfers[] =
{
APP_TWI_WRITE(MMA7660_ADDR, p_reg_addr, 1, APP_TWI_NO_STOP),
APP_TWI_READ (MMA7660_ADDR, p_buffer, byte_cnt, 0)
};
static app_twi_transaction_t const transaction =
{
.callback = read_mma7660_registers_cb,
.p_user_data = NULL,
.p_transfers = transfers,
.number_of_transfers = sizeof(transfers)/sizeof(transfers[0])
};
APP_ERROR_CHECK(app_twi_schedule(&m_app_twi, &transaction));