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

Adding TWI to ble_app_hrs example

What is the difference between the twi_sensor example and the twi_master_using_app_twi example? Where do I find any documentation that describes the available functions for each nrf_drv peripheral? Here is what I need to do:

I have 6 TWI slave devices on one TWI bus.  I will need to send initialization data to setup these 6 devices before main loop begins.

In the main loop or in a scheduled app, I will need to periodically read from 4 of these TWI slave devices for:

  • battery capacity & voltage
  • temperature
  • XYZ data from accelerometer
  • Status of power switch via On/Off controller

To do this, which example would be best for this application?  The twi_sensor is called each time through the main loop. The twi_master_using_app_twi example appears to setup a scheduled of TWI transactions that occur in a round-robin sort of way.

Parents
  • Looking at the ble_app_hrs example, it creates and executes four services at various timer intervals:

    • Battery Level every 2 seconds
    • Heart Rate Measurement every 1 second
    • RR interval every 300 ms (I'm not sure what this does)
    • Sensor Contact every 5 seconds (I'm not sure what this does either)

    In my project, do I need to setup a service for each TWI slave that I want to monitor or using the TWIM can I setup one service that polls each TWI slave (one after the other) every few seconds?

Reply
  • Looking at the ble_app_hrs example, it creates and executes four services at various timer intervals:

    • Battery Level every 2 seconds
    • Heart Rate Measurement every 1 second
    • RR interval every 300 ms (I'm not sure what this does)
    • Sensor Contact every 5 seconds (I'm not sure what this does either)

    In my project, do I need to setup a service for each TWI slave that I want to monitor or using the TWIM can I setup one service that polls each TWI slave (one after the other) every few seconds?

Children
Related