nRF5 SDK v17.1.0
Bicycle Power Monitor
This information applies to the following SoftDevice: S212

This module implements the Bicycle Power ANT+ device profile. The API for this module is available here: Bicycle Power profile

During initialization, the module configures the selected channel and resets the profile data.

Compile time configuration options

The module traces profile-specific information to UART using the logger.

The following configuration options are available at compile time to assist in the development phase of the Bicycle Power Receiver implementation:

The above macros must be defined on the project settings level.

Bicycle Power Receiver (display)

This module covers the full receiver implementation (PWR):

The following code snippets show how to initialize the profile:

void ant_bpwr_evt_handler(ant_bpwr_profile_t * p_profile, ant_bpwr_evt_t event);
BPWR_CHANNEL_NUM,
CHAN_ID_TRANS_TYPE,
CHAN_ID_DEV_NUM,
ANTPLUS_NETWORK_NUM);
ant_bpwr_evt_handler);
static ant_bpwr_profile_t m_ant_bpwr;
ret_code_t err_code = ant_bpwr_disp_init(&m_ant_bpwr,
BPWR_DISP_CHANNEL_CONFIG(m_ant_bpwr),
BPWR_DISP_PROFILE_CONFIG(m_ant_bpwr));
APP_ERROR_CHECK(err_code);
err_code = ant_bpwr_disp_open(&m_ant_bpwr);
APP_ERROR_CHECK(err_code);
APP_ERROR_CHECK(err_code);

After opening the profile instance channel, the module keeps the profile structure updated.

The sample application that uses the Bicycle Power Profile to implement a display is available here: Receiver

Bicycle Power Transmitter (sensor)

This module implements the power and torque sensor features:

You can configure which type of sensor is implemented: power-only sensor, torque sensor at wheel, or torque sensor at crank.

The following code snippets show how to initialize the profile:

void ant_bpwr_evt_handler(ant_bpwr_profile_t * p_profile, ant_bpwr_evt_t event);
void ant_bpwr_calib_handler(ant_bpwr_profile_t * p_profile, ant_bpwr_page1_data_t * p_page1);
BPWR_CHANNEL_NUM,
CHAN_ID_TRANS_TYPE,
CHAN_ID_DEV_NUM,
ANTPLUS_NETWORK_NUM);
(ant_bpwr_torque_t)(SENSOR_TYPE),
ant_bpwr_calib_handler,
ant_bpwr_evt_handler);
static ant_bpwr_profile_t m_ant_bpwr;
ret_code_t err_code;
err_code = ant_bpwr_sens_init(&m_ant_bpwr,
BPWR_SENS_CHANNEL_CONFIG(m_ant_bpwr),
BPWR_SENS_PROFILE_CONFIG(m_ant_bpwr));
APP_ERROR_CHECK(err_code);
// fill manufacturer's common data page.
m_ant_bpwr.page_80 = ANT_COMMON_page80(BPWR_HW_REVISION,
BPWR_MANUFACTURER_ID,
BPWR_MODEL_NUMBER);
// fill product's common data page.
m_ant_bpwr.page_81 = ANT_COMMON_page81(BPWR_SW_REVISION_MAJOR,
BPWR_SW_REVISION_MINOR,
BPWR_SERIAL_NUMBER);
m_ant_bpwr.BPWR_PROFILE_auto_zero_status = ANT_BPWR_AUTO_ZERO_OFF;
err_code = ant_bpwr_sens_open(&m_ant_bpwr);
APP_ERROR_CHECK(err_code);
APP_ERROR_CHECK(err_code);

The following snippet shows how to handle calibration request:

void ant_bpwr_calib_handler(ant_bpwr_profile_t * p_profile, ant_bpwr_page1_data_t * p_page1)
{
switch (p_page1->calibration_id)
{
m_ant_bpwr.BPWR_PROFILE_calibration_id = ANT_BPWR_CALIB_ID_MANUAL_SUCCESS;
m_ant_bpwr.BPWR_PROFILE_general_calib_data = CALIBRATION_DATA;
break;
m_ant_bpwr.BPWR_PROFILE_calibration_id = ANT_BPWR_CALIB_ID_MANUAL_SUCCESS;
m_ant_bpwr.BPWR_PROFILE_auto_zero_status = p_page1->auto_zero_status;
m_ant_bpwr.BPWR_PROFILE_general_calib_data = CALIBRATION_DATA;
break;
m_ant_bpwr.BPWR_PROFILE_calibration_id = ANT_BPWR_CALIB_ID_CUSTOM_REQ_SUCCESS;
memcpy(m_ant_bpwr.BPWR_PROFILE_custom_calib_data, p_page1->data.custom_calib,
sizeof (m_ant_bpwr.BPWR_PROFILE_custom_calib_data));
break;
m_ant_bpwr.BPWR_PROFILE_calibration_id = ANT_BPWR_CALIB_ID_CUSTOM_UPDATE_SUCCESS;
memcpy(m_ant_bpwr.BPWR_PROFILE_custom_calib_data, p_page1->data.custom_calib,
sizeof (m_ant_bpwr.BPWR_PROFILE_custom_calib_data));
break;
default:
break;
}
}

After opening the profile instance channel, the module broadcasts the data from the profile structure. The user application should keep this structure updated.

The sample application that uses the Bicycle Power Profile to implement a sensor is available here: Sensor


Documentation feedback | Developer Zone | Subscribe | Updated