nRF5 SDK v17.1.0
Heart Rate Monitor
This information applies to the following SoftDevice: S212

This module implements the Heart Rate Monitor ANT+ device profile. The API for this module is available here: Heart Rate Monitor profile

During initialization, the module configures the selected channel and resets the profile data.

Compile time configuration options

The module traces profile-specific information to UART using the logger.

The following configuration options are available at compile time to assist in the development phase of the HRM Receiver implementation:

The above macros must be defined on the project settings level.

HRM Receiver

The following code snippets show how to initialize the HRM Receiver:

HRM_CHANNEL_NUM,
CHAN_ID_TRANS_TYPE,
CHAN_ID_DEV_NUM,
ANTPLUS_NETWORK_NUM,
static ant_hrm_profile_t m_ant_hrm;
ret_code_t err_code =
ant_hrm_disp_init(&m_ant_hrm, HRM_DISP_CHANNEL_CONFIG(m_ant_hrm), ant_hrm_evt_handler);
APP_ERROR_CHECK(err_code);
err_code = ant_hrm_disp_open(&m_ant_hrm);
APP_ERROR_CHECK(err_code);
APP_ERROR_CHECK(err_code);

After opening the profile instance channel, the module keeps the profile structure updated.

Three different message periods are supported:

The sample application that uses the Heart Rate Monitor Profile is available here: Receiver

HRM Transmitter

The following code snippets show how to initialize the HRM Transmitter:

void ant_hrm_evt_handler(ant_hrm_profile_t * p_profile, ant_hrm_evt_t event);
HRM_CHANNEL_NUM,
CHAN_ID_TRANS_TYPE,
CHAN_ID_DEV_NUM,
ANTPLUS_NETWORK_NUM);
true,
ant_hrm_evt_handler);
static ant_hrm_profile_t m_ant_hrm;
ret_code_t err_code;
err_code = ant_hrm_sens_init(&m_ant_hrm,
HRM_SENS_CHANNEL_CONFIG(m_ant_hrm),
HRM_SENS_PROFILE_CONFIG(m_ant_hrm));
APP_ERROR_CHECK(err_code);
m_ant_hrm.HRM_PROFILE_manuf_id = HRM_MFG_ID;
m_ant_hrm.HRM_PROFILE_serial_num = HRM_SERIAL_NUMBER;
m_ant_hrm.HRM_PROFILE_hw_version = HRM_HW_VERSION;
m_ant_hrm.HRM_PROFILE_sw_version = HRM_SW_VERSION;
m_ant_hrm.HRM_PROFILE_model_num = HRM_MODEL_NUMBER;
err_code = ant_hrm_sens_open(&m_ant_hrm);
APP_ERROR_CHECK(err_code);
APP_ERROR_CHECK(err_code);

After opening the profile instance channel, the module broadcasts the data from the profile structure. The user application should keep this structure updated. Users can configure which main data page is used (page 0 or 4) and whether page 1 is present.

The sample application that uses the Heart Rate Monitor Profile is available here: Transmitter

Note
The application must propagate ANT stack events to the ANT Heart Rate Monitor module by calling ant_hrm_tx_evt_handle() or ant_hrm_rx_evt_handle() from the ant_event_handler callback.
Warning
The ant_event_handler is called from an interrupt. Therefore, the profile structure is changed asynchronously.

Documentation feedback | Developer Zone | Subscribe | Updated