nrf_twi_mngr_transfer_t and const write data

I am trying to populate a nrf_twi_mngr_transfer_t at runtime depending on chunks of an input file that I'm pushing to i2c. 

nrf_twi_mngr_transfer_t const write_cfg_transfers[] = {
   NRF_TWI_MNGR_WRITE(bytes[0] >> 1, &data, i-1, 0),
};
Then I get a build error - 

error: initializer element is not constant

How is this done? 

I've tried using the twi instance from the twi_mngr struct, I can see it on the wire, but I get a hardfault on invoking the callback (likley undefined at this point)

ret_code_t err_code = nrf_drv_twi_tx(&(m_nrf_twi_mngr.twi), bytes[0] >> 1, data, i-1, false);
Parents
  • If I switch back to the nrf_drv_twi_tx/nrf_drv_twi_rx API, is there a way to disable the callback?
    It looks like it is trying to invoke the callback from the macro 

    NRF_TWI_MNGR_DEF - 

    static nrf_twi_mngr_cb_t CONCAT_2(_nrf_twi_mngr_name, _cb); \

    I tried to set the callback as NULL but it is read only. Otherwise, this is what I get 



    I'm looking for a sensible way to use the nrf_drv_twi_tx/rx API's alongside the twi_mngr so I don't have to rewrite all the other things using the manager. 

    edit - If I do this before the application uses twi_mngr, I can run nrf_drv_twi_init, then nrf_drv_twi_uninit. Then twi_mngr can be used freely.

Reply
  • If I switch back to the nrf_drv_twi_tx/nrf_drv_twi_rx API, is there a way to disable the callback?
    It looks like it is trying to invoke the callback from the macro 

    NRF_TWI_MNGR_DEF - 

    static nrf_twi_mngr_cb_t CONCAT_2(_nrf_twi_mngr_name, _cb); \

    I tried to set the callback as NULL but it is read only. Otherwise, this is what I get 



    I'm looking for a sensible way to use the nrf_drv_twi_tx/rx API's alongside the twi_mngr so I don't have to rewrite all the other things using the manager. 

    edit - If I do this before the application uses twi_mngr, I can run nrf_drv_twi_init, then nrf_drv_twi_uninit. Then twi_mngr can be used freely.

Children
No Data
Related