nRF5 SDK v13.0.0
Modules | Data Structures | Macros | Typedefs | Enumerations | Functions
Stride Based Speed and Distance Monitor profile

This module implements the Stride Based Speed and Distance Monitor profile. More...

Modules

 Stride Based Speed and Distance Monitor Profile configuration
 
 Stride Based Speed and Distance Monitor profile pages
 This module implements functions for the SDM data pages.
 
 Stride Based Speed and Distance Monitor profile utilities
 This module implements utilities for the Stride Based Speed and Distance Monitor profile.
 

Data Structures

struct  ant_sdm_sens_config_t
 SDM Sensor configuration structure. More...
 
struct  ant_sdm_disp_config_t
 SDM Display configuration structure. More...
 
struct  ant_sdm_profile_s
 SDM profile structure. More...
 
struct  ant_sdm_disp_cb_t
 SDM Display control block. More...
 
struct  ant_sdm_sens_cb_t
 SDM Sensor control block. More...
 

Macros

#define SDM_DEVICE_TYPE   0x7Cu
 Device type reserved for ANT+ SDM.
 
#define SDM_ANTPLUS_RF_FREQ   0x39u
 Frequency, decimal 57 (2457 MHz).
 
#define SDM_MSG_PERIOD_4Hz   0x1FC6u
 Message period, decimal 8134 (4.03 Hz).
 
#define SDM_MSG_PERIOD_2Hz   0x3F8Cu
 Message period, decimal 16268 (2.01 Hz).
 
#define SDM_EXT_ASSIGN   0x00
 ANT ext assign (see Ext. Assign Channel Parameters in ant_parameters.h: ANT Stack Parameters).
 
#define SDM_DISP_CHANNEL_TYPE   CHANNEL_TYPE_SLAVE
 RX SDM channel type.
 
#define SDM_SENS_CHANNEL_TYPE   CHANNEL_TYPE_MASTER
 TX SDM channel type.
 
#define SDM_DISP_CHANNEL_CONFIG_DEF(NAME,CHANNEL_NUMBER,TRANSMISSION_TYPE,DEVICE_NUMBER,NETWORK_NUMBER,SDM_MSG_PERIOD)
 Initialize an ANT channel configuration structure for the SDM profile (Display). More...
 
#define SDM_DISP_CHANNEL_CONFIG(NAME)   &NAME##_channel_sdm_disp_config
 
#define SDM_SENS_CHANNEL_CONFIG_DEF(NAME,CHANNEL_NUMBER,TRANSMISSION_TYPE,DEVICE_NUMBER,NETWORK_NUMBER)
 Initialize an ANT channel configuration structure for the SDM profile (Sensor). More...
 
#define SDM_SENS_CHANNEL_CONFIG(NAME)   &NAME##_channel_sdm_sens_config
 
#define SDM_DISP_PROFILE_CONFIG_DEF(NAME,EVT_HANDLER)
 Initialize an ANT profile configuration structure for the SDM profile (Display). More...
 
#define SDM_DISP_PROFILE_CONFIG(NAME)   &NAME##_profile_sdm_disp_config
 
#define SDM_SENS_PROFILE_CONFIG_DEF(NAME,SUPPLEMENTARY_PAGE_NUMBER,EVT_HANDLER)
 Initialize an ANT profile configuration structure for the SDM profile (Sensor). More...
 
#define SDM_SENS_PROFILE_CONFIG(NAME)   &NAME##_profile_sdm_sens_config
 

Typedefs

typedef struct ant_sdm_profile_s ant_sdm_profile_t
 
typedef void(* ant_sdm_evt_handler_t )(ant_sdm_profile_t *, ant_sdm_evt_t)
 SDM event handler type.
 

Enumerations

enum  ant_sdm_page_t {
  ANT_SDM_PAGE_1 = 1,
  ANT_SDM_PAGE_2 = 2,
  ANT_SDM_PAGE_3 = 3,
  ANT_SDM_PAGE_16 = 16,
  ANT_SDM_PAGE_22 = 22,
  ANT_SDM_PAGE_70 = ANT_COMMON_PAGE_70,
  ANT_SDM_PAGE_80 = ANT_COMMON_PAGE_80,
  ANT_SDM_PAGE_81 = ANT_COMMON_PAGE_81
}
 SDM page number type. More...
 
