The combined bicycle speed and cadence sensor implementation.
More...
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:
- Transmit data about the users speed and cadence over a single ANT channel.
The general architecture of the combined bicycle speed and cadence sensor is illustrated in the picture below.
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:
- CBSC_NETWORK_KEY ANT PLUS network key.
- ANTPLUS_NETWORK_NUMBER Network number associated with the channel.
- CBSC_TX_ANT_CHANNEL Used channel number.
- CBSC_TX_DEVICE_NUMBER Used device number.
- CBSC_DEVICE_TYPE Used device type.
- CBSC_TX_TRANS_TYPE Used transmission type.
- CBSC_RF_FREQ Used channel radio frequency offset from 2400MHz.
- CBSC_MSG_PERIOD Used channel period used in 32 kHz counts.
- 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:
- TRACE_UART When defined UART trace outputting is enabled.
- 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
#define UART_TX_BUF_SIZE 128u |
#define UART_RX_BUF_SIZE 1u |
#define CBSC_TX_ANT_CHANNEL 0 |
Default ANT Channel used.
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] | pc | Value of the program counter. |
[in] | line_num | Line number where the assert occurred. |
[in] | p_file_name | Pointer 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_code | Error code supplied to the handler. |
[in] | line_num | Line number where the error occurred. |
[in] | p_file_name | Pointer 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_code | Error code supplied to the handler. |
[in] | line_num | Line number where the handler is called. |
[in] | p_file_name | Pointer to the file name. |
Function for application main entry.
uint32_t cbsc_tx_initialize |
( |
void |
| ) |
|
Transmits the 1st broadcast message.
- Return values
-
NRF_SUCCESS | Operation success. |
NRF_ERROR_INVALID_PARAM | Operation failure. Invalid Parameter. |
NRF_ANT_ERROR_MESSAGE_SIZE_EXCEEDS_LIMIT | Operation failure. Data message provided is too large. |
NRF_ANT_ERROR_INVALID_SCAN_TX_CHANNEL | Operation failure. Attempt to transmit on channel 0 while in scan mode. |
NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATE | Operation failure. Attempt to perform an action in a wrong channel state. |
NRF_ANT_ERROR_TRANSFER_IN_PROGRESS | Operation failure. Attempt to communicate on a channel with a TX transfer in progress. |
NRF_ANT_ERROR_TRANSFER_IN_ERROR | Operation 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] | event | ANT event received. |
- Return values
-
NRF_SUCCESS | Operation success. |
NRF_ERROR_INVALID_PARAM | Operation failure. Invalid Parameter. |
NRF_ANT_ERROR_MESSAGE_SIZE_EXCEEDS_LIMIT | Operation failure. Data message provided is too large. |
NRF_ANT_ERROR_INVALID_SCAN_TX_CHANNEL | Operation failure. Attempt to transmit on channel 0 while in scan mode. |
NRF_ANT_ERROR_CHANNEL_IN_WRONG_STATE | Operation failure. Attempt to perform an action in a wrong channel state. |
NRF_ANT_ERROR_TRANSFER_IN_PROGRESS | Operation failure. Attempt to communicate on a channel with a TX transfer in progress. |
NRF_ANT_ERROR_TRANSFER_IN_ERROR | Operation failure. Transfer error has occured on supplied burst message or burst data segment. |