nRF51 SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
ANT combined bicycle speed and cadence

The combined bicycle speed and cadence sensor implementation. More...

Macros

#define UART_TX_BUF_SIZE   128u
 
#define UART_RX_BUF_SIZE   1u
 
#define CBSC_TX_ANT_CHANNEL   0
 

Functions

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 an error. More...
 
static __INLINE void softdevice_setup (void)
 Function for configuring and setting up the SoftDevice.
 
int main (void)
 Function for application main entry, does not return. More...
 
uint32_t cbsc_tx_initialize (void)
 Function for initializing the module. More...
 
uint32_t cbsc_tx_channel_event_handle (uint32_t event)
 Function for processing received ANT channel event message. More...
 
void main_cbsc_tx_run (void)
 Function for configuring the device simulator, does not return.
 

Detailed Description

sensor example

The combined bicycle speed and cadence sensor implementation implements all the features, which are required for this type of sensor to be compliant with the ANT+ Bicycle Speed and Cadence profile, as defined by the ANT+ Bike Speed and Cadence Device Profile specification:

The general architecture of the combined bicycle speed and cadence sensor is illustrated in the picture below.

bicycle_speed_and_cadence_sensor_design.png
Architecture overview
Combined bicycle speed and cadence sensor configuration options

The following compile time configuration options are available to suite various combined bicycle speed and cadence sensor implementations:

Development phase configuration options

The combined bicycle speed and cadence sensor will trace error handler 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 combined bicycle speed and cadence sensor implementation:

Note
The ANT+ Network Key is available for ANT+ Adopters. Please refer to http://thisisant.com to become an ANT+ Adopter and access the key.

sensor example

Macro Definition Documentation

#define UART_TX_BUF_SIZE   128u

UART TX buffer size.

#define UART_RX_BUF_SIZE   1u

UART RX buffer size.

#define CBSC_TX_ANT_CHANNEL   0

Default ANT Channel used.

Function Documentation

void softdevice_assert_callback ( uint32_t  pc,
uint16_t  line_num,
const uint8_t *  p_file_name 
)

Traces out the user supplied parameters and busy loops.

Parameters
[in]pcValue of the program counter.
[in]line_numLine number where the assert occurred.
[in]p_file_namePointer to the file name.
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.

Parameters
[in]error_codeError code supplied to the handler.
[in]line_numLine number where the error occurred.
[in]p_file_namePointer to the file name.
Warning
This handler is an example only and does not fit a final product. You need to analyze how your product is supposed to react in case of error.
Parameters
[in]error_codeError code supplied to the handler.
[in]line_numLine number where the handler is called.
[in]p_file_namePointer to the file name.
int main ( void  )

Function for application main entry.

uint32_t cbsc_tx_initialize ( void  )

Transmits the 1st broadcast message.

Return values
NRF_SUCCESSOperation success.
NRF_ERROR_INVALID_PARAMOperation failure. Invalid Parameter.
NRF_ANT_ERROR_MESSAGE_SIZE_EXCEEDS_LIMITOperation failure. Data message provided is too large.
NRF_ANT_ERROR_INVALID_SCAN_TX_CHANNELOperation failure. Attempt to transmit on channel 0 while in scan mode.
NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATEOperation failure. Attempt to perform an action in a wrong channel state.
NRF_ANT_ERROR_TRANSFER_IN_PROGRESSOperation failure. Attempt to communicate on a channel with a TX transfer in progress.
NRF_ANT_ERROR_TRANSFER_IN_ERROROperation failure. Transfer error has occured on supplied burst message or burst data segment.
uint32_t cbsc_tx_channel_event_handle ( uint32_t  event)
Parameters
[in]eventANT event received.
Return values
NRF_SUCCESSOperation success.
NRF_ERROR_INVALID_PARAMOperation failure. Invalid Parameter.
NRF_ANT_ERROR_MESSAGE_SIZE_EXCEEDS_LIMITOperation failure. Data message provided is too large.
NRF_ANT_ERROR_INVALID_SCAN_TX_CHANNELOperation failure. Attempt to transmit on channel 0 while in scan mode.
NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATEOperation failure. Attempt to perform an action in a wrong channel state.
NRF_ANT_ERROR_TRANSFER_IN_PROGRESSOperation failure. Attempt to communicate on a channel with a TX transfer in progress.
NRF_ANT_ERROR_TRANSFER_IN_ERROROperation failure. Transfer error has occured on supplied burst message or burst data segment.