Skip to content

Commit

Permalink
silabs: drivers: bluetooth: Conditional compiling of optional components
Browse files Browse the repository at this point in the history
Conditionally compile in controller features based on what features
have been enabled in Kconfig

This commit allow saving in flash size. Over 10k in peripheral_hr
and central_hr. In observer and broadcaster about 20k

Signed-off-by: Petri Pitkanen <[email protected]>
  • Loading branch information
petrip-slab authored and fabiobaltieri committed Dec 17, 2024
1 parent 65a603f commit 0709478
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions drivers/bluetooth/hci/hci_silabs_efr32.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,25 @@ static int slz_bt_open(const struct device *dev, bt_hci_recv_t recv)
goto deinit;
}

sl_btctrl_init_adv();
sl_btctrl_init_scan();
sl_btctrl_init_conn();
if (IS_ENABLED(CONFIG_BT_BROADCASTER) || IS_ENABLED(CONFIG_BT_PERIPHERAL)) {
sl_btctrl_init_adv();
}
if (IS_ENABLED(CONFIG_BT_CENTRAL) || IS_ENABLED(CONFIG_BT_OBSERVER)) {
sl_btctrl_init_scan();
}
if (IS_ENABLED(CONFIG_BT_CONN)) {
sl_btctrl_init_conn();
}
sl_btctrl_init_phy();
sl_btctrl_init_adv_ext();
sl_btctrl_init_scan_ext();

if (IS_ENABLED(CONFIG_BT_EXT_ADV)) {
if (IS_ENABLED(CONFIG_BT_BROADCASTER) || IS_ENABLED(CONFIG_BT_PERIPHERAL)) {
sl_btctrl_init_adv_ext();
}
if (IS_ENABLED(CONFIG_BT_CENTRAL) || IS_ENABLED(CONFIG_BT_OBSERVER)) {
sl_btctrl_init_scan_ext();
}
}

ret = sl_btctrl_init_basic(SL_BT_CONFIG_MAX_CONNECTIONS,
SL_BT_CONFIG_USER_ADVERTISERS,
Expand All @@ -207,8 +220,12 @@ static int slz_bt_open(const struct device *dev, bt_hci_recv_t recv)

sl_bthci_init_upper();
sl_btctrl_hci_parser_init_default();
sl_btctrl_hci_parser_init_conn();
sl_btctrl_hci_parser_init_adv();
if (IS_ENABLED(CONFIG_BT_CONN)) {
sl_btctrl_hci_parser_init_conn();
}
if (IS_ENABLED(CONFIG_BT_BROADCASTER) || IS_ENABLED(CONFIG_BT_PERIPHERAL)) {
sl_btctrl_hci_parser_init_adv();
}
sl_btctrl_hci_parser_init_phy();

#ifdef CONFIG_PM
Expand Down

0 comments on commit 0709478

Please sign in to comment.