This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Creating the nrf_twi_mngr without the NRF_TWI_MNGR_DEF macro

Cheers, again!

Our project uses an array of different modules, many of which will need to make use of the TWI manager.

I've been able to create the manager successfully using

Fullscreen
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

If the manager is defined in the same function I call
APP_ERROR_CHECK(nrf_twi_mngr_schedule(&m_nrf_twi_mngr, &accel_modeset_transaction));

It queues up fine.

However, I'm trying to extract the TWI  management into its own module (with its own .c and .h) that other modules wishing to use it can call in (such as my accelerator, my temp sensor, and other sensors). Queueing into the manager schedule within each of these require a pointer to m_nrf_twi_mngr, however when generated with the NRF_TWI_MNGR_DEF macro, &m_nrf_twi_mngr only accessible within the c file I declare it.

I've yet to figure out how to expose this to other modules who want to use it.
Defining "nrf_twi_mngr_t m_nrf_twi_mngr" in the h gives me compile errors over either conflicting qualifiers, or multiple definitions.

I've tried moving the macro into the twi.h, but I get a flood of linker errors such as:


Fullscreen
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


Those 3 get repeated 9 times.


Is there a known way to instantiate the m_nrf_twi_mngr in a way that would let me expose it in other module's C files, where I can define transactions and such like so
Fullscreen
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I can't seem to find any examples that instantiate the manager in a way that let's it be referenced from an included source; any help would be exceptionally appreciated!

Oh, and we're using SDK 15.0, SoftDevice 6.0, and the NRF5832 on a custom board, compiled with GCC

Thanks!