nRF5 SDK v13.0.0
Modules | Data Structures | Macros | Typedefs | Enumerations | Functions
Heart Rate Monitor profile

This module implements the Heart Rate Monitor profile. More...

Modules

 Heart Rate Monitor Profile configuration
 
 Heart Rate Monitor profile pages
 This module implements functions for the HRM data pages.
 
 Heart Rate Monitor profile utilities
 This module implements utilities for the Heart Rate Monitor profile.
 

Data Structures

struct  ant_hrm_sens_config_t
 HRM sensor configuration structure. More...
 
struct  ant_hrm_profile_s
 HRM profile structure. More...
 
struct  ant_hrm_sens_cb_t
 HRM Sensor control block. More...
 

Macros

#define HRM_DEVICE_TYPE   0x78u
 Device type reserved for ANT+ heart rate monitor.
 
#define HRM_ANTPLUS_RF_FREQ   0x39u
 Frequency, decimal 57 (2457 MHz).
 
#define HRM_MSG_PERIOD_4Hz   0x1F86u
 Message period, decimal 8070 (4.06 Hz).
 
#define HRM_MSG_PERIOD_2Hz   0x3F0Cu
 Message period, decimal 16140 (2.03 Hz).
 
#define HRM_MSG_PERIOD_1Hz   0x7E18u
 Message period, decimal 32280 (1.02 Hz).
 
#define HRM_EXT_ASSIGN   0x00
 ANT ext assign.
 
#define HRM_DISP_CHANNEL_TYPE   CHANNEL_TYPE_SLAVE_RX_ONLY
 Display HRM channel type.
 
#define HRM_SENS_CHANNEL_TYPE   CHANNEL_TYPE_MASTER
 Sensor HRM channel type.
 
#define HRM_DISP_CHANNEL_CONFIG_DEF(NAME,CHANNEL_NUMBER,TRANSMISSION_TYPE,DEVICE_NUMBER,NETWORK_NUMBER,HRM_MSG_PERIOD)
 Initialize an ANT channel configuration structure for the HRM profile (Display). More...
 
#define HRM_DISP_CHANNEL_CONFIG(NAME)   &NAME##_channel_hrm_disp_config
 
#define HRM_SENS_CHANNEL_CONFIG_DEF(NAME,CHANNEL_NUMBER,TRANSMISSION_TYPE,DEVICE_NUMBER,NETWORK_NUMBER)
 Initialize an ANT channel configuration structure for the HRM profile (Sensor). More...
 
#define HRM_SENS_CHANNEL_CONFIG(NAME)   &NAME##_channel_hrm_sens_config
 
#define HRM_SENS_PROFILE_CONFIG_DEF(NAME,PAGE_1_PRESENT,MAIN_PAGE_NUMBER,EVT_HANDLER)
 Initialize an ANT profile configuration structure for the HRM profile (Sensor). More...
 
#define HRM_SENS_PROFILE_CONFIG(NAME)   &NAME##_profile_hrm_sens_config
 

Typedefs

typedef struct ant_hrm_profile_s ant_hrm_profile_t
 
typedef void(* ant_hrm_evt_handler_t )(ant_hrm_profile_t *, ant_hrm_evt_t)
 HRM event handler type.
 

Enumerations

enum  ant_hrm_page_t {
  ANT_HRM_PAGE_0,
  ANT_HRM_PAGE_1,
  ANT_HRM_PAGE_2,
  ANT_HRM_PAGE_3,
  ANT_HRM_PAGE_4
}
 HRM page number type. More...
 
enum  ant_hrm_evt_t {
  ANT_HRM_PAGE_0_UPDATED = ANT_HRM_PAGE_0,
  ANT_HRM_PAGE_1_UPDATED = ANT_HRM_PAGE_1,
  ANT_HRM_PAGE_2_UPDATED = ANT_HRM_PAGE_2,
  ANT_HRM_PAGE_3_UPDATED = ANT_HRM_PAGE_3,
  ANT_HRM_PAGE_4_UPDATED = ANT_HRM_PAGE_4
}
 HRM profile event type. More...
 

Functions

ret_code_t ant_hrm_disp_init (ant_hrm_profile_t *p_profile, ant_channel_config_t const *p_channel_config, ant_hrm_evt_handler_t evt_handler)
 Function for initializing the ANT HRM Display profile instance. More...
 
ret_code_t ant_hrm_sens_init (ant_hrm_profile_t *p_profile, ant_channel_config_t const *p_channel_config, ant_hrm_sens_config_t const *p_sens_config)
 Function for initializing the ANT HRM Sensor profile instance. More...
 
