Serialized Advertising example application main file.
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...
|
|
void | assert_nrf_callback (uint16_t line_num, const uint8_t *file_name) |
| Callback function for asserts in the SoftDevice. More...
|
|
static void | leds_init (void) |
| Function for initializing the LEDs. More...
|
|
static void | ble_evt_dispatch (ble_evt_t *p_ble_evt) |
| Function for dispatching a BLE stack event to all modules with a BLE stack event handler. More...
|
|
static void | bluetooth_init (void) |
| Function for initializing the BLE Soft Device and Advertisement parameters. More...
|
|
static void | power_manage (void) |
| Function for power management.
|
|
static void | connectivity_chip_reset (void) |
| Function for resetting the connectivity chip. More...
|
|
static void | scheduler_init (void) |
| Function for initializing the event scheduler.
|
|
int | main (void) |
| Function for application main entry.
|
|
Definition of HCI Transport Layer configurable parameters.
This is a simple application for demonstrating how to set up and initiate advertising through serialisation of SoftDevice Command and Events.
#define DEVICE_NAME "BLE Connectivity" |
Name of device. Will be included in the advertising data.
#define APP_ADV_INTERVAL 64 |
The advertising interval (in units of 0.625 ms. This value corresponds to 40 ms).
#define APP_ADV_TIMEOUT_IN_SECONDS 180 |
The advertising timeout (in units of seconds).
Minimum acceptable connection interval (0.5 seconds).
Maximum acceptable connection interval (1 second).
Connection supervisory timeout (4 seconds)
#define DEAD_BEEF 0xDEADBEEF |
Value used as error code on stack dump, can be used to identify stack location on stack unwind.
#define MAIN_FUNCTION_LED_PIN_NO NRF6310_LED_2 |
LED indicating that the program has entered main function.
#define CONN_CHIP_RESET_PIN_NO 30 |
Pin used for reseting the connectivity chip.
#define CONN_CHIP_RESET_TIME 50 |
The time to keep the reset line to the connectivity chip low (in milliseconds).
#define CONN_CHIP_WAKEUP_TIME 500 |
The time for connectivity chip to reset and become ready to receive serialized commands (in milliseconds).
Maximum size of scheduler events.
#define SCHED_QUEUE_SIZE 10 |
Maximum number of events in the scheduler queue.
#define APP_TIMER_PRESCALER 0 |
Value of the RTC1 PRESCALER register.
#define APP_TIMER_MAX_TIMERS 1 |
Maximum number of simultaneously created timers.
#define APP_TIMER_OP_QUEUE_SIZE 1 |
Size of timer operation queues.
#define APP_GPIOTE_MAX_USERS 1 |
Maximum number of users of the GPIOTE handler. In this example the GPIOTE user is: UART Module used by HCI Transport layer.
#define HCI_SLIP_UART_RX_PIN_NUMBER RX_PIN_NUMBER |
< Default include for boards.h which means that default pin numbers will be used for RX, TX, CTS, and RTS on the UART. Other pin number can be used if desired. This section covers configurable parameters for the HCI Transport SLIP layer. Defines the UART RX pin number. The default pin for the board is chosen, but can be overwritten.
#define HCI_SLIP_UART_TX_PIN_NUMBER TX_PIN_NUMBER |
Defines the UART TX pin number. The default pin for the board is chosen, but can be overwritten.
#define HCI_SLIP_UART_RTS_PIN_NUMBER RTS_PIN_NUMBER |
Defines the UART RTS pin number. The default pin for the board is chosen, but can be overwritten.
#define HCI_SLIP_UART_CTS_PIN_NUMBER CTS_PIN_NUMBER |
Defines the UART CTS pin number. The default pin for the board is chosen, but can be overwritten.
Defines the UART mode to be used. Use UART Low Power with Flow Control - Valid values are defined in app_uart_flow_control_t. For further information on the UART Low Power mode, please refer to: UART module .
#define HCI_SLIP_UART_BAUDRATE UART_BAUDRATE_BAUDRATE_Baud38400 |
Defines the UART Baud rate. Default is 38400 baud.
#define MAX_PACKET_SIZE_IN_BITS 8000u |
This section covers configurable parameters for the HCI Transport layer that are used for calculating correct value for the retransmission timer timeout. Maximum size of a single application packet in bits.
#define USED_BAUD_RATE 38400u |
void app_error_handler |
( |
uint32_t |
error_code, |
|
|
uint32_t |
line_num, |
|
|
const uint8_t * |
p_file_name |
|
) |
| |
- 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 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 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. |
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. |
void assert_nrf_callback |
( |
uint16_t |
line_num, |
|
|
const uint8_t * |
file_name |
|
) |
| |
This function will be called in case of an assert in the SoftDevice.
- 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 Assert.
-
On assert from the SoftDevice, the system can only recover on reset.
- Parameters
-
[in] | line_num | Line number of the failing ASSERT call. |
[in] | file_name | File name of the failing ASSERT call. |
static void leds_init |
( |
void |
| ) |
|
|
static |
Initializes all LEDs used by this application.
static void ble_evt_dispatch |
( |
ble_evt_t * |
p_ble_evt | ) |
|
|
static |
This function is called from the BLE Stack event interrupt handler after a BLE stack event has been received.
- Parameters
-
[in] | p_ble_evt | Bluetooth stack event. |
static void bluetooth_init |
( |
void |
| ) |
|
|
static |
This function is called to initialize BLE stack and GAP Parameters needed for advertising event has been received.
static void connectivity_chip_reset |
( |
void |
| ) |
|
|
static |