enum  ant_sdm_evt_t {
  ANT_SDM_PAGE_1_UPDATED = ANT_SDM_PAGE_1,
  ANT_SDM_PAGE_2_UPDATED = ANT_SDM_PAGE_2,
  ANT_SDM_PAGE_3_UPDATED = ANT_SDM_PAGE_3,
  ANT_SDM_PAGE_16_UPDATED = ANT_SDM_PAGE_16,
  ANT_SDM_PAGE_22_UPDATED = ANT_SDM_PAGE_22,
  ANT_SDM_PAGE_80_UPDATED = ANT_SDM_PAGE_80,
  ANT_SDM_PAGE_81_UPDATED = ANT_SDM_PAGE_81,
  ANT_SDM_PAGE_REQUEST_SUCCESS,
  ANT_SDM_PAGE_REQUEST_FAILED
}
 SDM profile event type. More...
 

Functions

ret_code_t ant_sdm_disp_init (ant_sdm_profile_t *p_profile, ant_channel_config_t const *p_channel_config, ant_sdm_disp_config_t const *p_disp_config)
 Function for initializing the ANT SDM RX profile instance. More...
 
ret_code_t ant_sdm_sens_init (ant_sdm_profile_t *p_profile, ant_channel_config_t const *p_channel_config, ant_sdm_sens_config_t const *p_sens_config)
 Function for initializing the ANT SDM TX profile instance. More...
 
ret_code_t ant_sdm_disp_open (ant_sdm_profile_t *p_profile)
 Function for opening the profile instance channel for ANT SDM Display. More...
 
ret_code_t ant_sdm_sens_open (ant_sdm_profile_t *p_profile)
 Function for opening the profile instance channel for ANT SDM Sensor. More...
 
ret_code_t ant_sdm_page_request (ant_sdm_profile_t *p_profile, ant_common_page70_data_t *p_page_70)
 Function for sending a data page request. More...
 
void ant_sdm_sens_evt_handler (ant_sdm_profile_t *p_profile, ant_evt_t *p_ant_event)
 Function for handling the Sensor ANT events. More...
 
void ant_sdm_disp_evt_handler (ant_sdm_profile_t *p_profile, ant_evt_t *p_ant_event)
 Function for handling the Display ANT events. More...
 

Defines for accessing ant_sdm_profile_t members variables

#define SDM_PROFILE_update_latency   page_1.update_latency
 
#define SDM_PROFILE_time   page_1.time
 
#define SDM_PROFILE_status   page_2.status.items
 
#define SDM_PROFILE_cadence   page_2.cadence
 
#define SDM_PROFILE_calories   page_3.calories
 
#define SDM_PROFILE_capabilities   page_22.capabilities.items
 
#define SDM_PROFILE_speed   common.speed
 
#define SDM_PROFILE_distance   common.distance
 
#define SDM_PROFILE_strides   common.strides
 
#define SDM_PROFILE_hw_revision   page_80.hw_revision
 
#define SDM_PROFILE_manufacturer_id   page_80.manufacturer_id
 
#define SDM_PROFILE_model_number   page_80.model_number
 
#define SDM_PROFILE_sw_revision_minor   page_81.sw_revision_minor
 
#define SDM_PROFILE_sw_revision_major   page_81.sw_revision_major
 
#define SDM_PROFILE_serial_number   page_81.serial_number
 

Detailed Description

This module implements the Stride Based Speed and Distance Monitor profile.

Macro Definition Documentation

#define SDM_DISP_CHANNEL_CONFIG_DEF (   NAME,
  CHANNEL_NUMBER,
  TRANSMISSION_TYPE,
  DEVICE_NUMBER,
  NETWORK_NUMBER,
  SDM_MSG_PERIOD 
)
Value:
static const ant_channel_config_t NAME##_channel_sdm_disp_config = \
{ \
.channel_number = (CHANNEL_NUMBER), \
.channel_type = SDM_DISP_CHANNEL_TYPE, \
.ext_assign = SDM_EXT_ASSIGN, \
.rf_freq = SDM_ANTPLUS_RF_FREQ, \
.transmission_type = (TRANSMISSION_TYPE), \
.device_type = SDM_DEVICE_TYPE, \
.device_number = (DEVICE_NUMBER), \
.channel_period = (SDM_MSG_PERIOD), \
.network_number = (NETWORK_NUMBER), \
}