ret_code_t ant_hrm_disp_open (ant_hrm_profile_t *p_profile)
 Function for opening the profile instance channel for ANT HRM Display. More...
 
ret_code_t ant_hrm_sens_open (ant_hrm_profile_t *p_profile)
 Function for opening the profile instance channel for ANT HRM Sensor. More...
 
void ant_hrm_sens_evt_handler (ant_hrm_profile_t *p_profile, ant_evt_t *p_ant_event)
 Function for handling the sensor ANT events. More...
 
void ant_hrm_disp_evt_handler (ant_hrm_profile_t *p_profile, ant_evt_t *p_ant_event)
 Function for handling the display ANT events. More...
 

Defines for accessing ant_hrm_profile_t member variables

#define HRM_PROFILE_beat_count   page_0.beat_count
 
#define HRM_PROFILE_computed_heart_rate   page_0.computed_heart_rate
 
#define HRM_PROFILE_beat_time   page_0.beat_time
 
#define HRM_PROFILE_operating_time   page_1.operating_time
 
#define HRM_PROFILE_manuf_id   page_2.manuf_id
 
#define HRM_PROFILE_serial_num   page_2.serial_num
 
#define HRM_PROFILE_hw_version   page_3.hw_version
 
#define HRM_PROFILE_sw_version   page_3.sw_version
 
#define HRM_PROFILE_model_num   page_3.model_num
 
#define HRM_PROFILE_manuf_spec   page_4.manuf_spec
 
#define HRM_PROFILE_prev_beat   page_4.prev_beat
 

Detailed Description

This module implements the Heart Rate Monitor profile.

Macro Definition Documentation

#define HRM_DISP_CHANNEL_CONFIG_DEF (   NAME,
  CHANNEL_NUMBER,
  TRANSMISSION_TYPE,
  DEVICE_NUMBER,
  NETWORK_NUMBER,
  HRM_MSG_PERIOD 
)
Value:
static const ant_channel_config_t NAME##_channel_hrm_disp_config = \
{ \
.channel_number = (CHANNEL_NUMBER), \
.channel_type = HRM_DISP_CHANNEL_TYPE, \
.ext_assign = HRM_EXT_ASSIGN, \
.rf_freq = HRM_ANTPLUS_RF_FREQ, \
.transmission_type = (TRANSMISSION_TYPE), \
.device_type = HRM_DEVICE_TYPE, \
.device_number = (DEVICE_NUMBER), \
.channel_period = (HRM_MSG_PERIOD), \
.network_number = (NETWORK_NUMBER), \
}

Initialize an ANT channel configuration structure for the HRM profile (Display).

Parameters
[in]NAMEName of related instance.
[in]CHANNEL_NUMBERNumber of the channel assigned to the profile instance.
[in]TRANSMISSION_TYPEType of transmission assigned to the profile instance.
[in]DEVICE_NUMBERNumber of the device assigned to the profile instance.
[in]NETWORK_NUMBERNumber of the network assigned to the profile instance.
[in]HRM_MSG_PERIODChannel period in 32 kHz counts. The HRM profile supports only the following periods: HRM_MSG_PERIOD_4Hz, HRM_MSG_PERIOD_2Hz, HRM_MSG_PERIOD_1Hz.
#define HRM_SENS_CHANNEL_CONFIG_DEF (   NAME,
  CHANNEL_NUMBER,
  TRANSMISSION_TYPE,
  DEVICE_NUMBER,
  NETWORK_NUMBER 
)
Value:
static const ant_channel_config_t NAME##_channel_hrm_sens_config = \
{ \
.channel_number = (CHANNEL_NUMBER), \
.channel_type = HRM_SENS_CHANNEL_TYPE, \
.ext_assign = HRM_EXT_ASSIGN, \
.rf_freq = HRM_ANTPLUS_RF_FREQ, \
.transmission_type = (TRANSMISSION_TYPE), \
.device_type = HRM_DEVICE_TYPE, \
.device_number = (DEVICE_NUMBER), \
.channel_period = HRM_MSG_PERIOD_4Hz, \
.network_number = (NETWORK_NUMBER), \
}

Initialize an ANT channel configuration structure for the HRM profile (Sensor).

