#
# Copyright (c) 2018 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

CONFIG_GPIO=y

CONFIG_HEAP_MEM_POOL_SIZE=8192

CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="SMP_DFU"
CONFIG_BT_DEVICE_APPEARANCE=833
CONFIG_BT_MAX_CONN=1
CONFIG_BT_MAX_PAIRED=1
CONFIG_BT_ID_MAX=1


CONFIG_BT_AUTO_DATA_LEN_UPDATE=y
# CONFIG_BT_USER_DATA_LEN_UPDATE=y
# CONFIG_BT_AUTO_PHY_UPDATE=y
CONFIG_BT_USER_PHY_UPDATE=y
# CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=y
# CONFIG_BT_PERIPHERAL_PREF_MIN_INT=8
# CONFIG_BT_PERIPHERAL_PREF_MAX_INT=15
# CONFIG_BT_PERIPHERAL_PREF_TIMEOUT=200


CONFIG_BT_GATT_CLIENT=y
CONFIG_BT_ATT_PREPARE_COUNT=2
CONFIG_BT_CONN_TX_MAX=3
CONFIG_BT_L2CAP_TX_BUF_COUNT=3
CONFIG_BT_L2CAP_TX_MTU=247
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_RX_BUFFERS=5
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251

# Open the following config for NCS v1.5.x or earlier
# CONFIG_BT_RX_BUF_LEN=255
# CONFIG_BT_ATT_TX_MAX=3
# CONFIG_BT_L2CAP_RX_MTU=247
# CONFIG_BT_CTLR_TX_BUFFERS=3
# CONFIG_BT_CTLR_TX_BUFFER_SIZE=251

# Open the following config for NCS v1.6.x or newer
CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_BUF_ACL_TX_COUNT=10
CONFIG_BT_BUF_ACL_TX_SIZE=251

# Enable the NUS service
CONFIG_BT_NUS=y

# Enable bonding
# CONFIG_BT_SETTINGS=y
# CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
# CONFIG_BT_SETTINGS_CCC_STORE_ON_WRITE=y
# CONFIG_BT_NUS_SECURITY_ENABLED=y
# CONFIG_BT_SMP_ALLOW_UNAUTH_OVERWRITE=y
# # CONFIG_BT_USE_DEBUG_KEYS=y
# # CONFIG_BT_STORE_DEBUG_KEYS=y

CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_NVS=y
CONFIG_SETTINGS=y

# Enable DK LED and Buttons library
CONFIG_DK_LIBRARY=y

# This example requires more workqueue stack
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048

# Config logger
CONFIG_LOG=y
# CONFIG_USE_SEGGER_RTT=y
# CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_BACKEND_UART=y
CONFIG_CONSOLE=y
# CONFIG_RTT_CONSOLE=y
CONFIG_ASSERT=y
CONFIG_ASSERT_LEVEL=2

CONFIG_SERIAL=y
CONFIG_UART_ASYNC_API=y
CONFIG_UART_0_ASYNC=y
CONFIG_NRFX_UARTE0=y
CONFIG_UART_0_NRF_HW_ASYNC=y
CONFIG_UART_0_NRF_HW_ASYNC_TIMER=1

CONFIG_BT_RX_STACK_SIZE=4096

# Open the following config for NCS v1.7.x or earlier
CONFIG_PM_EXTERNAL_FLASH=y
CONFIG_PM_EXTERNAL_FLASH_DEV_NAME="w25q128jv"
CONFIG_PM_EXTERNAL_FLASH_BASE=0x0
CONFIG_PM_EXTERNAL_FLASH_SIZE=0x800000

# Open the following config for NCS v1.7.x
CONFIG_PM_EXTERNAL_FLASH_SUPPORT_LEGACY=y

## secondary slot on external Flash ##
CONFIG_PM_PARTITION_SIZE_SETTINGS_STORAGE=0x4000
#CONFIG_NORDIC_QSPI_NOR=y
#CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
#CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16
CONFIG_SPI=y
CONFIG_SPI_NOR=y
CONFIG_STREAM_FLASH=y
CONFIG_STREAM_FLASH_ERASE=y

CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_MCUMGR=y
CONFIG_MCUMGR_SMP_BT=y
CONFIG_MCUMGR_SMP_BT_AUTHEN=n
CONFIG_MCUMGR_CMD_IMG_MGMT=y
CONFIG_MCUMGR_CMD_OS_MGMT=y
CONFIG_OS_MGMT_TASKSTAT=n
CONFIG_OS_MGMT_ECHO=y
CONFIG_IMG_BLOCK_BUF_SIZE=2048
CONFIG_MCUMGR_BUF_SIZE=256
CONFIG_MCUMGR_BUF_COUNT=4
CONFIG_MGMT_CBORATTR_MAX_SIZE=512

CONFIG_MAIN_STACK_SIZE=2048