Initialize an ANT channel configuration structure for the SDM profile (Display).

Parameters
[in]NAMEName of related instance.
[in]CHANNEL_NUMBERNumber of the channel assigned to the profile instance.
[in]TRANSMISSION_TYPEType of transmission assigned to the profile instance.
[in]DEVICE_NUMBERNumber of the device assigned to the profile instance.
[in]NETWORK_NUMBERNumber of the network assigned to the profile instance.
[in]SDM_MSG_PERIODChannel period in 32 kHz counts. The SDM profile supports only the following periods: SDM_MSG_PERIOD_4Hz, SDM_MSG_PERIOD_2Hz.
#define SDM_DISP_PROFILE_CONFIG_DEF (   NAME,
  EVT_HANDLER 
)
Value:
static ant_sdm_disp_cb_t NAME##_sdm_disp_cb; \
static const ant_sdm_disp_config_t NAME##_profile_sdm_disp_config = \
{ \
.p_cb = &NAME##_sdm_disp_cb, \
.evt_handler = (EVT_HANDLER), \
}

Initialize an ANT profile configuration structure for the SDM profile (Display).

Parameters
[in]NAMEName of related instance.
[in]EVT_HANDLEREvent handler to be called for handling events in the SDM profile.
#define SDM_SENS_CHANNEL_CONFIG_DEF (   NAME,
  CHANNEL_NUMBER,
  TRANSMISSION_TYPE,
  DEVICE_NUMBER,
  NETWORK_NUMBER 
)
Value:
static const ant_channel_config_t NAME##_channel_sdm_sens_config = \
{ \
.channel_number = (CHANNEL_NUMBER), \
.channel_type = SDM_SENS_CHANNEL_TYPE, \
.ext_assign = SDM_EXT_ASSIGN, \
.rf_freq = SDM_ANTPLUS_RF_FREQ, \
.transmission_type = (TRANSMISSION_TYPE), \
.device_type = SDM_DEVICE_TYPE, \
.device_number = (DEVICE_NUMBER), \
.channel_period = SDM_MSG_PERIOD_4Hz, \
.network_number = (NETWORK_NUMBER), \
}

Initialize an ANT channel configuration structure for the SDM profile (Sensor).

Parameters
[in]NAMEName of related instance.
[in]CHANNEL_NUMBERNumber of the channel assigned to the profile instance.
[in]TRANSMISSION_TYPEType of transmission assigned to the profile instance.
[in]DEVICE_NUMBERNumber of the device assigned to the profile instance.
[in]NETWORK_NUMBERNumber of the network assigned to the profile instance.
#define SDM_SENS_PROFILE_CONFIG_DEF (   NAME,
  SUPPLEMENTARY_PAGE_NUMBER,
  EVT_HANDLER 
)
Value:
static ant_sdm_sens_cb_t NAME##_sdm_sens_cb; \
static const ant_sdm_sens_config_t NAME##_profile_sdm_sens_config = \
{ \
.supplementary_page_number = (SUPPLEMENTARY_PAGE_NUMBER), \
.p_cb = &NAME##_sdm_sens_cb, \
.evt_handler = (EVT_HANDLER), \
}

Initialize an ANT profile configuration structure for the SDM profile (Sensor).

Parameters
[in]NAMEName of related instance.
[in]SUPPLEMENTARY_PAGE_NUMBERSupplementary data page (ANT_SDM_PAGE_2 or ANT_SDM_PAGE_3). Use ANT_SDM_PAGE_1 to disable.
[in]EVT_HANDLEREvent handler to be called for handling events in the SDM profile.

Enumeration Type Documentation

SDM profile event type.

Enumerator
ANT_SDM_PAGE_1_UPDATED 

Data page 1 and speed have been updated (Display) or sent (Sensor).

ANT_SDM_PAGE_2_UPDATED 

