nRF51 SDK
|
Example of ANT HRM TX profile where the user can directly control the computed heart rate value using buttons. More...
Functions | |
uint32_t | hrm_tx_open (void) |
Function for initializing the HRM transmitter. More... | |
uint32_t | hrm_tx_channel_event_handle (uint32_t ant_event) |
Function for processing an ANT channel event. More... | |
uint32_t | hrm_tx_heart_rate_increment (void) |
Function for incrementing the current instantaneous heart rate value. More... | |
uint32_t | hrm_tx_heart_rate_decrement (void) |
Function for decrementing the current instantaneous heart rate value. More... | |
void | main_hrm_tx_run (void) |
Function for configuring the device simulator and HRM TX channel. Does not return. More... | |
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... | |
int | main (void) |
Function for application main entry. Does not return. | |
void | button_event_handler (uint8_t pin_no, uint8_t button_action) |
Function for handling button events. More... | |
void | SD_EVT_IRQHandler (void) |
Function for handling protocol stack IRQ. More... | |
Example of ANT HRM TX profile where the user can directly control the computed heart rate value using buttons.
#define ANT_EVENT_MSG_BUFFER_MIN_SIZE 32u |
Minimum size of ANT event message buffer.
#define ANTPLUS_NETWORK_NUMBER 0 |
Network number.
#define ANTPLUS_RF_FREQ 0x39u |
Frequency, Decimal 57 (2457 MHz).
#define APP_GPIOTE_MAX_USERS 1u |
Maximum number of users of the GPIOTE handler.
#define APP_TIMER_MAX_TIMERS 1u |
Maximum number of simultaneously created timers.
#define APP_TIMER_OP_QUEUE_SIZE 2u |
Size of timer operation queues.
#define APP_TIMER_PRESCALER 0 |
Value of the RTC1 PRESCALER register.
#define BUTTON_DETECTION_DELAY APP_TIMER_TICKS(50u, APP_TIMER_PRESCALER) |
Delay from a GPIOTE event until a button is reported as pushed (in number of timer ticks).
#define HEART_RATE_VALUE_DECREMENT HEART_RATE_VALUE_INCREMENT |
Instantaneous heart rate value decrement amount.
#define HEART_RATE_VALUE_INCREMENT 2u |
Instantaneous heart rate value increment amount.
#define HIGH_BYTE | ( | word | ) | (uint8_t)((word >> 8u) & 0x00FFu) |
Get high byte of a uint16_t.
#define HRM_DEVICE_NUMBER 49u |
ANT device number.
#define HRM_PAGE_1 1u |
HRM page 1 constant.
#define HRM_PAGE_2 2u |
HRM page 2 constant.
#define HRM_PAGE_3 3u |
HRM page 3 constant.
#define HRM_PAGE_4 4u |
HRM page 4 constant.
#define HRM_TRANSMISSION_TYPE 5u |
ANT transmission type.
#define HRMTX_ANT_CHANNEL 1u |
Default ANT Channel.
#define HRMTX_DEVICE_TYPE 0x78 |
Channel ID.
#define HRMTX_HW_VERSION 5u |
HW Version.
#define HRMTX_MFG_ID 2u |
Manufacturer ID.
#define HRMTX_MODEL_NUMBER 2u |
Model Number.
#define HRMTX_MSG_PERIOD 0x1F86u |
Decimal 8070 (4.06Hz).
#define HRMTX_MSG_PERIOD_IN_MSECS 246u |
HR TX message period in mseconds.
#define HRMTX_NETWORK_KEY {0, 0, 0, 0, 0, 0, 0, 0} |
The default network key used.
#define HRMTX_SERIAL_NUMBER 0xABCDu |
Serial Number.
#define HRMTX_SW_VERSION 0u |
SW Version.
#define INITIAL_HEART_RATE_VALUE 60u |
Initial value for instantaneous heart rate value.
#define LOW_BYTE | ( | word | ) | (uint8_t)(word & 0x00FFu) |
Get low byte of a uint16_t.
#define MAX_HEART_RATE_VALUE 255u |
Maximum allowed instantaneous heart rate value.
#define MIN_HEART_RATE_VALUE 1u |
Minimum allowed instantaneous heart rate value.
#define UART_RX_BUF_SIZE 1u |
UART RX buffer size.
#define UART_TX_BUF_SIZE 256u |
UART TX buffer size.
void app_error_handler | ( | uint32_t | error_code, |
uint32_t | line_num, | ||
const uint8_t * | p_file_name | ||
) |
Function for handling an error.
Function for error handling, which is called when an error has occurred.
[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. |
void button_event_handler | ( | uint8_t | pin_no, |
uint8_t | button_action | ||
) |
Function for handling button events.
[in] | pin_no | The pin number of the button pressed. |
uint32_t hrm_tx_channel_event_handle | ( | uint32_t | ant_event | ) |
Function for processing an ANT channel event.
Function for processing ANT channel event.
[in] | ant_event | ANT channel event. |
NRF_SUCCESS | Operation success. |
uint32_t hrm_tx_heart_rate_decrement | ( | void | ) |
Function for decrementing the current instantaneous heart rate value.
NRF_SUCCESS | Operation success. |
< Instantaneous heart rate value increment amount.
< Instantaneous heart rate value decrement amount.
< Minimum allowed instantaneous heart rate value.
< Maximum allowed instantaneous heart rate value.
uint32_t hrm_tx_heart_rate_increment | ( | void | ) |
Function for incrementing the current instantaneous heart rate value.
NRF_SUCCESS | Operation success. |
< Instantaneous heart rate value increment amount.
< Maximum allowed instantaneous heart rate value.
< Minimum allowed instantaneous heart rate value.
uint32_t hrm_tx_open | ( | void | ) |
Function for initializing the HRM transmitter.
Function for initializing HRM transmitter.
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. |
void main_hrm_tx_run | ( | void | ) |
Function for configuring the device simulator and HRM TX channel. Does not return.
Function for configuring the device simulator and HRM TX channel, does not return.
< Value of the RTC1 PRESCALER register.
< Maximum number of simultaneously created timers.
< Size of timer operation queues.
< Maximum number of users of the GPIOTE handler.
< Value of the RTC1 PRESCALER register.
< Delay from a GPIOTE event until a button is reported as pushed (in number of timer ticks).
void SD_EVT_IRQHandler | ( | void | ) |
Function for handling protocol stack IRQ.
Interrupt is generated by the ANT stack upon sending an event to the application.
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.
Traces out the user supplied parameters and busy loops.
[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. |