Skip to content

Commit

Permalink
nrf/bluetooth: Improve advertisment behavior for nrf52 targets.
Browse files Browse the repository at this point in the history
This patch makes sure that advertisment data is located in
persistent static RAM memory throughout the advertisment.

Also, setting m_adv_handle to predifined
BLE_GAP_ADV_SET_HANDLE_NOT_SET value to indicate first time
usage of the handle. Upon first advertisment configuration
this will be populated with a handle value returned by the
stack (s132/s140).
  • Loading branch information
glennrub committed Feb 20, 2019
1 parent ee3a01f commit 0c6f5bc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ports/nrf/drivers/bluetooth/ble_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ static mp_obj_t mp_gattc_char_data_observer;
#define BLE_GAP_ADV_MAX_SIZE 31
#define BLE_DRV_CONN_CONFIG_TAG 1

static uint8_t m_adv_handle;
static uint8_t m_adv_handle = BLE_GAP_ADV_SET_HANDLE_NOT_SET;
static uint8_t m_scan_buffer[BLE_GAP_SCAN_BUFFER_MIN];

nrf_nvic_state_t nrf_nvic_state = {0};
Expand Down Expand Up @@ -407,7 +407,7 @@ bool ble_drv_advertise_data(ubluepy_advertise_data_t * p_adv_params) {

uint8_t byte_pos = 0;

uint8_t adv_data[BLE_GAP_ADV_MAX_SIZE];
static uint8_t adv_data[BLE_GAP_ADV_MAX_SIZE];

if (p_adv_params->device_name_len > 0) {
ble_gap_conn_sec_mode_t sec_mode;
Expand Down

0 comments on commit 0c6f5bc

Please sign in to comment.