Skip to content

Commit 917134f

Browse files
ble: support only legacy adv and slave function on esp32c2
1 parent 14bf30d commit 917134f

File tree

4 files changed

+68
-3
lines changed

4 files changed

+68
-3
lines changed

components/bt/controller/esp32c2/Kconfig.in

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ config BT_LE_USE_ESP_TIMER
450450

451451
config BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_SUPP
452452
bool "BLE adv report flow control supported"
453+
depends on BT_LE_ROLE_OBSERVER_ENABLE
453454
default y
454455
help
455456
The function is mainly used to enable flow control for advertising reports. When it is enabled,
@@ -498,3 +499,31 @@ config BT_LE_CCA_RSSI_THRESH
498499
default 20
499500
help
500501
Power threshold of CCA in unit of -1 dBm.
502+
503+
config BT_LE_ROLE_CENTROL_ENABLE
504+
bool "Enable BLE Centrol role function"
505+
depends on !BT_NIMBLE_ENABLED
506+
default y
507+
help
508+
Enable centrol role function.
509+
510+
config BT_LE_ROLE_PERIPHERAL_ENABLE
511+
bool "Enable BLE Peripheral role function"
512+
depends on !BT_NIMBLE_ENABLED
513+
default y
514+
help
515+
Enable Peripheral role function.
516+
517+
config BT_LE_ROLE_BROADCASTER_ENABLE
518+
bool "Enable BLE Broadcaster role function"
519+
depends on !BT_NIMBLE_ENABLED
520+
default y
521+
help
522+
Enable broadcaster role function.
523+
524+
config BT_LE_ROLE_OBSERVER_ENABLE
525+
bool "Enable BLE Observer role function"
526+
depends on !BT_NIMBLE_ENABLED
527+
default y
528+
help
529+
Enable observer role function.

components/bt/controller/esp32c2/bt.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,15 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
652652
return ret;
653653
}
654654

655+
#if DEFAULT_BT_LE_50_FEATURE_SUPPORT || DEFAULT_BT_LE_ROLE_CENTROL || DEFAULT_BT_LE_ROLE_OBSERVER
656+
extern int esp_ble_rom_func_ptr_init_all(void);
657+
esp_ble_rom_func_ptr_init_all();
658+
#else
659+
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "Init only legacy adv and slave function");
660+
extern int esp_ble_rom_func_ptr_init_legacy_adv_and_slave(void);
661+
esp_ble_rom_func_ptr_init_legacy_adv_and_slave();
662+
#endif
663+
655664
/* Initialize the function pointers for OS porting */
656665
npl_freertos_funcs_init();
657666
struct npl_funcs_t *p_npl_funcs = npl_freertos_funcs_get();

components/bt/controller/esp32c2/esp_bt_cfg.h

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ extern "C" {
4646
#define DEFAULT_BT_LE_50_FEATURE_SUPPORT (0)
4747
#endif
4848

49+
#define DEFAULT_BT_LE_ROLE_OBSERVER MYNEWT_VAL(BLE_ROLE_OBSERVER)
50+
#define DEFAULT_BT_LE_ROLE_CENTROL MYNEWT_VAL(BLE_ROLE_CENTRAL)
51+
#define DEFAULT_BT_LE_ROLE_PERIPHERAL MYNEWT_VAL(BLE_ROLE_PERIPHERAL)
52+
#define DEFAULT_BT_LE_ROLE_BROADCASTER MYNEWT_VAL(BLE_ROLE_BROADCASTER)
4953
#else
5054

5155
#if CONFIG_BT_LE_LL_CFG_FEAT_LE_CODED_PHY
@@ -57,13 +61,13 @@ extern "C" {
5761
#if defined(CONFIG_BT_LE_MAX_PERIODIC_ADVERTISER_LIST)
5862
#define DEFAULT_BT_LE_MAX_PERIODIC_ADVERTISER_LIST (CONFIG_BT_LE_MAX_PERIODIC_ADVERTISER_LIST)
5963
#else
60-
#define DEFAULT_BT_LE_MAX_PERIODIC_ADVERTISER_LIST (5)
64+
#define DEFAULT_BT_LE_MAX_PERIODIC_ADVERTISER_LIST (0)
6165
#endif
6266

6367
#if defined(CONFIG_BT_LE_MAX_PERIODIC_SYNCS)
6468
#define DEFAULT_BT_LE_MAX_PERIODIC_SYNCS (CONFIG_BT_LE_MAX_PERIODIC_SYNCS)
6569
#else
66-
#define DEFAULT_BT_LE_MAX_PERIODIC_SYNCS (1)
70+
#define DEFAULT_BT_LE_MAX_PERIODIC_SYNCS (0)
6771
#endif
6872

6973
#if defined(CONFIG_BT_LE_MAX_CONNECTIONS)
@@ -125,6 +129,29 @@ extern "C" {
125129
#define DEFAULT_BT_LE_50_FEATURE_SUPPORT (0)
126130
#endif
127131

132+
#if defined(CONFIG_BT_LE_ROLE_CENTROL_ENABLE)
133+
#define DEFAULT_BT_LE_ROLE_CENTROL (1)
134+
#else
135+
#define DEFAULT_BT_LE_ROLE_CENTROL (0)
136+
#endif
137+
138+
#if defined(CONFIG_BT_LE_ROLE_PERIPHERAL_ENABLE)
139+
#define DEFAULT_BT_LE_ROLE_PERIPHERAL (1)
140+
#else
141+
#define DEFAULT_BT_LE_ROLE_PERIPHERAL (0)
142+
#endif
143+
144+
#if defined(CONFIG_BT_LE_ROLE_BROADCASTER_ENABLE)
145+
#define DEFAULT_BT_LE_ROLE_BROADCASTER (1)
146+
#else
147+
#define DEFAULT_BT_LE_ROLE_BROADCASTER (0)
148+
#endif
149+
150+
#if defined(CONFIG_BT_LE_ROLE_OBSERVER_ENABLE)
151+
#define DEFAULT_BT_LE_ROLE_OBSERVER (1)
152+
#else
153+
#define DEFAULT_BT_LE_ROLE_OBSERVER (0)
154+
#endif
128155
#endif
129156

130157
#define DEFAULT_BT_LE_COEX_PHY_CODED_TX_RX_TLIM_EFF CONFIG_BT_LE_COEX_PHY_CODED_TX_RX_TLIM_EFF

0 commit comments

Comments
 (0)