Working BT settings.
This commit is contained in:
parent
0321c490b5
commit
6701b7babc
5 changed files with 42 additions and 25 deletions
22
app/Kconfig
22
app/Kconfig
|
@ -40,6 +40,8 @@ menuconfig ZMK_BLE
|
||||||
select BT_PERIPHERAL
|
select BT_PERIPHERAL
|
||||||
select BT_GATT_DIS
|
select BT_GATT_DIS
|
||||||
select BT_GATT_BAS
|
select BT_GATT_BAS
|
||||||
|
select SETTINGS
|
||||||
|
select BT_SETTINGS
|
||||||
|
|
||||||
if ZMK_BLE
|
if ZMK_BLE
|
||||||
|
|
||||||
|
@ -47,6 +49,9 @@ config ZMK_BLE_INIT_PRIORITY
|
||||||
int "Init Priority"
|
int "Init Priority"
|
||||||
default 50
|
default 50
|
||||||
|
|
||||||
|
config SYSTEM_WORKQUEUE_STACK_SIZE
|
||||||
|
default 2048
|
||||||
|
|
||||||
# HID GATT notifications sent this way are *not* picked up by Linux, and possibly others.
|
# HID GATT notifications sent this way are *not* picked up by Linux, and possibly others.
|
||||||
config BT_GATT_NOTIFY_MULTIPLE
|
config BT_GATT_NOTIFY_MULTIPLE
|
||||||
default n
|
default n
|
||||||
|
@ -58,16 +63,6 @@ config ZMK_BLE_PASSKEY_ENTRY
|
||||||
bool "Experimental: Requiring typing passkey from host to pair BLE connection"
|
bool "Experimental: Requiring typing passkey from host to pair BLE connection"
|
||||||
default n
|
default n
|
||||||
|
|
||||||
# Incresed stack due to settings API usage
|
|
||||||
# CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
|
|
||||||
#
|
|
||||||
# CONFIG_BT_SETTINGS=y
|
|
||||||
# CONFIG_FLASH=y
|
|
||||||
# CONFIG_FLASH_PAGE_LAYOUT=y
|
|
||||||
# CONFIG_FLASH_MAP=y
|
|
||||||
# CONFIG_NVS=y
|
|
||||||
# CONFIG_SETTINGS=y
|
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
@ -97,6 +92,13 @@ config ZMK_SPLIT_BLE_ROLE_CENTRAL
|
||||||
select BT_CENTRAL
|
select BT_CENTRAL
|
||||||
select BT_GATT_CLIENT
|
select BT_GATT_CLIENT
|
||||||
|
|
||||||
|
if ZMK_SPLIT_BLE_ROLE_CENTRAL
|
||||||
|
|
||||||
|
config BT_MAX_CONN
|
||||||
|
default 2
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
config ZMK_SPLIT_BLE_ROLE_PERIPHERAL
|
config ZMK_SPLIT_BLE_ROLE_PERIPHERAL
|
||||||
bool "Peripheral"
|
bool "Peripheral"
|
||||||
|
|
||||||
|
|
|
@ -11,3 +11,10 @@ CONFIG_ARM_MPU=y
|
||||||
CONFIG_GPIO=y
|
CONFIG_GPIO=y
|
||||||
|
|
||||||
CONFIG_USE_DT_CODE_PARTITION=y
|
CONFIG_USE_DT_CODE_PARTITION=y
|
||||||
|
|
||||||
|
CONFIG_MPU_ALLOW_FLASH_WRITE=y
|
||||||
|
CONFIG_NVS=y
|
||||||
|
CONFIG_SETTINGS_NVS=y
|
||||||
|
CONFIG_FLASH=y
|
||||||
|
CONFIG_FLASH_PAGE_LAYOUT=y
|
||||||
|
CONFIG_FLASH_MAP=y
|
|
@ -1,8 +1,20 @@
|
||||||
|
|
||||||
if SHIELD_KYRIA_LEFT || SHIELD_KYRIA_RIGHT
|
if SHIELD_KYRIA_LEFT
|
||||||
|
|
||||||
config ZMK_KEYBOARD_NAME
|
config ZMK_KEYBOARD_NAME
|
||||||
default "Kyria"
|
default "Kyria Left"
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
if SHIELD_KYRIA_RIGHT
|
||||||
|
|
||||||
|
config ZMK_KEYBOARD_NAME
|
||||||
|
default "Kyria Right"
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
if SHIELD_KYRIA_LEFT || SHIELD_KYRIA_RIGHT
|
||||||
|
|
||||||
config ZMK_SPLIT
|
config ZMK_SPLIT
|
||||||
default y
|
default y
|
||||||
|
|
|
@ -128,8 +128,11 @@ static struct bt_conn_auth_cb zmk_ble_auth_cb_display = {
|
||||||
static const struct bt_data zmk_ble_ad[] = {
|
static const struct bt_data zmk_ble_ad[] = {
|
||||||
BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)),
|
BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)),
|
||||||
BT_DATA_BYTES(BT_DATA_UUID16_SOME,
|
BT_DATA_BYTES(BT_DATA_UUID16_SOME,
|
||||||
|
#if !IS_ENABLED(CONFIG_ZMK_SPLIT_BLE)
|
||||||
0x12, 0x18, /* HID Service */
|
0x12, 0x18, /* HID Service */
|
||||||
0x0f, 0x18), /* Battery Service */
|
#endif
|
||||||
|
0x0f, 0x18 /* Battery Service */
|
||||||
|
),
|
||||||
#if IS_ENABLED(CONFIG_ZMK_SPLIT_BLE)
|
#if IS_ENABLED(CONFIG_ZMK_SPLIT_BLE)
|
||||||
BT_DATA_BYTES(BT_DATA_UUID128_ALL,
|
BT_DATA_BYTES(BT_DATA_UUID128_ALL,
|
||||||
ZMK_SPLIT_BT_SERVICE_UUID)
|
ZMK_SPLIT_BT_SERVICE_UUID)
|
||||||
|
@ -155,10 +158,6 @@ static void zmk_ble_ready(int err)
|
||||||
|
|
||||||
static int zmk_ble_init(struct device *_arg)
|
static int zmk_ble_init(struct device *_arg)
|
||||||
{
|
{
|
||||||
if (IS_ENABLED(CONFIG_SETTINGS))
|
|
||||||
{
|
|
||||||
settings_load();
|
|
||||||
}
|
|
||||||
int err = bt_enable(NULL);
|
int err = bt_enable(NULL);
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
|
@ -167,6 +166,11 @@ static int zmk_ble_init(struct device *_arg)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IS_ENABLED(CONFIG_BT_SETTINGS))
|
||||||
|
{
|
||||||
|
settings_load();
|
||||||
|
}
|
||||||
|
|
||||||
bt_conn_cb_register(&conn_callbacks);
|
bt_conn_cb_register(&conn_callbacks);
|
||||||
bt_conn_auth_cb_register(&zmk_ble_auth_cb_display);
|
bt_conn_auth_cb_register(&zmk_ble_auth_cb_display);
|
||||||
|
|
||||||
|
|
|
@ -16,10 +16,6 @@ LOG_MODULE_REGISTER(zmk, CONFIG_ZMK_LOG_LEVEL);
|
||||||
#include <zmk/kscan.h>
|
#include <zmk/kscan.h>
|
||||||
#include <zmk/endpoints.h>
|
#include <zmk/endpoints.h>
|
||||||
|
|
||||||
#ifdef CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL
|
|
||||||
#include <zmk/split/bluetooth/central.h>
|
|
||||||
#endif /* CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL */
|
|
||||||
|
|
||||||
#define ZMK_KSCAN_DEV DT_LABEL(ZMK_MATRIX_NODE_ID)
|
#define ZMK_KSCAN_DEV DT_LABEL(ZMK_MATRIX_NODE_ID)
|
||||||
|
|
||||||
void main(void)
|
void main(void)
|
||||||
|
@ -30,8 +26,4 @@ void main(void)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_SETTINGS
|
|
||||||
settings_load();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue