Heart Rate Monitor Profile

nRF5 SDK v9.0.0

nRF51 SDK v9.0.0

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

Modules

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_tx_config_t
HRM transmitter configuration structure. More...
struct ant_hrm_profile_t
HRM profile structure. 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_RX_CHANNEL_TYPE CHANNEL_TYPE_SLAVE_RX_ONLY
RX HRM channel type.
#define HRM_TX_CHANNEL_TYPE CHANNEL_TYPE_MASTER
TX HRM channel type.
#define HRM_TX_CB_SIZE (3)
Size of buffer for internal profile use.
#define HRM_RX_CHANNEL_CONFIG (CHANNEL_NUMBER, TRANSMISSION_TYPE, DEVICE_NUMBER, NETWORK_NUMBER, HRM_MSG_PERIOD)
Initialize an ANT channel configuration structure for the HRM profile (Receiver). More...
#define HRM_TX_CHANNEL_CONFIG (CHANNEL_NUMBER, TRANSMISSION_TYPE, DEVICE_NUMBER, NETWORK_NUMBER)
Initialize an ANT channel configuration structure for the HRM profile (Transmitter). More...

Typedefs

typedef void(* ant_hrm_evt_handler_t )( ant_hrm_profile_t *, ant_evt_t )
Heart Rate Monitor event handler type.

Functions

uint32_t ant_hrm_init ( ant_hrm_profile_t *p_profile, ant_channel_config_t const *p_channel_config, ant_hrm_tx_config_t const *p_tx_config)
Function for initializing the ANT HRM profile instance. More...
uint32_t ant_hrm_open ( ant_hrm_profile_t *p_profile)
Function for opening the profile instance channel. More...
void ant_hrm_tx_evt_handle ( ant_hrm_profile_t *p_profile, ant_evt_t *p_ant_event)
Function for handling the transmitter ANT events. More...
void ant_hrm_rx_evt_handle ( ant_hrm_profile_t *p_profile, ant_evt_t *p_ant_event)
Function for handling the receiver ANT events. More...

Detailed Description

This module implements the Heart Rate Monitor Profile.

Macro Definition Documentation

#define HRM_RX_CHANNEL_CONFIG ( CHANNEL_NUMBER,
TRANSMISSION_TYPE,
DEVICE_NUMBER,
NETWORK_NUMBER,
HRM_MSG_PERIOD
)
Value:
{ \
.channel_number = (CHANNEL_NUMBER), \
.channel_type = HRM_RX_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 (Receiver).

Parameters
[in] CHANNEL_NUMBER Number of the channel assigned to the profile instance.
[in] TRANSMISSION_TYPE Type of transmission assigned to the profile instance.
[in] DEVICE_NUMBER Number of the device assigned to the profile instance.
[in] NETWORK_NUMBER Number of the network assigned to the profile instance.
[in] HRM_MSG_PERIOD Channel period in 32 kHz counts. HRM profile supports only the following periods: HRM_MSG_PERIOD_4Hz , HRM_MSG_PERIOD_2Hz , HRM_MSG_PERIOD_1Hz .
#define HRM_TX_CHANNEL_CONFIG ( CHANNEL_NUMBER,
TRANSMISSION_TYPE,
DEVICE_NUMBER,
NETWORK_NUMBER
)
Value:
{ \
.channel_number = (CHANNEL_NUMBER), \
.channel_type = HRM_TX_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 (Transmitter).

Parameters
[in] CHANNEL_NUMBER Number of the channel assigned to the profile instance.
[in] TRANSMISSION_TYPE Type of transmission assigned to the profile instance.
[in] DEVICE_NUMBER Number of the device assigned to the profile instance.
[in] NETWORK_NUMBER Number of the network assigned to the profile instance.

Enumeration Type Documentation

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

uint32_t ant_hrm_init ( ant_hrm_profile_t * p_profile ,
ant_channel_config_t const * p_channel_config ,
ant_hrm_tx_config_t const * p_tx_config
)

Function for initializing the ANT HRM profile instance.

Parameters
[in] p_profile Pointer to the profile instance.
[in] p_channel_config Pointer to the ANT channel configuration structure.
[in] p_tx_config Pointer to the HRM transmitter configuration structure. Should be set to NULL when initializing the receiver.
Return values
NRF_SUCCESS If initialization was successful. Otherwise, an error code is returned.
uint32_t ant_hrm_open ( ant_hrm_profile_t * p_profile )

Function for opening the profile instance channel.

Before calling this function, pages should be configured.

Parameters
[in] p_profile Pointer to the profile instance.
Return values
NRF_SUCCESS If the channel was successfully opened. Otherwise, an error code is returned.
void ant_hrm_rx_evt_handle ( ant_hrm_profile_t * p_profile ,
ant_evt_t * p_ant_event
)

Function for handling the receiver ANT events.

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

Parameters
[in] p_profile Pointer to the profile instance.
[in] p_ant_event Event received from the ANT stack.
void ant_hrm_tx_evt_handle ( ant_hrm_profile_t * p_profile ,
ant_evt_t * p_ant_event
)

Function for handling the transmitter ANT events.

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

Parameters
[in] p_profile Pointer to the profile instance.
[in] p_ant_event Event received from the ANT stack.

Please send us your feedback about the documentation! For technical questions, visit the Nordic Developer Zone .