Hi.
I am building my application on top of ble_app_uart__saadc_timer_driven__scan_mode example.
I want to interface an i2c device with it. The i2c device works perfectly with twi_scanner and twi_sensor examples.
But when I put the same code in the saadc_timer_driven example, it gives this error in nrf_drv_twi.h
'NRF_DRV_TWI_INSTANCE_0' undeclared here (not in a function); did you mean 'NRF_DRV_TWI_INSTANCE_'?
The code block where this error appears is
/**
* @brief Macro for creating a TWI master driver instance.
*/
#define NRF_DRV_TWI_INSTANCE(id) NRF_DRV_TWI_INSTANCE_(id)
#define NRF_DRV_TWI_INSTANCE_(id) NRF_DRV_TWI_INSTANCE_ ## id
#if NRFX_CHECK(NRFX_TWIM0_ENABLED)
#define NRF_DRV_TWI_INSTANCE_0 \
{ 0, { .twim = NRFX_TWIM_INSTANCE(0) }, true }
#elif NRFX_CHECK(NRFX_TWI0_ENABLED)
#define NRF_DRV_TWI_INSTANCE_0 \
{ 0, { .twi = NRFX_TWI_INSTANCE(0) }, false }
#endif
#if NRFX_CHECK(NRFX_TWIM1_ENABLED)
#define NRF_DRV_TWI_INSTANCE_1 \
{ 1, { .twim = NRFX_TWIM_INSTANCE(1) }, true }
#elif NRFX_CHECK(NRFX_TWI1_ENABLED)
#define NRF_DRV_TWI_INSTANCE_1 \
{ 1, { .twi = NRFX_TWI_INSTANCE(1) }, false }
#endif
This happens even when the code has
static const nrf_drv_twi_t m_twi_mpu_6050 = NRF_DRV_TWI_INSTANCE(0);
I even made the sdk_config.h same (twi parts, of course)
I should also mention the lines regarding TWI in config.h, which are as follows:
#define TWI_ENABLED 1 #define TWI0_ENABLED 1 #define TWI0_USE_EASY_DMA 1 #define NRFX_TWI_ENABLED 1 #define NRFX_TWI0_ENABLED 1 #define NRFX_TWIM_ENABLED 1 #define NRFX_TWIM0_ENABLED 1
I also tried with
#define NRFX_TWIM_ENABLED 0 #define NRFX_TWIM0_ENABLED 0
But it made no difference
What am I doing wrong here? Any help would be highly appreciated.
Thanks in advance.