2020-08-18 23:02:57 +02:00
|
|
|
/** @file
|
|
|
|
*
|
|
|
|
* IGNORE THIS FILE IF USING ESP-IDF, USE MENUCONFIG TO SET NIMBLE OPTIONS.
|
|
|
|
*
|
|
|
|
* The config options here are for Arduino use only.
|
|
|
|
*/
|
|
|
|
|
2020-05-14 06:03:56 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "sdkconfig.h"
|
2020-08-18 23:02:57 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* For ESP-IDF compatibility
|
|
|
|
* Some versions of ESP-IDF used the config name format "CONFIG_NIMBLE_".
|
|
|
|
* This converts them to "CONFIG_BT_NIMBLE_" format used in the latest IDF.
|
2020-05-14 06:03:56 +02:00
|
|
|
*/
|
2020-08-18 23:02:57 +02:00
|
|
|
|
|
|
|
/* Detect if using ESP-IDF or Arduino (Arduino won't have these defines in sdkconfig) */
|
2020-05-14 06:03:56 +02:00
|
|
|
#if defined(CONFIG_BT_NIMBLE_TASK_STACK_SIZE) || defined(CONFIG_NIMBLE_TASK_STACK_SIZE)
|
|
|
|
|
2020-06-14 17:11:05 +02:00
|
|
|
#if defined(CONFIG_NIMBLE_ENABLED) && !defined(CONFIG_BT_NIMBLE_ENABLED)
|
2020-05-14 06:03:56 +02:00
|
|
|
#define CONFIG_BT_NIMBLE_ENABLED
|
|
|
|
#endif
|
|
|
|
|
2020-06-14 17:11:05 +02:00
|
|
|
#if defined(CONFIG_NIMBLE_ROLE_OBSERVER) && !defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
|
2020-05-14 06:03:56 +02:00
|
|
|
#define CONFIG_BT_NIMBLE_ROLE_OBSERVER
|
|
|
|
#endif
|
|
|
|
|
2020-06-14 17:11:05 +02:00
|
|
|
#if defined(CONFIG_NIMBLE_ROLE_BROADCASTER) && !defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
|
2020-05-14 06:03:56 +02:00
|
|
|
#define CONFIG_BT_NIMBLE_ROLE_BROADCASTER
|
|
|
|
#endif
|
|
|
|
|
2020-06-14 17:11:05 +02:00
|
|
|
#if defined(CONFIG_NIMBLE_ROLE_CENTRAL) && !defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
2020-05-14 06:03:56 +02:00
|
|
|
#define CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
|
|
|
#endif
|
|
|
|
|
2020-06-14 17:11:05 +02:00
|
|
|
#if defined(CONFIG_NIMBLE_ROLE_PERIPHERAL) && !defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
2020-05-14 06:03:56 +02:00
|
|
|
#define CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
|
|
|
#endif
|
|
|
|
|
2020-06-14 17:11:05 +02:00
|
|
|
#if defined(CONFIG_NIMBLE_DEBUG) && !defined(CONFIG_BT_NIMBLE_DEBUG)
|
2020-05-14 06:03:56 +02:00
|
|
|
#define CONFIG_BT_NIMBLE_DEBUG
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#else // Using Arduino
|
|
|
|
|
|
|
|
/***********************************************
|
2020-08-18 23:02:57 +02:00
|
|
|
* Arduino config options start here
|
2020-05-14 06:03:56 +02:00
|
|
|
**********************************************/
|
|
|
|
|
2020-08-18 23:02:57 +02:00
|
|
|
/** @brief Comment out if not using NimBLE Client functions \n
|
2020-05-14 06:03:56 +02:00
|
|
|
* Reduces flash size by approx. 7kB.
|
|
|
|
*/
|
2020-12-20 07:05:54 +01:00
|
|
|
#ifndef CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
2020-05-14 06:03:56 +02:00
|
|
|
#define CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
2020-12-20 07:05:54 +01:00
|
|
|
#endif
|
2020-05-14 06:03:56 +02:00
|
|
|
|
2020-08-18 23:02:57 +02:00
|
|
|
/** @brief Comment out if not using NimBLE Scan functions \n
|
2020-05-14 06:03:56 +02:00
|
|
|
* Reduces flash size by approx. 26kB.
|
|
|
|
*/
|
2020-12-20 07:05:54 +01:00
|
|
|
#ifndef CONFIG_BT_NIMBLE_ROLE_OBSERVER
|
2020-05-14 06:03:56 +02:00
|
|
|
#define CONFIG_BT_NIMBLE_ROLE_OBSERVER
|
2020-12-20 07:05:54 +01:00
|
|
|
#endif
|
2020-05-14 06:03:56 +02:00
|
|
|
|
2020-08-18 23:02:57 +02:00
|
|
|
/** @brief Comment out if not using NimBLE Server functions \n
|
2020-05-14 06:03:56 +02:00
|
|
|
* Reduces flash size by approx. 16kB.
|
|
|
|
*/
|
2020-12-20 07:05:54 +01:00
|
|
|
#ifndef CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
2020-05-14 06:03:56 +02:00
|
|
|
#define CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
2020-12-20 07:05:54 +01:00
|
|
|
#endif
|
2020-05-14 06:03:56 +02:00
|
|
|
|
2020-08-18 23:02:57 +02:00
|
|
|
/** @brief Comment out if not using NimBLE Advertising functions \n
|
2020-05-14 06:03:56 +02:00
|
|
|
* Reduces flash size by approx. 5kB.
|
|
|
|
*/
|
2020-12-20 07:05:54 +01:00
|
|
|
#ifndef CONFIG_BT_NIMBLE_ROLE_BROADCASTER
|
2020-05-14 06:03:56 +02:00
|
|
|
#define CONFIG_BT_NIMBLE_ROLE_BROADCASTER
|
2020-12-20 07:05:54 +01:00
|
|
|
#endif
|
2020-05-14 06:03:56 +02:00
|
|
|
|
2020-08-18 23:02:57 +02:00
|
|
|
/* Uncomment to see debug log messages from the NimBLE host
|
2020-05-14 06:03:56 +02:00
|
|
|
* Uses approx. 32kB of flash memory.
|
|
|
|
*/
|
|
|
|
// #define CONFIG_BT_NIMBLE_DEBUG
|
|
|
|
|
2020-08-18 23:02:57 +02:00
|
|
|
/* Uncomment to see NimBLE host return codes as text debug log messages.
|
2020-05-14 06:03:56 +02:00
|
|
|
* Uses approx. 7kB of flash memory.
|
|
|
|
*/
|
|
|
|
// #define CONFIG_NIMBLE_CPP_ENABLE_RETURN_CODE_TEXT
|
|
|
|
|
2020-08-18 23:02:57 +02:00
|
|
|
/* Uncomment to see GAP event codes as text in debug log messages.
|
2020-05-14 06:03:56 +02:00
|
|
|
* Uses approx. 1kB of flash memory.
|
|
|
|
*/
|
|
|
|
// #define CONFIG_NIMBLE_CPP_ENABLE_GAP_EVENT_CODE_TEXT
|
|
|
|
|
2020-08-18 23:02:57 +02:00
|
|
|
/* Uncomment to see advertisment types as text while scanning in debug log messages.
|
2020-05-14 06:03:56 +02:00
|
|
|
* Uses approx. 250 bytes of flash memory.
|
|
|
|
*/
|
|
|
|
// #define CONFIG_NIMBLE_CPP_ENABLE_ADVERTISMENT_TYPE_TEXT
|
|
|
|
|
2020-08-18 23:02:57 +02:00
|
|
|
/** @brief Sets the core NimBLE host runs on */
|
2020-12-20 07:05:54 +01:00
|
|
|
#ifndef CONFIG_BT_NIMBLE_PINNED_TO_CORE
|
2020-05-14 06:03:56 +02:00
|
|
|
#define CONFIG_BT_NIMBLE_PINNED_TO_CORE 0
|
2020-12-20 07:05:54 +01:00
|
|
|
#endif
|
2020-05-14 06:03:56 +02:00
|
|
|
|
2020-08-18 23:02:57 +02:00
|
|
|
/** @brief Sets the stack size for the NimBLE host task */
|
2020-12-20 07:05:54 +01:00
|
|
|
#ifndef CONFIG_BT_NIMBLE_TASK_STACK_SIZE
|
2020-05-14 06:03:56 +02:00
|
|
|
#define CONFIG_BT_NIMBLE_TASK_STACK_SIZE 4096
|
2020-12-20 07:05:54 +01:00
|
|
|
#endif
|
2020-05-14 06:03:56 +02:00
|
|
|
|
2020-08-18 23:02:57 +02:00
|
|
|
/**
|
|
|
|
* @brief Sets the memory pool where NimBLE will be loaded
|
|
|
|
* @details By default NimBLE is loaded in internal ram.\n
|
|
|
|
* To use external PSRAM you must change this to `#define CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_EXTERNAL 1`
|
|
|
|
*/
|
2020-12-20 07:05:54 +01:00
|
|
|
#ifndef CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_EXTERNAL
|
2020-08-18 23:02:57 +02:00
|
|
|
#define CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_INTERNAL 1
|
2020-12-20 07:05:54 +01:00
|
|
|
#endif
|
2020-08-18 23:02:57 +02:00
|
|
|
|
2020-09-14 04:02:15 +02:00
|
|
|
/** @brief Sets the number of simultaneous connections (esp controller max is 9) */
|
2020-12-20 07:05:54 +01:00
|
|
|
#ifndef CONFIG_BT_NIMBLE_MAX_CONNECTIONS
|
2020-05-14 06:03:56 +02:00
|
|
|
#define CONFIG_BT_NIMBLE_MAX_CONNECTIONS 3
|
2020-12-20 07:05:54 +01:00
|
|
|
#endif
|
2020-05-14 06:03:56 +02:00
|
|
|
|
2020-08-18 23:02:57 +02:00
|
|
|
/** @brief Sets the number of devices allowed to store/bond with */
|
2020-12-20 07:05:54 +01:00
|
|
|
#ifndef CONFIG_BT_NIMBLE_MAX_BONDS
|
2020-05-14 06:03:56 +02:00
|
|
|
#define CONFIG_BT_NIMBLE_MAX_BONDS 3
|
2020-12-20 07:05:54 +01:00
|
|
|
#endif
|
2020-05-14 06:03:56 +02:00
|
|
|
|
2020-08-18 23:02:57 +02:00
|
|
|
/** @brief Sets the maximum number of CCCD subscriptions to store */
|
2020-12-20 07:05:54 +01:00
|
|
|
#ifndef CONFIG_BT_NIMBLE_MAX_CCCDS
|
2020-05-14 06:03:56 +02:00
|
|
|
#define CONFIG_BT_NIMBLE_MAX_CCCDS 8
|
2020-12-20 07:05:54 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/** @brief Default device name */
|
|
|
|
#ifndef CONFIG_BT_NIMBLE_SVC_GAP_DEVICE_NAME
|
|
|
|
#define CONFIG_BT_NIMBLE_SVC_GAP_DEVICE_NAME "nimble"
|
|
|
|
#endif
|
2020-05-14 06:03:56 +02:00
|
|
|
|
2020-08-18 23:02:57 +02:00
|
|
|
/** @brief Set if CCCD's and bond data should be stored in NVS */
|
2020-05-14 06:03:56 +02:00
|
|
|
#define CONFIG_BT_NIMBLE_NVS_PERSIST 1
|
2020-08-18 23:02:57 +02:00
|
|
|
|
|
|
|
/** @brief Allow legacy paring */
|
2020-05-14 06:03:56 +02:00
|
|
|
#define CONFIG_BT_NIMBLE_SM_LEGACY 1
|
2020-08-18 23:02:57 +02:00
|
|
|
|
|
|
|
/** @brief Allow BLE secure connections */
|
2020-05-14 06:03:56 +02:00
|
|
|
#define CONFIG_BT_NIMBLE_SM_SC 1
|
2020-08-18 23:02:57 +02:00
|
|
|
|
|
|
|
/** @brief Max device name length (bytes) */
|
2020-05-14 06:03:56 +02:00
|
|
|
#define CONFIG_BT_NIMBLE_GAP_DEVICE_NAME_MAX_LEN 31
|
2020-08-18 23:02:57 +02:00
|
|
|
|
|
|
|
/** @brief Default MTU size */
|
2020-05-14 06:03:56 +02:00
|
|
|
#define CONFIG_BT_NIMBLE_ATT_PREFERRED_MTU 256
|
2020-08-18 23:02:57 +02:00
|
|
|
|
|
|
|
/** @brief Default GAP appearance */
|
2020-05-14 06:03:56 +02:00
|
|
|
#define CONFIG_BT_NIMBLE_SVC_GAP_APPEARANCE 0x0
|
2020-08-18 23:02:57 +02:00
|
|
|
|
|
|
|
/** @brief ACL Buffer count */
|
2020-05-14 06:03:56 +02:00
|
|
|
#define CONFIG_BT_NIMBLE_ACL_BUF_COUNT 12
|
2020-08-18 23:02:57 +02:00
|
|
|
|
|
|
|
/** @brief ACL Buffer size */
|
2020-05-14 06:03:56 +02:00
|
|
|
#define CONFIG_BT_NIMBLE_ACL_BUF_SIZE 255
|
2020-08-18 23:02:57 +02:00
|
|
|
|
|
|
|
/** @brief HCI Event Buffer size */
|
2020-05-14 06:03:56 +02:00
|
|
|
#define CONFIG_BT_NIMBLE_HCI_EVT_BUF_SIZE 70
|
2020-08-18 23:02:57 +02:00
|
|
|
|
|
|
|
/** @brief Number of high priority HCI event buffers */
|
2020-05-14 06:03:56 +02:00
|
|
|
#define CONFIG_BT_NIMBLE_HCI_EVT_HI_BUF_COUNT 30
|
2020-08-18 23:02:57 +02:00
|
|
|
|
|
|
|
/** @brief Number of low priority HCI event buffers */
|
2020-05-14 06:03:56 +02:00
|
|
|
#define CONFIG_BT_NIMBLE_HCI_EVT_LO_BUF_COUNT 8
|
2020-08-18 23:02:57 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Sets the number of MSYS buffers available.
|
|
|
|
* @details MSYS is a system level mbuf registry. For prepare write & prepare \n
|
|
|
|
* responses MBUFs are allocated out of msys_1 pool. This may need to be increased if\n
|
|
|
|
* you are sending large blocks of data with a low MTU. E.g: 512 bytes with 23 MTU will fail.
|
|
|
|
*/
|
2020-05-14 06:03:56 +02:00
|
|
|
#define CONFIG_BT_NIMBLE_MSYS1_BLOCK_COUNT 12
|
2020-08-18 23:02:57 +02:00
|
|
|
|
|
|
|
/** @brief Random address refresh time in seconds */
|
|
|
|
#define CONFIG_BT_NIMBLE_RPA_TIMEOUT 900
|
|
|
|
|
|
|
|
/** @brief Maximum number of connection oriented channels */
|
|
|
|
#define CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM 0
|
|
|
|
|
|
|
|
/* These should not be altered */
|
2020-05-14 06:03:56 +02:00
|
|
|
#define CONFIG_BT_NIMBLE_HS_FLOW_CTRL 1
|
|
|
|
#define CONFIG_BT_NIMBLE_HS_FLOW_CTRL_ITVL 1000
|
|
|
|
#define CONFIG_BT_NIMBLE_HS_FLOW_CTRL_THRESH 2
|
|
|
|
#define CONFIG_BT_NIMBLE_HS_FLOW_CTRL_TX_ON_DISCONNECT 1
|
|
|
|
|
2020-05-26 02:52:46 +02:00
|
|
|
#ifndef CONFIG_BT_ENABLED
|
2020-05-14 06:03:56 +02:00
|
|
|
#define CONFIG_BT_ENABLED
|
2020-05-26 02:52:46 +02:00
|
|
|
#endif
|
2020-08-18 23:02:57 +02:00
|
|
|
|
2020-05-14 06:03:56 +02:00
|
|
|
#define CONFIG_BTDM_CONTROLLER_MODE_BLE_ONLY
|
|
|
|
|
|
|
|
#endif // #if defined(CONFIG_BT_NIMBLE_TASK_STACK_SIZE) || defined(CONFIG_NIMBLE_TASK_STACK_SIZE)
|
|
|
|
|
2020-08-18 23:02:57 +02:00
|
|
|
/**********************************
|
|
|
|
End Arduino config
|
|
|
|
**********************************/
|
|
|
|
|
|
|
|
|
|
|
|
/* Cannot use client without scan */
|
2020-05-14 06:03:56 +02:00
|
|
|
#if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL) && !defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
|
|
|
|
#define CONFIG_BT_NIMBLE_ROLE_OBSERVER
|
|
|
|
#endif
|
|
|
|
|
2020-08-18 23:02:57 +02:00
|
|
|
/* Cannot use server without advertise */
|
2020-05-14 06:03:56 +02:00
|
|
|
#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL) && !defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
|
|
|
|
#define CONFIG_BT_NIMBLE_ROLE_BROADCASTER
|
|
|
|
#endif
|
2020-08-18 23:02:57 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef _DOXYGEN_
|
|
|
|
/** @brief Uncomment to see debug log messages from the NimBLE host \n
|
|
|
|
* Uses approx. 32kB of flash memory.
|
|
|
|
*/
|
|
|
|
#define CONFIG_BT_NIMBLE_DEBUG
|
|
|
|
|
|
|
|
/** @brief Uncomment to see NimBLE host return codes as text debug log messages. \n
|
|
|
|
* Uses approx. 7kB of flash memory.
|
|
|
|
*/
|
|
|
|
#define CONFIG_NIMBLE_CPP_ENABLE_RETURN_CODE_TEXT
|
|
|
|
|
|
|
|
/** @brief Uncomment to see GAP event codes as text in debug log messages. \n
|
|
|
|
* Uses approx. 1kB of flash memory.
|
|
|
|
*/
|
|
|
|
#define CONFIG_NIMBLE_CPP_ENABLE_GAP_EVENT_CODE_TEXT
|
|
|
|
|
|
|
|
/** @brief Uncomment to see advertisment types as text while scanning in debug log messages. \n
|
|
|
|
* Uses approx. 250 bytes of flash memory.
|
|
|
|
*/
|
|
|
|
#define CONFIG_NIMBLE_CPP_ENABLE_ADVERTISMENT_TYPE_TEXT
|
|
|
|
#endif // _DOXYGEN_
|