nRF51 SDK: main.c

| nRF51 SDK

- Home
- Related Pages
- API Reference
- Data Structures

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

The Stride and Distance Monitor minimal example RX (Slave). More...

## Macros

#define | CHANNEL_0 0x00
#define | CHANNEL_0_RX_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 0x00
#define | CHANNEL_0_CHAN_ID_TRANS_TYPE 0x00
#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 RX example main loop. More...
int | main (void)
| Function for application main entry, does not return. More...

## Detailed Description

The Stride and Distance Monitor minimal example RX (Slave).

## 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 0x00

Device number.

#define CHANNEL_0_CHAN_ID_DEV_TYPE 0x7Cu

Device type 124.

#define CHANNEL_0_CHAN_ID_TRANS_TYPE 0x00

Transmission type.

#define CHANNEL_0_FREQUENCY 57u

Channel Frequency.

#define CHANNEL_0_RX_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 |  | ) |

Function for application main entry, does not return.

The main function will do all necessary initalization. This includes sdm rx module and SoftDevice.

void sdm_main_loop | ( | void |  | ) |

Function for Stride and Distance Monitor RX 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.

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.