nRF5 SDK v17.1.0
ANT HRM simulator
This information applies to the following SoftDevice: S212

This module simulates data for the HRM Transmitter. The API for this module is available here: ANT HRM simulator

The module uses the Sensor Data Simulator to simulate automatic changes of the heart rate value.

Initialization

Use the following command to initialize the module:

const ant_hrm_simulator_cfg_t simulator_cfg =
DEFAULT_ANT_HRM_SIMULATOR_CFG(&m_ant_hrm, SIMULATOR_MIN, SIMULATOR_MAX, SIMULATOR_INCR);

If you want the heart rate to be changed automatically, add the following statement:

ant_hrm_simulator_init(&m_ant_hrm_simulator, &simulator_cfg, true);

If you want to be able to change the heart rate manually, add the following statement:

ant_hrm_simulator_init(&m_ant_hrm_simulator, &simulator_cfg, false);

Including the module in an application

Periodically call the HRM simulator in the application to prepare data for each TX event occurrence. The following snippet shows how to do this:

void ant_hrm_evt_handler(ant_hrm_profile_t * p_profile, ant_hrm_evt_t event)
{
switch (event)
{
/* fall through */
/* fall through */
/* fall through */
/* fall through */
ant_hrm_simulator_one_iteration(&m_ant_hrm_simulator);
break;
default:
break;
}
}

The following snippet shows how to change the heart rate manually:

void bsp_evt_handler(bsp_event_t evt)
{
switch (evt)
{
ant_hrm_simulator_increment(&m_ant_hrm_simulator);
break;
ant_hrm_simulator_decrement(&m_ant_hrm_simulator);
break;
default:
return; // no implementation needed
}
}

Documentation feedback | Developer Zone | Subscribe | Updated