Example of ANT HRM TX profile.
More...
|
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.
|
|
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.
|
|
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:
- HRMTX_NETWORK_KEY ANT PLUS network key.
- ANTPLUS_NETWORK_NUMBER Network key associated with the channel.
- HRMTX_ANT_CHANNEL Channel number.
- HRM_DEVICE_NUMBER Device number.
- HRMTX_DEVICE_TYPE Device type.
- HRM_TRANSMISSION_TYPE Transmission type.
- ANTPLUS_RF_FREQ Channel radio frequency offset from 2400 MHz.
- HRMTX_MSG_PERIOD Channel period in 32 kHz counts.
- 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:
- TX_PAGE1 - output page 1 data to UART.
- TX_PAGE2 - output page 2 data to UART.
- TX_PAGE3 - output page 3 data to UART.
- TRACE_UART - UART output enabled.
- 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.
#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 |
#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 |
Frequency, Decimal 57 (2457 MHz).
#define UART_TX_BUF_SIZE 256u |
#define UART_RX_BUF_SIZE 1u |
uint32_t hrm_tx_open |
( |
void |
| ) |
|
- Return values
-
NRF_SUCCESS | Operation success. |
NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATE | Operation failure. Attempt to perform an action in a wrong channel state. |
NRF_ANT_ERROR_INVALID_NETWORK_NUMBER | Operation failure. Invalid network number provided. |
NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED | Operation failure. Invalid parameter specified in a configuration message. |
Function for initializing HRM transmitter.
- Return values
-
NRF_SUCCESS | Operation success. |
NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATE | Operation failure. Attempt to perform an action in a wrong channel state. |
NRF_ANT_ERROR_INVALID_NETWORK_NUMBER | Operation failure. Invalid network number provided. |
NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED | Operation failure. Invalid parameter specified in a configuration message. |
NRF_SUCCESS | Operation success. |
NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATE | Operation failure. Attempt to perform an action in a wrong channel state. |
NRF_ANT_ERROR_INVALID_NETWORK_NUMBER | Operation failure. Invalid network number provided. |
NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED | Operation failure. Invalid parameter specified in a configuration message. |
Function for initializing HRM transmitter.
- Return values
-
NRF_SUCCESS | Operation success. |
NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATE | Operation failure. Attempt to perform an action in a wrong channel state. |
NRF_ANT_ERROR_INVALID_NETWORK_NUMBER | Operation failure. Invalid network number provided. |
NRF_ANT_ERROR_INVALID_PARAMETER_PROVIDED | Operation failure. Invalid parameter specified in a configuration message. |
uint32_t hrm_tx_channel_event_handle |
( |
uint32_t |
ant_event | ) |
|
- Parameters
-
[in] | ant_event | ANT channel event. |
- Return values
-
NRF_SUCCESS | Operation success. |
Function for processing ANT channel event.
- Parameters
-
[in] | ant_event | ANT channel event. |
- Return values
-
NRF_SUCCESS | Operation success. |
- Parameters
-
[in] | ant_event | ANT channel event. |
- Return values
-
NRF_SUCCESS | Operation success. |
Function for processing ANT channel event.
- Parameters
-
[in] | ant_event | ANT channel event. |
- Return values
-
NRF_SUCCESS | Operation success. |
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] | pc | Value of the program counter. |
[in] | line_num | Line number where the assert occurred. |
[in] | p_file_name | Pointer 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_code | Error code supplied to the handler. |
[in] | line_num | Line number where the error occurred. |
[in] | p_file_name | Pointer to the file name. |