Skip to content

Nordic BLE: Allow configuration of softdevice parameters #6860

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,20 +111,6 @@ error_t btle_init(void)
SOFTDEVICE_HANDLER_INIT(&clockConfiguration, signalEvent);

// Enable BLE stack
/**
* Using this call, the application can select whether to include the
* Service Changed characteristic in the GATT Server. The default in all
* previous releases has been to include the Service Changed characteristic,
* but this affects how GATT clients behave. Specifically, it requires
* clients to subscribe to this attribute and not to cache attribute handles
* between connections unless the devices are bonded. If the application
* does not need to change the structure of the GATT server attributes at
* runtime this adds unnecessary complexity to the interaction with peer
* clients. If the SoftDevice is enabled with the Service Changed
* Characteristics turned off, then clients are allowed to cache attribute
* handles making applications simpler on both sides.
*/
static const bool IS_SRVC_CHANGED_CHARACT_PRESENT = true;

ble_enable_params_t ble_enable_params;
uint32_t err_code = softdevice_enable_get_default_config(CENTRAL_LINK_COUNT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,50 @@ extern "C" {
#include "ble_srv_common.h"
#include "headers/nrf_ble.h"

#define CENTRAL_LINK_COUNT 3 /**<number of central links used by the application. When changing this number remember to adjust the RAM settings */
/** If value for YOTTA_CFG_NORDIC_BLE_PERIPHERAL_LINKS was used, ram settings are adjusted by the yotta target module. */
#define PERIPHERAL_LINK_COUNT 1 /**<number of peripheral links used by the application. When changing this number remember to adjust the RAM settings*/
/** If value for YOTTA_CFG_NORDIC_BLE_CENTRAL_LINKS was used, ram settings are adjusted by the yotta target module. */
#define GATTS_ATTR_TAB_SIZE 0x600 /**< GATTS attribite table size. */
/** If value for YOTTA_CFG_NORDIC_BLE_GATTS_ATTR_TAB_SIZE was used, ram settings are adjusted by the yotta target module. */
/* number of central links used by the application.
* When changing this number remember to adjust the RAM settings */
#ifndef NRF_SDH_BLE_CENTRAL_LINK_COUNT
#define CENTRAL_LINK_COUNT 3
#else
#define CENTRAL_LINK_COUNT NRF_SDH_BLE_CENTRAL_LINK_COUNT
#endif

/* number of peripheral links used by the application.
* When changing this number remember to adjust the RAM settings */
#ifndef NRF_SDH_BLE_PERIPHERAL_LINK_COUNT
#define PERIPHERAL_LINK_COUNT 1
#else
#define PERIPHERAL_LINK_COUNT NRF_SDH_BLE_PERIPHERAL_LINK_COUNT
#endif


/* GATTS attribite table size.
* When changing this number remember to adjust the RAM settings */
#ifndef NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE
#define GATTS_ATTR_TAB_SIZE 0x600
#else
#define GATTS_ATTR_TAB_SIZE NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE
#endif


/**
* Using this call, the application can select whether to include the
* Service Changed characteristic in the GATT Server. The default in all
* previous releases has been to include the Service Changed characteristic,
* but this affects how GATT clients behave. Specifically, it requires
* clients to subscribe to this attribute and not to cache attribute handles
* between connections unless the devices are bonded. If the application
* does not need to change the structure of the GATT server attributes at
* runtime this adds unnecessary complexity to the interaction with peer
* clients. If the SoftDevice is enabled with the Service Changed
* Characteristics turned off, then clients are allowed to cache attribute
* handles making applications simpler on both sides.
*/
#ifndef NRF_SDH_BLE_SERVICE_CHANGED
#define IS_SRVC_CHANGED_CHARACT_PRESENT 1
#else
#define IS_SRVC_CHANGED_CHARACT_PRESENT NRF_SDH_BLE_SERVICE_CHANGED
#endif

error_t btle_init(void);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,13 @@
extern "C" {
#endif

#define UUID_TABLE_MAX_ENTRIES (4) /* This is the maximum number of 128-bit UUIDs with distinct bases that
* we expect to be in use; increase this limit if needed. */
/* This is the maximum number of 128-bit UUIDs with distinct bases that *
* we expect to be in use; increase this limit if needed. */
#ifdef NRF_SDH_BLE_VS_UUID_COUNT
#define UUID_TABLE_MAX_ENTRIES NRF_SDH_BLE_VS_UUID_COUNT
#else
#define UUID_TABLE_MAX_ENTRIES (4)
#endif

/**
* Reset the table of 128bits uuids.
Expand Down
30 changes: 30 additions & 0 deletions features/FEATURE_BLE/targets/TARGET_NORDIC/mbed_lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "nordic-ble",
"config": {
"central_link_count": {
"help": "When acting as BLE central, how many peripherals can connect",
"value": "3",
"macro_name": "NRF_SDH_BLE_CENTRAL_LINK_COUNT"
},
"peripheral_link_count": {
"help": "When acting as BLE peripheral, how many centrals can we conenct to",
"value": "1",
"macro_name": "NRF_SDH_BLE_PERIPHERAL_LINK_COUNT"
},
"gatt_attr_tab_size": {
"help": "The size of the table used to hold gatts. Can be adjusted by trial and error",
"value": "0x600",
"macro_name": "NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE"
},
"uuid_table_max_entries": {
"help": "maximum number of 128-bit UUIDs with distinct bases that we expect to be in use",
"value": "4",
"macro_name": "NRF_SDH_BLE_VS_UUID_COUNT"
},
"is_srvc_changed_charact_present": {
"help": "select whether to include the Service Changed characteristic in the GATT Server",
"value": "1",
"macro_name": "NRF_SDH_BLE_SERVICE_CHANGED"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,7 @@
"NRF_SDH_ENABLED=1",
"NRF_SDH_BLE_ENABLED=1",
"PEER_MANAGER_ENABLED=1",
"NRF_SDH_BLE_PERIPHERAL_LINK_COUNT=1",
"NRF_SDH_BLE_CENTRAL_LINK_COUNT=3",
"NRF_SDH_BLE_TOTAL_LINK_COUNT=4",
"NRF_SDH_BLE_SERVICE_CHANGED=1",
"NRF_SDH_BLE_GATT_MAX_MTU_SIZE=23",
"NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE=0x600",
"NRF_SDH_BLE_VS_UUID_COUNT=4",
"NRF_SDH_BLE_OBSERVER_PRIO_LEVELS=4",
"NRF_SDH_BLE_GAP_EVENT_LENGTH=3",
"BLE_ADV_BLE_OBSERVER_PRIO=1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,7 @@
"NRF_SDH_ENABLED=1",
"NRF_SDH_BLE_ENABLED=1",
"PEER_MANAGER_ENABLED=1",
"NRF_SDH_BLE_PERIPHERAL_LINK_COUNT=1",
"NRF_SDH_BLE_CENTRAL_LINK_COUNT=3",
"NRF_SDH_BLE_TOTAL_LINK_COUNT=4",
"NRF_SDH_BLE_SERVICE_CHANGED=1",
"NRF_SDH_BLE_GATT_MAX_MTU_SIZE=23",
"NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE=0x600",
"NRF_SDH_BLE_VS_UUID_COUNT=4",
"NRF_SDH_BLE_OBSERVER_PRIO_LEVELS=4",
"NRF_SDH_BLE_GAP_EVENT_LENGTH=3",
"BLE_ADV_BLE_OBSERVER_PRIO=1",
Expand Down