nRF51 SDK
|
The bicycle power minimum receiver implementation. More...
Data Structures | |
struct | bp_page16_data_t |
Bicycle Power page 16 data structure. More... | |
struct | bp_page17_data_t |
Bicycle Power page 17 data structure. More... | |
struct | bp_page18_data_t |
Bicycle Power page 18 data structure. More... | |
struct | bp_page32_data_t |
Bicycle Power page 32 data structure. More... | |
struct | bp_page1_response_data_t |
Bicycle Power page 1 general calibration response data structure. More... | |
struct | page80_data_t |
Common page 80 data structure. More... | |
struct | page81_data_t |
Common page 81 data structure. More... | |
struct | antplus_event_return_t |
Bicycle Power profile to application communication object. More... | |
Typedefs | |
typedef void(* | calibration_process_callback_t )(calibration_notif_event_t event) |
Enumerations | |
enum | calibration_notif_event_t { CALIBRATION_NOT_ACTIVE_STATE_ENTER, CALIBRATION_RESPONSE_TIMEOUT } |
enum | antplus_event_t { ANTPLUS_EVENT_PAGE, ANTPLUS_EVENT_MAX, ANTPLUS_EVENT_NONE, ANTPLUS_EVENT_CALIBRATION_REQUEST } |
Bicycle Power profile application events. More... | |
Functions | |
void | bicycle_power_rx_init (void) |
Function for initializing the module. | |
void | bp_rx_calibration_cb_register (calibration_process_callback_t callback) |
Function for registering a calibration process statemachine callback client. More... | |
bool | bp_rx_channel_event_handle (uint32_t event, uint8_t const *const p_event_message_buffer, antplus_event_return_t *p_event_return) |
Function for processing received ANT channel event message. More... | |
void | bp_rx_calibration_start (void) |
Function for starting manual zero-offset calibration procedure. More... | |
void | bp_rx_calibration_tout_handle (void) |
Function for handling a calibration response timeout event. | |
bp_page16_data_t * | bp_rx_data_page16_get (void) |
Function for getting the reference to data page 16, which is the standard power-only main data page. More... | |
bp_page17_data_t * | bp_rx_data_page17_get (void) |
Function for getting the reference to data page 17, which is the standard wheel torque main data page. More... | |
bp_page18_data_t * | bp_rx_data_page18_get (void) |
Function for getting the reference to data page 18, which is the standard crank torque main data page. More... | |
bp_page32_data_t * | bp_rx_data_page32_get (void) |
Function for getting the reference to data page 32, which is the crank torque frequency (CTF) main data page. More... | |
bp_page1_response_data_t * | bp_rx_data_page1_response_get (void) |
Function for getting the reference to data page 1, which is the general calibration response main data page. More... | |
page80_data_t * | bp_rx_data_page80_get (void) |
Function for getting the reference to data page 80, which is the manufacturer's identification common page. More... | |
page81_data_t * | bp_rx_data_page81_get (void) |
Function for getting the reference to data page 81, which is the product information common page. More... | |
void | bicycle_power_rx_main_loop_run (void) |
Function for running the bicycle power RX main processing loop. 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 error handling, which is called when an error has occurred. More... | |
int | main () |
Function for main application entry. Does not return. | |
void | button_event_handler (uint8_t pin_no, uint8_t button_action) |
Function for handling button events. More... | |
void | SD_EVT_IRQHandler (void) |
Function for handling stack interrupts. More... | |
The bicycle power minimum receiver implementation.
#define ANT_EVENT_MSG_BUFFER_MIN_SIZE 32u |
Minimum size of ANT event message buffer.
#define ANTPLUS_NETWORK_NUMBER 0 |
Network number.
#define APP_GPIOTE_MAX_USERS 1u |
Maximum number of users of the GPIOTE handler.
#define APP_TIMER_MAX_TIMERS 2u |
Maximum number of simultaneously created timers.
#define APP_TIMER_OP_QUEUE_SIZE 2u |
Size of timer operation queues.
#define APP_TIMER_PRESCALER 0 |
Value of the RTC1 PRESCALER register.
#define BP_CID_170 0xAAu |
Calibration ID 0xAA = generic calibration request.
#define BP_CID_172 0xACu |
Calibration ID 0xAC = calibration response manual zero success.
#define BP_CID_175 0xAFu |
Calibration ID 0xAF = calibration response failure.
#define BP_DEVICE_TYPE 0x0Bu |
Bike Power Device Type.
#define BP_EXT_ASSIGN 0 |
ANT Ext Assign.
#define BP_MSG_PERIOD 0x1FF6u |
Decimal 8182 (~4.00Hz).
#define BP_NETWORK_KEY {0,0,0,0,0,0,0,0} |
The network key used.
#define BP_PAGE_1 0x01u |
Calibration message main data page.
#define BP_PAGE_16 0x10u |
Standard Power only main data page.
#define BP_PAGE_17 0x11u |
Wheel Torque (WT) main data page.
#define BP_PAGE_18 0x12u |
Standard Crank Torque (CT) main data page.
#define BP_PAGE_32 0x20u |
Standard Crank Torque Frequency (CTF) main data page.
#define BP_PAGE_RESERVE_BYTE 0xFFu |
Page reserved value.
#define BP_RF_FREQ 0x39u |
RF Channel 57 (2457 MHz).
#define BP_RX_ANT_CHANNEL 0 |
Default ANT Channel used.
#define BP_RX_CHANNEL_TYPE CHANNEL_TYPE_SLAVE |
Slave.
#define BP_RX_DEVICE_NUMBER 0 |
Device Number.
#define BP_RX_TRANS_TYPE 0 |
Transmission Type.
#define BUTTON_DETECTION_DELAY APP_TIMER_TICKS(50u, APP_TIMER_PRESCALER) |
Delay from a GPIOTE event until a button is reported as pushed (in number of timer ticks).
#define COMMON_PAGE_80 0x50u |
Manufacturer's identification common data page.
#define COMMON_PAGE_81 0x51u |
Product information common data page.
#define EVT_ANT_STACK (1u << 2u) |
Event for: ANT stack interrupt received.
#define EVT_BUTTON_0 (1u << 0) |
Event for: button 0 pressed.
#define EVT_CALIBRATION_RESPONSE_TIMEOUT (1u << 1u) |
Event for: calibration response timeout.
#define UART_RX_BUF_SIZE 1u |
UART RX buffer size.
#define UART_TX_BUF_SIZE 256u |
UART TX buffer size.
enum antplus_event_t |
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.
[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. |
void bicycle_power_rx_main_loop_run | ( | void | ) |
Function for running the bicycle power RX main processing loop. Does not return.
< Maximum number of simultaneously created timers.
< Size of timer operation queues.
< Maximum number of users of the GPIOTE handler.
< Delay from a GPIOTE event until a button is reported as pushed (in number of timer ticks).
< Minimum size of ANT event message buffer.
< Event for: button 0 pressed.
< Event for: button 0 pressed.
< Event for: ANT stack interrupt received.
< Event for: ANT stack interrupt received.
< Event for: calibration response timeout.
< Event for: calibration response timeout.
void bp_rx_calibration_cb_register | ( | calibration_process_callback_t | callback | ) |
Function for registering a calibration process statemachine callback client.
[in] | callback | The callback, which is called when various calibration process statemachine events occur. |
void bp_rx_calibration_start | ( | void | ) |
Function for starting manual zero-offset calibration procedure.
< Calibration response timeout value in units of timer ticks.
bool bp_rx_channel_event_handle | ( | uint32_t | event, |
uint8_t const *const | p_event_message_buffer, | ||
antplus_event_return_t * | p_event_return | ||
) |
Function for processing received ANT channel event message.
[in] | event | ANT event received. |
[in] | p_event_message_buffer | ANT event message buffer. |
[out] | p_event_return | Output data from the profile. |
bp_page16_data_t* bp_rx_data_page16_get | ( | void | ) |
Function for getting the reference to data page 16, which is the standard power-only main data page.
bp_page17_data_t* bp_rx_data_page17_get | ( | void | ) |
Function for getting the reference to data page 17, which is the standard wheel torque main data page.
bp_page18_data_t* bp_rx_data_page18_get | ( | void | ) |
Function for getting the reference to data page 18, which is the standard crank torque main data page.
bp_page1_response_data_t* bp_rx_data_page1_response_get | ( | void | ) |
Function for getting the reference to data page 1, which is the general calibration response main data page.
bp_page32_data_t* bp_rx_data_page32_get | ( | void | ) |
Function for getting the reference to data page 32, which is the crank torque frequency (CTF) main data page.
page80_data_t* bp_rx_data_page80_get | ( | void | ) |
Function for getting the reference to data page 80, which is the manufacturer's identification common page.
page81_data_t* bp_rx_data_page81_get | ( | void | ) |
Function for getting the reference to data page 81, which is the product information common page.
void button_event_handler | ( | uint8_t | pin_no, |
uint8_t | button_action | ||
) |
Function for handling button events.
[in] | pin_no | The pin number of the button pressed. |
< Event for: button 0 pressed.
void SD_EVT_IRQHandler | ( | void | ) |
Function for handling stack interrupts.
< Event for: ANT stack interrupt received.
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.
[in] | pc | Value of the program counter. |
[in] | line_num | Line number where the assert occured. |
[in] | p_file_name | Pointer to the file name. |