Hello everyone,
there is so much i2c code in the nrf52_bitfields.h (s132).
Is there any example for i2c and s132?
Thanks!
There are several TWI examples in the SDK, and the most relevant is often the TWI Sensor Example, which uses the TWI master driver. The example does not use a SoftDevice, but you can use the exact same method in an application that use a SoftDevice.
(TWI is the same as I2C, but there are legal reasons for not using that name.)
Not a templet project per se, but the TWI Sensor Example is a demonstration of how the nRF can be configured to act as a I2C master. You can copy the code into your applications and make the required modifications.
You can add C++ files and libraries to your Keil project. However, I am not sure it will make your job easier. Remember that you must interface with the TWI master peripheral on the nRF, and this is most easily done using the TWI master driver. I think you will use more time trying to port an existing driver for the MCP9808 to the nRF rather than just making your own "library" based on the TWI master driver and the specific code needed to configure and read temperature from the sensor (you can always find inspiration from other existing libraries).