This information applies to the following SoftDevice: S212
This module implements the Stride Based Speed and Distance Monitor ANT+ device profile. The API for this module is available here: Stride Based Speed and Distance Monitor profile
During initialization, the module configures the selected channel and resets the profile data.
This module uses the ANT page request controller to handle page data requests.
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 SDM Receiver implementation:
- TRACE_SDM_GENERAL_ENABLE: Output page number of the current page.
- TRACE_SDM_PAGE_1_ENABLE: Output page 1 data.
- TRACE_SDM_PAGE_2_ENABLE: Output page 2 data.
- TRACE_SDM_PAGE_3_ENABLE: Output page 3 data.
- TRACE_SDM_PAGE_16_ENABLE: Output page 16 data.
- TRACE_SDM_PAGE_22_ENABLE: Output page 22 data.
- TRACE_COMMON_PAGE_80_ENABLE: Output page 80 data.
- TRACE_COMMON_PAGE_81_ENABLE: Output page 81 data.
The above macros must be defined on the project settings level.
SDM Receiver
The following code snippets show how to initialize the SDM Receiver:
SDM_CHANNEL_NUM,
CHAN_ID_TRANS_TYPE,
CHAN_ID_DEV_NUM,
ANTPLUS_NETWORK_NUM,
ant_sdm_evt_handler);
uint32_t err_code;
SDM_DISP_CHANNEL_CONFIG(m_ant_sdm),
SDM_DISP_PROFILE_CONFIG(m_ant_sdm));
After opening the profile instance channel, the module keeps the profile structure updated.
Two different message periods are supported:
The sample application that uses the SDM Receiver is available here: Receiver
SDM Transmitter
The following code snippets show how to initialize the SDM Transmitter:
SDM_CHANNEL_NUM,
CHAN_ID_TRANS_TYPE,
CHAN_ID_DEV_NUM,
ANTPLUS_NETWORK_NUM);
ant_sdm_evt_handler);
uint32_t err_code;
SDM_SENS_CHANNEL_CONFIG(m_ant_sdm),
SDM_SENS_PROFILE_CONFIG(m_ant_sdm));
SDM_MANUFACTURER_ID,
SDM_MODEL_NUMBER);
SDM_SW_REVISION_MINOR,
SDM_SERIAL_NUMBER);
m_ant_sdm.SDM_PROFILE_capabilities.cadency_is_valid = true;
m_ant_sdm.SDM_PROFILE_capabilities.speed_is_valid = true;
m_ant_sdm.SDM_PROFILE_capabilities.calorie_is_valid = true;
m_ant_sdm.SDM_PROFILE_capabilities.time_is_valid = true;
m_ant_sdm.SDM_PROFILE_capabilities.latency_is_valid = true;
m_ant_sdm.SDM_PROFILE_capabilities.distance_is_valid = true;
m_ant_sdm.SDM_PROFILE_status.state = ANT_SDM_USE_STATE_ACTIVE;
m_ant_sdm.SDM_PROFILE_status.health = ANT_SDM_HEALTH_OK;
m_ant_sdm.SDM_PROFILE_status.battery = ANT_SDM_BATTERY_STATUS_GOOD;
m_ant_sdm.SDM_PROFILE_status.location = ANT_SDM_LOCATION_ANKLE;
After opening the profile instance channel, the module broadcasts the data from the profile structure. The user application should keep this structure updated.
Users can configure which supplementary data page is used (page 2 or 3). Choosing data page 1 will disable this feature.
The sample application that uses the SDM Transmitter is available here: Transmitter
- Note
- The application must propagate ANT stack events to the ANT Stride Based Speed and Distance Monitor module by calling ant_sdm_tx_evt_handle() or ant_sdm_rx_evt_handle() from the ant_event_handler callback.
- Warning
- The ant_event_handler is called from an interrupt. Therefore, the profile structure is changed asynchronously.