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

Conversion of Wire.h for nRF52832

Hello all,

I am trying to make use of some Sparkfun libraries for some sensors in my nrF52pca10040.

I am interested on I2C, these libraries use the Arduino library Wire.h for the initialization of the I2C while i would like to use the nrf_drv_twi functions.

Do you have some examples or suggestion ? i have already check the discussion here  https://devzone.nordicsemi.com/f/nordic-q-a/20645/how-can-i-reuse-this-library-into-twi-library-in-nrf52

Thank you very much in advance,

Kind regards,

polimarte

Parents
  • Sparkfun do have an Arduino core for their nRF-based boards, so you could use that? But that's nothing to do with Nordic - so you'd need to go to Sparkfun for support on it.

    The thing to remember is that the I2C device neither knows nor cares what programming environment you use - all it sees is what ends up getting sent on the wires. So what you need to do is:

    1. Understand what the existing code is sending on the wires (using Wire);
    2. Do the same - but use nrf_drv_twi.

    Or pehaps you implement the Wire API using nrf_drv_twi ... ?

Reply
  • Sparkfun do have an Arduino core for their nRF-based boards, so you could use that? But that's nothing to do with Nordic - so you'd need to go to Sparkfun for support on it.

    The thing to remember is that the I2C device neither knows nor cares what programming environment you use - all it sees is what ends up getting sent on the wires. So what you need to do is:

    1. Understand what the existing code is sending on the wires (using Wire);
    2. Do the same - but use nrf_drv_twi.

    Or pehaps you implement the Wire API using nrf_drv_twi ... ?

Children
Related