Parameters
[in]NAMEName of related instance.
[in]CHANNEL_NUMBERNumber of the channel assigned to the profile instance.
[in]TRANSMISSION_TYPEType of transmission assigned to the profile instance.
[in]DEVICE_NUMBERNumber of the device assigned to the profile instance.
[in]NETWORK_NUMBERNumber of the network assigned to the profile instance.
#define HRM_SENS_PROFILE_CONFIG_DEF (   NAME,
  PAGE_1_PRESENT,
  MAIN_PAGE_NUMBER,
  EVT_HANDLER 
)
Value:
static ant_hrm_sens_cb_t NAME##_hrm_sens_cb; \
static const ant_hrm_sens_config_t NAME##_profile_hrm_sens_config = \
{ \
.page_1_present = (PAGE_1_PRESENT), \
.main_page_number = (MAIN_PAGE_NUMBER), \
.p_cb = &NAME##_hrm_sens_cb, \
.evt_handler = (EVT_HANDLER), \
}

Initialize an ANT profile configuration structure for the HRM profile (Sensor).

Parameters
[in]NAMEName of related instance.
[in]PAGE_1_PRESENTDetermines whether page 1 is included.
[in]MAIN_PAGE_NUMBERDetermines the main data page (ANT_HRM_PAGE_0 or ANT_HRM_PAGE_4).
[in]EVT_HANDLEREvent handler to be called for handling events in the HRM profile.

Enumeration Type Documentation

HRM profile event type.

Enumerator
ANT_HRM_PAGE_0_UPDATED 

Data page 0 has been updated (Display) or sent (Sensor).

ANT_HRM_PAGE_1_UPDATED 

Data page 0 and page 1 have been updated (Display) or sent (Sensor).

ANT_HRM_PAGE_2_UPDATED 

Data page 0 and page 2 have been updated (Display) or sent (Sensor).

ANT_HRM_PAGE_3_UPDATED 

Data page 0 and page 3 have been updated (Display) or sent (Sensor).

ANT_HRM_PAGE_4_UPDATED 

Data page 0 and page 4 have been updated (Display) or sent (Sensor).

HRM page number type.

Enumerator
ANT_HRM_PAGE_0 

Main data page number 0.

ANT_HRM_PAGE_1 

Background data page number 1. This page is optional.

ANT_HRM_PAGE_2 

Background data page number 2.

ANT_HRM_PAGE_3 

Background data page number 3.

ANT_HRM_PAGE_4 

Main data page number 4.

Function Documentation

void ant_hrm_disp_evt_handler ( ant_hrm_profile_t p_profile,
ant_evt_t p_ant_event 
)

Function for handling the display ANT events.

This function handles all events from the ANT stack that are of interest to the Heart Rate Monitor Display profile.

Parameters
[in]p_profilePointer to the profile instance.
[in]p_ant_eventEvent received from the ANT stack.
ret_code_t ant_hrm_disp_init ( ant_hrm_profile_t p_profile,
ant_channel_config_t const *  p_channel_config,
ant_hrm_evt_handler_t  evt_handler 
)

Function for initializing the ANT HRM Display profile instance.

Parameters
[in]p_profilePointer to the profile instance.
[in]p_channel_configPointer to the ANT channel configuration structure.
[in]evt_handlerEvent handler to be called for handling events in the HRM profile.
Return values
NRF_SUCCESSIf initialization was successful. Otherwise, an error code is returned.
ret_code_t ant_hrm_disp_open ( ant_hrm_profile_t p_profile)

Function for opening the profile instance channel for ANT HRM Display.

Before calling this function, pages should be configured.

Parameters
[in]p_profilePointer to the profile instance.
Return values
NRF_SUCCESSIf the channel was successfully opened. Otherwise, an error code is returned.
void ant_hrm_sens_evt_handler ( ant_hrm_profile_t p_profile,
ant_evt_t p_ant_event 
)

Function for handling the sensor ANT events.

This function handles all events from the ANT stack that are of interest to the Heart Rate Monitor Sensor profile.

Parameters
[in]p_profilePointer to the profile instance.
[in]p_ant_eventEvent received from the ANT stack.
ret_code_t ant_hrm_sens_init ( ant_hrm_profile_t p_profile,
ant_channel_config_t const *  p_channel_config,
ant_hrm_sens_config_t const *  p_sens_config 
)

Function for initializing the ANT HRM Sensor profile instance.

Parameters
[in]p_profilePointer to the profile instance.
[in]p_channel_configPointer to the ANT channel configuration structure.
[in]p_sens_configPointer to the HRM sensor configuration structure.
Return values
NRF_SUCCESSIf initialization was successful. Otherwise, an error code is returned.
ret_code_t ant_hrm_sens_open ( ant_hrm_profile_t p_profile)

Function for opening the profile instance channel for ANT HRM Sensor.

Before calling this function, pages should be configured.

Parameters
[in]p_profilePointer to the profile instance.
Return values
NRF_SUCCESSIf the channel was successfully opened. Otherwise, an error code is returned.

Documentation feedback | Developer Zone | Subscribe | Updated