This module implements the Bicycle Speed and Cadence profile. More...
Modules | |
Bicycle Speed and Cadence Profile configuration | |
Bicycle Speed and Cadence profile pages | |
This module implements functions for the BSC data pages. | |
Bicycle Speed and Cadence profile utilities | |
This module implements utilities for the Bicycle Speed and Cadence profile. | |
Data Structures | |
struct | ant_bsc_disp_config_t |
BSC Display configuration structure. More... | |
struct | ant_bsc_sens_config_t |
BSC Sensor configuration structure. More... | |
struct | ant_bsc_profile_s |
BSC profile structure. More... | |
struct | ant_bsc_sens_cb_t |
BSC Sensor control block. More... | |
struct | ant_bsc_disp_cb_t |
BSC Display control block. More... | |
Macros | |
#define | BSC_ANTPLUS_RF_FREQ 0x39u |
Frequency, decimal 57 (2457 MHz). | |
#define | BSC_SPEED_DEVICE_TYPE 0x7B |
Device type reserved for ANT+ bike speed sensor. | |
#define | BSC_CADENCE_DEVICE_TYPE 0x7A |
Device type reserved for ANT+ bike cadence sensor. | |
#define | BSC_COMBINED_DEVICE_TYPE 0x79 |
Device type reserved for ANT+ bike combined speed and cadence sensor. | |
#define | BSC_MSG_PERIOD_4Hz 1u |
Message period, 4 Hz (in basic period counts, where basic period time = 0.25 s). | |
#define | BSC_MSG_PERIOD_2Hz 2u |
Message period, 2 Hz (in basic period counts). | |
#define | BSC_MSG_PERIOD_1Hz 4u |
Message period, 1 Hz (in basic period counts). | |
#define | BSC_MSG_PERIOD_SPEED 0x1FB6u |
Message period in ticks, decimal 8118 (4.04 Hz). | |
#define | BSC_MSG_PERIOD_CADENCE 0x1FA6u |
Message period in ticks, decimal 8102 (4.04 Hz). | |
#define | BSC_MSG_PERIOD_COMBINED 0x1F96u |
Message period in ticks, decimal 8086 (4.05 Hz). | |
#define | BSC_EXT_ASSIGN 0x00 |
ANT ext assign (see Ext. Assign Channel Parameters in ant_parameters.h: ANT Stack Parameters). | |
#define | BSC_DISP_CHANNEL_TYPE CHANNEL_TYPE_SLAVE_RX_ONLY |
Display BSC channel type. | |
#define | BSC_SENS_CHANNEL_TYPE CHANNEL_TYPE_MASTER |
Sensor BSC channel type. | |
#define | BSC_DEVICE_TICKS(DEVICE_TYPE) |
Select the basic ANT channel period (in ticks) for the BSC profile depending on the device type. More... | |
#define | BSC_PERIOD_TICKS(DEVICE_TYPE, BSC_MSG_PERIOD) ((BSC_DEVICE_TICKS(DEVICE_TYPE)) * (BSC_MSG_PERIOD)) |
Calculate the channel period (in ticks) depending on the device type and the chosen message frequency. More... | |
#define | BSC_DISP_CHANNEL_CONFIG_DEF(NAME,CHANNEL_NUMBER,TRANSMISSION_TYPE,DEVICE_TYPE,DEVICE_NUMBER,NETWORK_NUMBER,BSC_MSG_PERIOD) |
Initialize an ANT channel configuration structure for the BSC profile (Display). More... | |
#define | BSC_DISP_CHANNEL_CONFIG(NAME) &NAME##_channel_bsc_disp_config |
#define | BSC_SENS_CHANNEL_CONFIG_DEF(NAME,CHANNEL_NUMBER,TRANSMISSION_TYPE,DEVICE_TYPE,DEVICE_NUMBER,NETWORK_NUMBER) |
Initialize an ANT channel configuration structure for the BSC profile (Transmitter). More... | |
#define | BSC_SENS_CHANNEL_CONFIG(NAME) &NAME##_channel_bsc_sens_config |
#define | BSC_DISP_PROFILE_CONFIG_DEF(NAME,EVT_HANDLER) |
Initialize an ANT profile configuration structure for the BSC profile (Display). More... | |
#define | BSC_DISP_PROFILE_CONFIG(NAME) &NAME##_profile_bsc_disp_config |
#define | BSC_SENS_PROFILE_CONFIG_DEF(NAME,PAGE_1_PRESENT,PAGE_4_PRESENT,MAIN_PAGE_NUMBER,EVT_HANDLER) |
Initialize an ANT profile configuration structure for the BSC profile (Sensor). More... | |
#define | BSC_SENS_PROFILE_CONFIG(NAME) &NAME##_profile_bsc_sens_config |
Typedefs | |
typedef struct ant_bsc_profile_s | ant_bsc_profile_t |
typedef void(* | ant_bsc_evt_handler_t )(ant_bsc_profile_t *, ant_bsc_evt_t) |
BSC event handler type. | |
Enumerations | |
enum | ant_bsc_page_t { ANT_BSC_PAGE_0, ANT_BSC_PAGE_1, ANT_BSC_PAGE_2, ANT_BSC_PAGE_3, ANT_BSC_PAGE_4, ANT_BSC_PAGE_5, ANT_BSC_COMB_PAGE_0 } |
BSC page number type. More... | |
enum | ant_bsc_evt_t { ANT_BSC_PAGE_0_UPDATED = ANT_BSC_PAGE_0, ANT_BSC_PAGE_1_UPDATED = ANT_BSC_PAGE_1, ANT_BSC_PAGE_2_UPDATED = ANT_BSC_PAGE_2, ANT_BSC_PAGE_3_UPDATED = ANT_BSC_PAGE_3, ANT_BSC_PAGE_4_UPDATED = ANT_BSC_PAGE_4, ANT_BSC_PAGE_5_UPDATED = ANT_BSC_PAGE_5, ANT_BSC_COMB_PAGE_0_UPDATED = ANT_BSC_COMB_PAGE_0 } |
BSC profile event type. More... | |
Functions | |
ret_code_t | ant_bsc_disp_init (ant_bsc_profile_t *p_profile, ant_channel_config_t const *p_channel_config, ant_bsc_disp_config_t const *p_disp_config) |
Function for initializing the ANT BSC profile instance. More... | |
ret_code_t | ant_bsc_sens_init (ant_bsc_profile_t *p_profile, ant_channel_config_t const *p_channel_config, ant_bsc_sens_config_t const *p_sens_config) |
Function for initializing the ANT BSC profile instance. More... | |
ret_code_t | ant_bsc_disp_open (ant_bsc_profile_t *p_profile) |
Function for opening the profile instance channel for the ANT BSC Display. More... | |
ret_code_t | ant_bsc_sens_open (ant_bsc_profile_t *p_profile) |
Function for opening the profile instance channel for the ANT BSC Sensor. More... | |
void | ant_bsc_sens_evt_handler (ant_bsc_profile_t *p_profile, ant_evt_t *p_ant_event) |
Function for handling the Sensor ANT events. More... | |
void | ant_bsc_disp_evt_handler (ant_bsc_profile_t *p_profile, ant_evt_t *p_ant_event) |
Function for handling the Display ANT events. More... | |
This module implements the Bicycle Speed and Cadence profile.
#define BSC_DEVICE_TICKS | ( | DEVICE_TYPE | ) |
Select the basic ANT channel period (in ticks) for the BSC profile depending on the device type.
[in] | DEVICE_TYPE | Type of device. Supported types: BSC_SPEED_DEVICE_TYPE, BSC_CADENCE_DEVICE_TYPE, BSC_COMBINED_DEVICE_TYPE. |
#define BSC_DISP_CHANNEL_CONFIG_DEF | ( | NAME, | |
CHANNEL_NUMBER, | |||
TRANSMISSION_TYPE, | |||
DEVICE_TYPE, | |||
DEVICE_NUMBER, | |||
NETWORK_NUMBER, | |||
BSC_MSG_PERIOD | |||
) |
Initialize an ANT channel configuration structure for the BSC profile (Display).
[in] | NAME | Name of related instance. |
[in] | CHANNEL_NUMBER | Number of the channel assigned to the profile instance. |
[in] | TRANSMISSION_TYPE | Type of transmission assigned to the profile instance. |
[in] | DEVICE_TYPE | Type of device. Supported types: BSC_SPEED_DEVICE_TYPE, BSC_CADENCE_DEVICE_TYPE, BSC_COMBINED_DEVICE_TYPE. |
[in] | DEVICE_NUMBER | Number of the device assigned to the profile instance. |
[in] | NETWORK_NUMBER | Number of the network assigned to the profile instance. |
[in] | BSC_MSG_PERIOD | Channel data frequency in Hz. The BSC profile supports only the following frequencies: BSC_MSG_PERIOD_4Hz, BSC_MSG_PERIOD_2Hz, BSC_MSG_PERIOD_1Hz. |
#define BSC_DISP_PROFILE_CONFIG_DEF | ( | NAME, | |
EVT_HANDLER | |||
) |
Initialize an ANT profile configuration structure for the BSC profile (Display).
[in] | NAME | Name of related instance. |
[in] | EVT_HANDLER | Event handler to be called for handling events in the BSC profile. |
#define BSC_PERIOD_TICKS | ( | DEVICE_TYPE, | |
BSC_MSG_PERIOD | |||
) | ((BSC_DEVICE_TICKS(DEVICE_TYPE)) * (BSC_MSG_PERIOD)) |
Calculate the channel period (in ticks) depending on the device type and the chosen message frequency.
[in] | DEVICE_TYPE | Type of device. Supported types: BSC_SPEED_DEVICE_TYPE, BSC_CADENCE_DEVICE_TYPE, BSC_COMBINED_DEVICE_TYPE. |
[in] | BSC_MSG_PERIOD | Channel data period. The BSC profile supports only the following periods: BSC_MSG_PERIOD_4Hz, BSC_MSG_PERIOD_2Hz, BSC_MSG_PERIOD_1Hz. |
#define BSC_SENS_CHANNEL_CONFIG_DEF | ( | NAME, | |
CHANNEL_NUMBER, | |||
TRANSMISSION_TYPE, | |||
DEVICE_TYPE, | |||
DEVICE_NUMBER, | |||
NETWORK_NUMBER | |||
) |
Initialize an ANT channel configuration structure for the BSC profile (Transmitter).
[in] | NAME | Name of related instance. |
[in] | CHANNEL_NUMBER | Number of the channel assigned to the profile instance. |
[in] | TRANSMISSION_TYPE | Type of transmission assigned to the profile instance. |
[in] | DEVICE_TYPE | Type of device. Supported types: BSC_SPEED_DEVICE_TYPE, BSC_CADENCE_DEVICE_TYPE, BSC_COMBINED_DEVICE_TYPE. |
[in] | DEVICE_NUMBER | Number of the device assigned to the profile instance. |
[in] | NETWORK_NUMBER | Number of the network assigned to the profile instance. |
#define BSC_SENS_PROFILE_CONFIG_DEF | ( | NAME, | |
PAGE_1_PRESENT, | |||
PAGE_4_PRESENT, | |||
MAIN_PAGE_NUMBER, | |||
EVT_HANDLER | |||
) |
Initialize an ANT profile configuration structure for the BSC profile (Sensor).
[in] | NAME | Name of related instance. |
[in] | PAGE_1_PRESENT | Determines whether page 1 is included. |
[in] | PAGE_4_PRESENT | Determines whether page 4 is included. |
[in] | MAIN_PAGE_NUMBER | Determines the main data page (ANT_BSC_PAGE_0 or ANT_BSC_PAGE_5 or ANT_BSC_COMB_PAGE_0). |
[in] | EVT_HANDLER | Event handler to be called for handling events in the BSC profile. |
enum ant_bsc_evt_t |
BSC profile event type.
enum ant_bsc_page_t |
BSC page number type.
void ant_bsc_disp_evt_handler | ( | ant_bsc_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 Bicycle Speed and Cadence Display profile.
[in] | p_profile | Pointer to the profile instance. |
[in] | p_ant_event | Event received from the ANT stack. |
ret_code_t ant_bsc_disp_init | ( | ant_bsc_profile_t * | p_profile, |
ant_channel_config_t const * | p_channel_config, | ||
ant_bsc_disp_config_t const * | p_disp_config | ||
) |
Function for initializing the ANT BSC profile instance.
[in] | p_profile | Pointer to the profile instance. |
[in] | p_channel_config | Pointer to the ANT channel configuration structure. |
[in] | p_disp_config | Pointer to the BSC display configuration structure. |
NRF_SUCCESS | If initialization was successful. Otherwise, an error code is returned. |
ret_code_t ant_bsc_disp_open | ( | ant_bsc_profile_t * | p_profile | ) |
Function for opening the profile instance channel for the ANT BSC Display.
Before calling this function, pages should be configured.
[in] | p_profile | Pointer to the profile instance. |
NRF_SUCCESS | If the channel was successfully opened. Otherwise, an error code is returned. |
void ant_bsc_sens_evt_handler | ( | ant_bsc_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 Bicycle Speed and Cadence Sensor profile.
[in] | p_profile | Pointer to the profile instance. |
[in] | p_ant_event | Event received from the ANT stack. |
ret_code_t ant_bsc_sens_init | ( | ant_bsc_profile_t * | p_profile, |
ant_channel_config_t const * | p_channel_config, | ||
ant_bsc_sens_config_t const * | p_sens_config | ||
) |
Function for initializing the ANT BSC profile instance.
[in] | p_profile | Pointer to the profile instance. |
[in] | p_channel_config | Pointer to the ANT channel configuration structure. |
[in] | p_sens_config | Pointer to the BSC sensor configuration structure. |
NRF_SUCCESS | If initialization was successful. Otherwise, an error code is returned. |
ret_code_t ant_bsc_sens_open | ( | ant_bsc_profile_t * | p_profile | ) |
Function for opening the profile instance channel for the ANT BSC Sensor.
Before calling this function, pages should be configured.
[in] | p_profile | Pointer to the profile instance. |
NRF_SUCCESS | If the channel was successfully opened. Otherwise, an error code is returned. |