nRF51 SDK: ANT combined bicycle speed and cadence

| nRF51 SDK

- Home
- Related Pages
- API Reference
- Data Structures

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

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

## Macros

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

## Functions

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. More...
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...
int | main (void)
| Function for application main entry, does not return.

## Detailed Description

The combined bicycle speed and cadence sensor implementation.

sensor example

## Macro Definition Documentation

#define CBSC_TX_ANT_CHANNEL 0

Default ANT Channel used.

#define UART_RX_BUF_SIZE 1u

UART RX buffer size.

#define UART_TX_BUF_SIZE 128u

UART TX buffer size.

## Function Documentation

void app_error_handler | ( | uint32_t | error_code,
|  | uint32_t | line_num,
|  | const uint8_t * | p_file_name
| ) |  |

Function for handling an error.

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.

uint32_t cbsc_tx_channel_event_handle | ( | uint32_t | event | ) |

Function for processing received ANT channel event message.

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.

uint32_t cbsc_tx_initialize | ( | void |  | ) |

Function for initializing the module.

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.

< Desired RTC COUNTER frequency is 1024Hz (1/1024s period).

< Computed value of the RTC prescaler register.

< Desired RTC COUNTER frequency is 1024Hz (1/1024s period).

< Speed rotations per minute.

< Desired RTC COUNTER frequency is 1024Hz (1/1024s period).

< Computed value of the RTC prescaler register.

< Speed event interval in timer tick units.

< Desired RTC COUNTER frequency is 1024Hz (1/1024s period).

< Cadence rotations per minute.

< Desired RTC COUNTER frequency is 1024Hz (1/1024s period).

< Computed value of the RTC prescaler register.

< Speed event interval in timer tick units.

< Index of the cadence event time LSB field in the data page.

< Get low byte of a uint16_t.

< Index of the cadence event time MSB field in the data page.

< Get high byte of a uint16_t.

< Index of the cumulative cadence revolution count LSB field in the data page.

< Get low byte of a uint16_t.

< Index of the cumulative cadence revolution count MSB field in the data page.

< Get high byte of a uint16_t.

< Index of the speed event time LSB field in the data page.

< Get low byte of a uint16_t.

< Index of the speed event time MSB field in the data page.

< Get high byte of a uint16_t.

< Index of the cumulative speed revolution count LSB field in the data page.

< Get low byte of a uint16_t.

< Index of the cumulative speed revolution count MSB field in the data page.

< Get high byte of a uint16_t.

void main_cbsc_tx_run | ( | void |  | ) |

Function for configuring the device simulator, does not return.

< Minimum size of ANT event message buffer.

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.

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.