nRF51 SDK: main.c

| nRF51 SDK

- Home
- Related Pages
- API Reference
- Data Structures

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Modules | Macros | Functions
main.c
ANT Stride and Distance Monitor (SDM) TX example

The Stride and Distance Monitor minimal example TX (Master). More...

## Modules

| SDM data update timer
| SDM TX timer interface.

## Macros

#define | CHANNEL_0 0x00
#define | CHANNEL_0_TX_CHANNEL_PERIOD 8134u
#define | CHANNEL_0_ANT_EXT_ASSIGN 0x00
#define | CHANNEL_0_FREQUENCY 57u
#define | NETWORK_0 0x00
#define | NETWORK_0_KEY {0, 0, 0, 0, 0, 0, 0, 0}
#define | CHANNEL_0_CHAN_ID_DEV_TYPE 0x7Cu
#define | CHANNEL_0_CHAN_ID_DEV_NUM 0xAAAAu
#define | CHANNEL_0_CHAN_ID_TRANS_TYPE 0x05u
#define | ANT_EVENT_MSG_BUFFER_MIN_SIZE 32u
#define | BROADCAST_DATA_BUFFER_SIZE 8u

## Functions

void | SD_EVT_IRQHandler (void)
| Function for Stack Interrupt handling.
void | softdevice_assert_callback (uint32_t pc, uint16_t line_num, const uint8_t *p_file_name)
| Function for handling SoftDevice asserts. 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...
void | sdm_main_loop (void)
| Function for Stride and Distance Monitor TX example main loop. More...
void | sdm_data_timer_callback (void)
| Function for callback for timer to invoke. More...
int | main (void)

## Detailed Description

The Stride and Distance Monitor minimal example TX (Master).

## Macro Definition Documentation

#define ANT_EVENT_MSG_BUFFER_MIN_SIZE 32u

Minimum size of ANT event message buffer.

#define BROADCAST_DATA_BUFFER_SIZE 8u

Size of the broadcast data buffer.

#define CHANNEL_0 0x00

ANT Channel 0.

#define CHANNEL_0_ANT_EXT_ASSIGN 0x00

ANT Ext Assign.

#define CHANNEL_0_CHAN_ID_DEV_NUM 0xAAAAu

Device number.

#define CHANNEL_0_CHAN_ID_DEV_TYPE 0x7Cu

Device type 124.

#define CHANNEL_0_CHAN_ID_TRANS_TYPE 0x05u

Transmission type.

#define CHANNEL_0_FREQUENCY 57u

Channel Frequency.

#define CHANNEL_0_TX_CHANNEL_PERIOD 8134u

Channel period 4.03 Hz.

#define NETWORK_0 0x00

ANT Network 0.

#define NETWORK_0_KEY {0, 0, 0, 0, 0, 0, 0, 0}

Public ANT network.

## 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 handler is called.
  [in] | p_file_name | Pointer to the file name.

int main | ( | void |  | ) |

for application main entry, does not return.

The main function will do all necessary initalization. This includes sdm tx module, timer and SoftDevice.

< ANT Channel 0.

< Size of the broadcast data buffer.

void sdm_data_timer_callback | ( | void |  | ) |

Function for callback for timer to invoke.

This function will call sdm module to update its stride and distance data according to what features SDM TX module has implemented.

void sdm_main_loop | ( | void |  | ) |

Function for Stride and Distance Monitor TX example main loop.

The main loop will try to sleep as much as possible. Every time a protocol event occours, the application will be woken up, polling the ANT stack event queue. When finished processing all events, the application will go back to sleep.

< Minimum size of ANT event message buffer.

< ANT Channel 0.

< Size of the broadcast data buffer.

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

Function for handling SoftDevice asserts.

Parameters

  [in] | pc | The value of the program counter.
  [in] | line_num | Line number where the error occurred.
  [in] | p_file_name | Pointer to the file name.