nRF51 SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
ANT HRM TX example

Example of ANT HRM TX profile. More...

Macros

#define UART_TX_BUF_SIZE   256u
 
#define UART_RX_BUF_SIZE   1u
 
#define HRM_DEVICE_NUMBER   49u
 
#define HRM_TRANSMISSION_TYPE   5u
 
#define HRMTX_ANT_CHANNEL   1u
 
#define HRMTX_MFG_ID   2u
 
#define HRMTX_SERIAL_NUMBER   0xABCDu
 
#define HRMTX_HW_VERSION   5u
 
#define HRMTX_SW_VERSION   0
 
#define HRMTX_MODEL_NUMBER   2u
 
#define ANTPLUS_NETWORK_NUMBER   0
 
#define ANTPLUS_RF_FREQ   0x39u
 

Functions

void softdevice_assert_callback (uint32_t pc, uint16_t line_num, const uint8_t *p_file_name)
 Function for handling SoftDevice asserts, does not return. More...
 
void app_error_handler (uint32_t error_code, uint32_t line_num, const uint8_t *p_file_name)
 Function for handling an error. More...
 
static __INLINE void softdevice_setup (void)
 Function for configuring and setting up the SoftDevice.
 
int main (void)
 Function for application main entry, does not return.
 
uint32_t hrm_tx_open (void)
 Function for initializing HRM transmitter. More...
 
uint32_t hrm_tx_channel_event_handle (uint32_t ant_event)
 Function for processing ANT channel event. More...
 
void main_hrm_tx_run (void)
 Function for configuring the device simulator and HRM TX channel, does not return.
 

Detailed Description

This example is a Heart Rate Monitor (HRM) transmitter simulator. It will transmit the users heart rate information in the main data page (page 4).

Device specific information is transmitted at a slower rate in the background data pages (pages 1-3). It will print out profile state information to UART when data is transmitted out of the device.

HRM specific configuration options

The following compile time configuration options are available to suit various HRM transmitter implementations:

Development phase configuration options

The HRM transmitter simulator will trace out various types of state information to the UART depending on the selected compile time configuration options.

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

Note
The ANT+ Network Key is available for ANT+ Adopters. Please refer to http://thisisant.com to become an ANT+ Adopter and access the key.

Macro Definition Documentation

#define UART_TX_BUF_SIZE   256u

UART Tx buffer size.

#define UART_RX_BUF_SIZE   1u

UART Rx buffer size.

#define HRM_DEVICE_NUMBER   49u

Denotes the used ANT device number.

#define HRM_TRANSMISSION_TYPE   5u

Denotes the used ANT transmission type.

#define HRMTX_ANT_CHANNEL   1u

Default ANT Channel.

#define HRMTX_MFG_ID   2u

Manufacturer ID.

#define HRMTX_SERIAL_NUMBER   0xABCDu

Serial Number.

#define HRMTX_HW_VERSION   5u

HW Version.

#define HRMTX_SW_VERSION   0

SW Version.

#define HRMTX_MODEL_NUMBER   2u

Model Number.

#define ANTPLUS_NETWORK_NUMBER   0

Network number.

#define ANTPLUS_RF_FREQ   0x39u

Frequency, Decimal 57 (2457 MHz).

Function Documentation

void softdevice_assert_callback ( uint32_t  pc,
uint16_t  line_num,
const uint8_t *  p_file_name 
)

Traces out the user supplied parameters and busy loops.

Parameters
[in]pcValue of the program counter.
[in]line_numLine number where the assert occurred.
[in]p_file_namePointer to the file name.
void app_error_handler ( uint32_t  error_code,
uint32_t  line_num,
const uint8_t *  p_file_name 
)

Function for error handling, which is called when an error has occurred.

Parameters
[in]error_codeError code supplied to the handler.
[in]line_numLine number where the error occurred.
[in]p_file_namePointer to the file name.
uint32_t hrm_tx_open ( void  )
Return values
NRF_SUCCESSOperation success.
NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATEOperation failure. Attempt to perform an action in a wrong channel state.
NRF_ANT_ERROR_INVALID_NETWORK_NUMBEROperation failure. Invalid network number provided.
NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDEDOperation failure. Invalid parameter specified in a configuration message.

Function for initializing HRM transmitter.

Return values
NRF_SUCCESSOperation success.
NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATEOperation failure. Attempt to perform an action in a wrong channel state.
NRF_ANT_ERROR_INVALID_NETWORK_NUMBEROperation failure. Invalid network number provided.
NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDEDOperation failure. Invalid parameter specified in a configuration message.
uint32_t hrm_tx_channel_event_handle ( uint32_t  ant_event)
Parameters
[in]ant_eventANT channel event.
Return values
NRF_SUCCESSOperation success.

Function for processing ANT channel event.

Parameters
[in]ant_eventANT channel event.
Return values
NRF_SUCCESSOperation success.