Skip to content

Commit 0d0b221

Browse files
rakonsjhedberg
authored andcommitted
samples: bluetooth: peripheral_hids: Add settings module
This commit adds settings module to the peripheral_hids that makes bonding persistent. Now it is possible to connect with previously bonded device. Fixes #9580 Signed-off-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
1 parent 1d4e089 commit 0d0b221

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
1+
# Incresed stack due to settings API usage
2+
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
3+
14
CONFIG_BT=y
25
CONFIG_BT_DEBUG_LOG=y
36
CONFIG_BT_SMP=y
47
CONFIG_BT_PERIPHERAL=y
58
CONFIG_BT_DEVICE_NAME="Test HoG mouse"
69
CONFIG_BT_DEVICE_APPEARANCE=962
10+
11+
CONFIG_BT_SETTINGS=y
12+
CONFIG_FLASH=y
13+
CONFIG_FLASH_PAGE_LAYOUT=y
14+
CONFIG_FLASH_MAP=y
15+
CONFIG_FCB=y
16+
CONFIG_SETTINGS=y
17+
CONFIG_SETTINGS_FCB=y

samples/bluetooth/peripheral_hids/src/main.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#include <misc/byteorder.h>
1515
#include <zephyr.h>
1616

17+
#include <settings/settings.h>
18+
1719
#include <bluetooth/bluetooth.h>
1820
#include <bluetooth/hci.h>
1921
#include <bluetooth/conn.h>
@@ -86,6 +88,10 @@ static void bt_ready(int err)
8688
dis_init(CONFIG_SOC, "Manufacturer");
8789
hog_init();
8890

91+
if (IS_ENABLED(CONFIG_SETTINGS)) {
92+
settings_load();
93+
}
94+
8995
err = bt_le_adv_start(BT_LE_ADV_CONN_NAME, ad, ARRAY_SIZE(ad), NULL, 0);
9096
if (err) {
9197
printk("Advertising failed to start (err %d)\n", err);

0 commit comments

Comments
 (0)