Which is the preferred way, accessing sensor via the TWI
1) NRFX_Driver
2) TWI HAL
what options do I need to select in the SDK_CONFIG.h to use the twi_driver api.
Which is the preferred way, accessing sensor via the TWI
1) NRFX_Driver
2) TWI HAL
what options do I need to select in the SDK_CONFIG.h to use the twi_driver api.
Also, what does this imply 'NRF_DRV_TWI_INSTANCE_0' was not declared , I have enabled TWI in sdk_config.h
I sorted the 'NRF_DRV_TWI_INSTANCE_0' issue with sdk_config.h
The "abstraction flow" for accessing the twi peripherals (and the other peripherals) in SDK 15.x.x is the following:
TWI driver (Legacy layer) → TWI driver (NRFX) → TWI HAL
Unless you need complete control and flexibility of what you are doing I would not recommend you to use the TWI HAL, as it requires a lot of extra work. Regarding the choice of driver, there has been some discussion about this. However, I would recommend you to use the TWI driver, since all the examples in the SDK uses this and I think it will be less to troublesome. Also the legacy driver is more compatible with BLE functionality.
In the sdk_config.h file, you should use the legacy definitions and ignore the NRFX definitions, as explained here.
Best regards,
Simon