Data page 2 and speed have been updated (Display) or sent (Sensor).

ANT_SDM_PAGE_3_UPDATED 

Data page 3 and speed have been updated (Display) or sent (Sensor).

ANT_SDM_PAGE_16_UPDATED 

Data page 16 has been updated (Display) or sent (Sensor).

ANT_SDM_PAGE_22_UPDATED 

Data page 22 has been updated (Display) or sent (Sensor).

ANT_SDM_PAGE_80_UPDATED 

Data page 80 has been updated (Display) or sent (Sensor).

ANT_SDM_PAGE_81_UPDATED 

Data page 81 has been updated (Display) or sent (Sensor).

ANT_SDM_PAGE_REQUEST_SUCCESS 

Data page request reached the destination.

ANT_SDM_PAGE_REQUEST_FAILED 

Data page request did not reach the destination.

SDM page number type.

Enumerator
ANT_SDM_PAGE_1 

Required data page 1.

ANT_SDM_PAGE_2 

Supplementary data page 2.

ANT_SDM_PAGE_3 

Supplementary data page 3.

ANT_SDM_PAGE_16 

Page 16 (sent on request).

ANT_SDM_PAGE_22 

Page 22 (sent on request).

Function Documentation

void ant_sdm_disp_evt_handler ( ant_sdm_profile_t p_profile,
ant_evt_t p_ant_event 
)

Function for handling the Display ANT events.

This function handles all events from the ANT stack that are of interest to the SDM Display profile.

Parameters
[in]p_profilePointer to the profile instance.
[in]p_ant_eventEvent received from the ANT stack.
ret_code_t ant_sdm_disp_init ( ant_sdm_profile_t p_profile,
ant_channel_config_t const *  p_channel_config,
ant_sdm_disp_config_t const *  p_disp_config 
)

Function for initializing the ANT SDM RX profile instance.

Parameters
[in]p_profilePointer to the profile instance.
[in]p_channel_configPointer to the ANT channel configuration structure.
[in]p_disp_configPointer to the SDM Display configuration structure.
Return values
NRF_SUCCESSIf initialization was successful. Otherwise, an error code is returned.
ret_code_t ant_sdm_disp_open ( ant_sdm_profile_t p_profile)

Function for opening the profile instance channel for ANT SDM Display.

Before calling this function, pages should be configured.

Parameters
[in]p_profilePointer to the profile instance.
Return values
NRF_SUCCESSIf the channel was successfully opened. Otherwise, an error code is returned.
ret_code_t ant_sdm_page_request ( ant_sdm_profile_t p_profile,
ant_common_page70_data_t p_page_70 
)

Function for sending a data page request.

This function can be called only on the display side.

Parameters
[in]p_profilePointer to the profile instance.
[in]p_page_70Pointer to the prepared page 70.
Return values
NRF_SUCCESSIf the request has been sent. Otherwise, an error code is returned.
void ant_sdm_sens_evt_handler ( ant_sdm_profile_t p_profile,
ant_evt_t p_ant_event 
)

Function for handling the Sensor ANT events.

This function handles all events from the ANT stack that are of interest to the SDM Sensor profile.

Parameters
[in]p_profilePointer to the profile instance.
[in]p_ant_eventEvent received from the ANT stack.
ret_code_t ant_sdm_sens_init ( ant_sdm_profile_t p_profile,
ant_channel_config_t const *  p_channel_config,
ant_sdm_sens_config_t const *  p_sens_config 
)

Function for initializing the ANT SDM TX profile instance.

Parameters
[in]p_profilePointer to the profile instance.
[in]p_channel_configPointer to the ANT channel configuration structure.
[in]p_sens_configPointer to the SDM Sensor configuration structure.
Return values
NRF_SUCCESSIf initialization was successful. Otherwise, an error code is returned.
ret_code_t ant_sdm_sens_open ( ant_sdm_profile_t p_profile)

Function for opening the profile instance channel for ANT SDM Sensor.

Before calling this function, pages should be configured.

Parameters
[in]p_profilePointer to the profile instance.
Return values
NRF_SUCCESSIf the channel was successfully opened. Otherwise, an error code is returned.

Documentation feedback | Developer Zone | Subscribe | Updated