Development software: SES 4.16;
Computer platform: macOS 10.14.4;
I'm trying to use the nrf_drv_twi APIs to drive the sensor bma253. I try to learn from the example twi_sensor. After I configured the sdk_config.h of my ble_app_template project, the following ERROR appeared: 'NRF_DRV_TWI_INSTANCE_0' undeclared here (not in a function); did you mean 'NRF_DRV_TWI_INSTANCE_'?
I've found that was because that NRFX_TWIM0_ENABLED is still gray so the NRF_DRV_TWI_INSTANCE_0 is undefined. When I point my mouse to the gray NRFX_TWIM0_ENABLED and right click, the choose GO TO DEFINITION, the IDE always open the apply_old_config.h instead the sdk_config.h.
I tried many ways to turn it on but at last failed. I want to know how to config these TWI macros to let it work.
Begging for help~
How have you implemented the TWI into your main.c file?
Also please go through your sdk_config.h file to check that each of these defines are set to 1:
NRFX_TWIM_ENABLED 1NRFX_TWI_ENABLED 1TWI_ENABLED 1TWI0_ENABLED 1TWI0_USE_EASY_DMA 1TWI1_ENABLED 1TWI1_USE_EASY_DMA 1
I don't think the main.c can cause this problem. I've ensure those defines is like this:
NRFX_TWIM_ENABLED 1NRFX_TWI_ENABLED 1TWI_ENABLED 1TWI0_ENABLED 1TWI0_USE_EASY_DMA 1TWI1_ENABLED 0TWI1_USE_EASY_DMA 0
I don't need TWI1. Do I also need to set TWI1_ENABLED and TWI1_USE_EASY_DMA to 1?
Thanks for help, Simon. The problem has been solved. I used an sdk_config.h from a wrong path.
Glad you got it working!