nRF51 SDK
|
The bicycle power-only sensor implementation. More...
Macros | |
#define | UART_TX_BUF_SIZE 128u |
#define | UART_RX_BUF_SIZE 1u |
#define | BP_TX_ANT_CHANNEL 0 |
#define | BP_PAGE_1 0x01u |
#define | BP_PAGE_16 0x10u |
#define | COMMON_PAGE_80 0x50u |
#define | COMMON_PAGE_81 0x51u |
#define | BP_PAGE_RESERVE_BYTE 0xFFu |
#define | BP_CID_170 0xAAu |
Enumerations | |
enum | antplus_event_t { ANTPLUS_EVENT_PAGE, ANTPLUS_EVENT_MAX, ANTPLUS_EVENT_NONE, ANTPLUS_EVENT_CALIBRATION_REQUEST, ANTPLUS_EVENT_PAGE, ANTPLUS_EVENT_MAX, ANTPLUS_EVENT_NONE, ANTPLUS_EVENT_CALIBRATION_REQUEST } |
Bicycle Power profile application events. More... | |
Functions | |
static 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 errors, which is called when an error has occurred. More... | |
static __INLINE void | softdevice_setup (void) |
Function for configuring and setting up the SoftDevice. | |
int | main () |
Function for main application entry. Does not return. | |
uint32_t | bp_only_tx_initialize (void) |
Function for initializing the module. More... | |
uint32_t | bp_only_tx_channel_event_handle (uint32_t event, uint8_t const *p_event_message_buffer, antplus_event_return_t *p_event_return) |
Function for processing received ANT channel event message. More... | |
uint32_t | bp_only_tx_power_increment (void) |
Function for incrementing the power-only message instantaneous power field by 2. More... | |
uint32_t | bp_only_tx_power_decrement (void) |
Function for decrementing the power-only message instantaneous power field by 2. More... | |
uint32_t | bp_only_tx_calib_resp_transmit (bool calibration_success, uint32_t calibration_data) |
Function for preparing and queueing calibration response message ready for transmission. More... | |
void | bp_only_tx_main_loop_run (void) |
Function for running the bicycle power-only TX main processing loop. Does not return. | |
Data Structures | |
struct | antplus_event_return_t |
Bicycle Power profile to application communication object. More... | |
The bicycle power-only sensor implementation implements all the features, which are required for the sensor to be compliant with the ANT+ Bike Power profile, as defined by the ANT+ Bicycle Power Profile specification:
The general architecture of the power-only sensor is illustrated in the picture below.
A simple user interface exists consisting of 2 keypad buttons, which allow the user to decrease or increase the instantaneous power value.
The following compile time configuration options are available to suite various bicycle power-only sensor implementations:
The bicycle power-only sensor will trace ASSERT macro specific information to UART depending on the selected compile time configuration options.
The following compile time configuration options are available, and enabled by default, to assist in the development phase of the power-only sensor implementation:
#define UART_TX_BUF_SIZE 128u |
UART Tx buffer size.
#define UART_RX_BUF_SIZE 1u |
UART Rx buffer size.
#define BP_TX_ANT_CHANNEL 0 |
Default ANT Channel used.
#define BP_PAGE_1 0x01u |
Calibration message main data page.
#define BP_PAGE_16 0x10u |
Standard Power only main data page.
#define COMMON_PAGE_80 0x50u |
Manufacturer's identification common data page.
#define COMMON_PAGE_81 0x51u |
Product information common data page.
#define BP_PAGE_RESERVE_BYTE 0xFFu |
Page reserved value.
#define BP_CID_170 0xAAu |
Calibration ID 0xAA = generic calibration request.
enum antplus_event_t |
|
static |
Traces out the user supplied parameters and busy loops.
[in] | pc | The value of the program counter. |
[in] | line_num | The line number where the assert occurred. |
[in] | p_file_name | File name where asserted. |
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.
[in] | error_code | Error code supplied to the handler. |
[in] | line_num | Line number where the handler is called. |
[in] | p_file_name | Pointer to the file name. |
uint32_t bp_only_tx_initialize | ( | void | ) |
Transmits the first broadcast message.
uint32_t bp_only_tx_channel_event_handle | ( | uint32_t | event, |
uint8_t const * | p_event_message_buffer, | ||
antplus_event_return_t * | p_event_return | ||
) |
[in] | event | ANT event received. |
[in] | p_event_message_buffer | ANT event message buffer. |
[out] | p_event_return | Output data from the profile. |
uint32_t bp_only_tx_power_increment | ( | void | ) |
uint32_t bp_only_tx_power_decrement | ( | void | ) |
uint32_t bp_only_tx_calib_resp_transmit | ( | bool | calibration_success, |
uint32_t | calibration_data | ||
) |
Response message is delivered to the ANT stack for transmission upon receiving EVENT_TX.
[in] | calibration_success | True for calibration response success. |
[in] | calibration_data | Signed 16-bit calibration data for the response message. |