clean up config
This commit is contained in:
1 parent
ecc250eb27
commit
80313c704b
3 files changed
+22
-22
No files matched your search
@@ -160,10 +160,10 @@ void BLEGap::_eventHandler(ble_evt_t* evt)
|
||||
(void) sd_ble_tx_packet_count_get(conn_handle, &txbuf_max);
|
||||
peer->hvn_tx_sem = xSemaphoreCreateCounting(txbuf_max, txbuf_max);
|
||||
#else
|
||||
peer->hvn_tx_sem = xSemaphoreCreateCounting(BLEGAP_HVN_TX_QUEUE_SIZE, BLEGAP_HVN_TX_QUEUE_SIZE);
|
||||
peer->hvn_tx_sem = xSemaphoreCreateCounting(CFG_GAP_HVN_TX_QUEUE_SIZE, CFG_GAP_HVN_TX_QUEUE_SIZE);
|
||||
#endif
|
||||
|
||||
peer->wrcmd_tx_sem = xSemaphoreCreateCounting(BLEGAP_WRITECMD_TX_QUEUE_SIZE, BLEGAP_WRITECMD_TX_QUEUE_SIZE);
|
||||
peer->wrcmd_tx_sem = xSemaphoreCreateCounting(CFG_GAP_WRITECMD_TX_QUEUE_SIZE, CFG_GAP_WRITECMD_TX_QUEUE_SIZE);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -94,14 +94,14 @@ static void nrf_error_cb(uint32_t id, uint32_t pc, uint32_t info)
|
||||
AdafruitBluefruit::AdafruitBluefruit(void)
|
||||
: Central()
|
||||
{
|
||||
_sd_cfg.attr_table_size = BLE_GATTS_ATTR_TABLE_SIZE;
|
||||
_sd_cfg.attr_table_size = CFG_ATTR_TABLE_SIZE;
|
||||
_sd_cfg.mtu_max = BLEGATT_ATT_MTU_MAX;
|
||||
_sd_cfg.service_changed = 0;
|
||||
_sd_cfg.uuid128_max = BLE_VENDOR_UUID_MAX;
|
||||
_sd_cfg.uuid128_max = CFG_UUID128_MAX;
|
||||
|
||||
_sd_cfg.event_len = BLEGAP_EVENT_LENGTH;
|
||||
_sd_cfg.hvn_tx_qsize = BLEGAP_HVN_TX_QUEUE_SIZE;
|
||||
_sd_cfg.wr_cmd_qsize = BLEGAP_WRITECMD_TX_QUEUE_SIZE;
|
||||
_sd_cfg.event_len = CFG_GAP_EVENT_LENGTH;
|
||||
_sd_cfg.hvn_tx_qsize = CFG_GAP_HVN_TX_QUEUE_SIZE;
|
||||
_sd_cfg.wr_cmd_qsize = CFG_GAP_WRITECMD_TX_QUEUE_SIZE;
|
||||
|
||||
_prph_enabled = true;
|
||||
_central_enabled = false;
|
||||
@@ -214,7 +214,7 @@ err_t AdafruitBluefruit::begin(bool prph_enable, bool central_enable)
|
||||
// Configure BLE params & ATTR Size
|
||||
ble_enable_params_t params =
|
||||
{
|
||||
.common_enable_params = { .vs_uuid_count = BLE_VENDOR_UUID_MAX },
|
||||
.common_enable_params = { .vs_uuid_count = CFG_UUID128_MAX },
|
||||
.gap_enable_params = {
|
||||
.periph_conn_count = (uint8_t) (_prph_enabled ? 1 : 0),
|
||||
.central_conn_count = (uint8_t) (_central_enabled ? BLE_CENTRAL_MAX_CONN : 0),
|
||||
@@ -222,7 +222,7 @@ err_t AdafruitBluefruit::begin(bool prph_enable, bool central_enable)
|
||||
},
|
||||
.gatts_enable_params = {
|
||||
.service_changed = 1,
|
||||
.attr_tab_size = BLE_GATTS_ATTR_TABLE_SIZE
|
||||
.attr_tab_size = CFG_ATTR_TABLE_SIZE
|
||||
}
|
||||
};
|
||||
|
||||
@@ -233,7 +233,7 @@ err_t AdafruitBluefruit::begin(bool prph_enable, bool central_enable)
|
||||
|
||||
// Vendor UUID count
|
||||
varclr(&blecfg);
|
||||
blecfg.common_cfg.vs_uuid_cfg.vs_uuid_count = BLE_VENDOR_UUID_MAX;
|
||||
blecfg.common_cfg.vs_uuid_cfg.vs_uuid_count = CFG_UUID128_MAX;
|
||||
VERIFY_STATUS ( sd_ble_cfg_set(BLE_COMMON_CFG_VS_UUID, &blecfg, ram_start) );
|
||||
|
||||
// Roles
|
||||
|
||||
@@ -52,11 +52,11 @@
|
||||
* - BLE_GATTC_WRITE_CMD_TX_QUEUE_SIZE_DEFAULT = 1
|
||||
* - BLEGATT_ATT_MTU_MAX from 23 (default) to 247
|
||||
*/
|
||||
#define BLE_GATTS_ATTR_TABLE_SIZE 0xB00 //0x0B00 default is 0x580
|
||||
#define BLE_VENDOR_UUID_MAX 20
|
||||
#define BLEGAP_EVENT_LENGTH 6
|
||||
#define BLEGAP_HVN_TX_QUEUE_SIZE 3
|
||||
#define BLEGAP_WRITECMD_TX_QUEUE_SIZE 3
|
||||
#define CFG_ATTR_TABLE_SIZE 0xB00
|
||||
#define CFG_UUID128_MAX 10
|
||||
#define CFG_GAP_EVENT_LENGTH BLE_GAP_EVENT_LENGTH_DEFAULT
|
||||
#define CFG_GAP_HVN_TX_QUEUE_SIZE 3
|
||||
#define CFG_GAP_WRITECMD_TX_QUEUE_SIZE BLE_GATTC_WRITE_CMD_TX_QUEUE_SIZE_DEFAULT
|
||||
|
||||
#if SD_VER < 500
|
||||
#define BLEGATT_ATT_MTU_MAX BLE_GATT_ATT_MTU_DEFAULT
|
||||
@@ -135,15 +135,15 @@ class AdafruitBluefruit
|
||||
* required SRAM exceed numbered allocated by default linker, choose
|
||||
* another linker in the IDE menu
|
||||
*------------------------------------------------------------------*/
|
||||
void configServiceChanged(bool changed);
|
||||
void configUuid128Count(uint8_t uuid128_max); // default BLE_VENDOR_UUID_MAX
|
||||
void configAttrTableSize(uint32_t attr_table_size); // BLE_GATTS_ATTR_TABLE_SIZE
|
||||
void configMaxMtu(uint16_t mtu_max);
|
||||
void configServiceChanged (bool changed);
|
||||
void configUuid128Count (uint8_t uuid128_max);
|
||||
void configAttrTableSize (uint32_t attr_table_size);
|
||||
void configMaxMtu (uint16_t mtu_max);
|
||||
|
||||
// Bandwidth affection function
|
||||
void configGapEventLen(uint8_t event_length);
|
||||
void configHvnTxQueue(uint8_t hvn_tx_qsize);
|
||||
void configWriteCmdQueue(uint8_t wr_cmd_qsize);
|
||||
void configGapEventLen (uint8_t event_length);
|
||||
void configHvnTxQueue (uint8_t hvn_tx_qsize);
|
||||
void configWriteCmdQueue (uint8_t wr_cmd_qsize);
|
||||
|
||||
err_t begin(bool prph_enable = true, bool central_enable = false);
|
||||
|
||||
|
||||
Reference in new issue
Block a user