#
# Copyright 2023 by Garmin Ltd. or its subsidiaries.
# All rights reserved.
#
# Use of this Software is limited and subject to the License Agreement for ANT SoftDevice
# and Associated Software. The Agreement accompanies the Software in the root directory of
# the repository.
#

CONFIG_ANT=y
# Evaluation key for ANT
# Set this Kconfig to use the evaluation stack for SINGLE CORE builds (for example, nRF52 Series).
# You MUST obtain a valid commercial license key BEFORE releasing a product to market that uses ANT.
# For more information about licensing please see CONFIG_ANT_LICENSE_KEY and visit the website below:
# https://www.thisisant.com/developer/ant/licensing
CONFIG_ANT_EVALUATION_KEY=n

CONFIG_NCS_SAMPLES_DEFAULTS=y
CONFIG_LOG=y

CONFIG_BT=y
CONFIG_BT_SMP=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DIS=y
CONFIG_BT_DIS_PNP=n
CONFIG_BT_HRS=y
CONFIG_BT_DEVICE_NAME="Nordic_HRM"
CONFIG_BT_DEVICE_APPEARANCE=833
CONFIG_BT_MAX_CONN=2

CONFIG_RESET_ON_FATAL_ERROR=n

CONFIG_HEAP_MEM_POOL_SIZE=4096

CONFIG_ANT_EVALUATION_KEY=y


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

# Enable the UART driver
CONFIG_UART_ASYNC_API=y
CONFIG_SERIAL=y

CONFIG_GPIO=y

# Make sure printk is printing to the UART console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_LOG_MODE_IMMEDIATE=y

CONFIG_HEAP_MEM_POOL_SIZE=32768

CONFIG_PICOLIBC=y

CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="COROS DURA 94C5XX"
CONFIG_BT_MAX_PAIRED=4
CONFIG_BT_EXT_ADV=y
CONFIG_BT_KEYS_OVERWRITE_OLDEST=y
CONFIG_BT_USER_PHY_UPDATE=y
CONFIG_BT_USER_DATA_LEN_UPDATE=y

CONFIG_BT_BUF_ACL_RX_SIZE=502
CONFIG_BT_ATT_PREPARE_COUNT=20
CONFIG_BT_ATT_TX_COUNT=12
CONFIG_BT_L2CAP_TX_MTU=498
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
CONFIG_BT_CONN_TX_MAX=12
CONFIG_BT_BUF_ACL_TX_COUNT=12
CONFIG_BT_BUF_ACL_TX_SIZE=502
CONFIG_BT_CTLR_SDC_PERIPHERAL_COUNT=4
CONFIG_BT_BUF_EVT_RX_COUNT=16

CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_PHY_CODED=y
CONFIG_BT_CTLR_SDC_MAX_CONN_EVENT_LEN_DEFAULT=4000000

# Bluetooth dependent configuration required by FMN
CONFIG_BT_RX_STACK_SIZE=3072

# Enable the NUS service
CONFIG_BT_ZEPHYR_NUS=n

# Enable the DIS service
CONFIG_BT_DIS=y
CONFIG_BT_DIS_SERIAL_NUMBER=y
CONFIG_BT_DIS_HW_REV=y
CONFIG_BT_DIS_SW_REV=y
CONFIG_BT_DIS_PNP=n
CONFIG_BT_DIS_SETTINGS=y
CONFIG_BT_DIS_FW_REV=y
CONFIG_SETTINGS_RUNTIME=y
CONFIG_BT_DIS_MANUF="COROS"
CONFIG_BT_ID_MAX=3
CONFIG_BT_EXT_ADV_MAX_ADV_SET=2
CONFIG_BT_DEVICE_NAME_GATT_WRITABLE=n

CONFIG_BT_DEVICE_NAME_DYNAMIC=y
CONFIG_BT_L2CAP_TX_MTU=247
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_PERIPHERAL_PREF_TIMEOUT=400
CONFIG_BT_CTLR_FAL_SIZE=32
# 833


# Enable bonding
CONFIG_BT_SETTINGS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y

# Enable DK LED and Buttons library
CONFIG_DK_LIBRARY=n

# This example requires more stack
CONFIG_MAIN_STACK_SIZE=4096
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
CONFIG_ANT_WORK_STACK_SIZE=4096

# Config logger - enable USB console output
CONFIG_LOG=y
CONFIG_LOG_BACKEND_UART=y
CONFIG_LOG_PRINTK=y
CONFIG_USE_SEGGER_RTT=n
CONFIG_LOG_BACKEND_RTT=n

CONFIG_ASSERT=y

# FMN configuration
# CONFIG_FMNA=y
# CONFIG_FMNA_NORDIC_PRODUCT_PLAN=y
# CONFIG_FMNA_LOG_LEVEL_DBG=y
# CONFIG_FMNA_LOG_MFI_AUTH_TOKEN_BASE64_FULL=y

# # FMN configuration
# CONFIG_FMNA_CAPABILITY_PLAY_SOUND_ENABLED=y
# CONFIG_FMNA_CAPABILITY_BLE_SN_LOOKUP_ENABLED=y
# CONFIG_FMNA_SERVICE_HIDDEN_MODE=y
# CONFIG_FMNA_NORDIC_PRODUCT_PLAN=n
# CONFIG_FMNA_PAIRING_MODE_TIMEOUT=0
# CONFIG_FMNA_PAIRING_MODE_AUTO_ENTER=n

# # Set FMN Firmware version
# CONFIG_FMNA_FIRMWARE_VERSION_MAJOR=1
# CONFIG_FMNA_FIRMWARE_VERSION_MINOR=0
# CONFIG_FMNA_FIRMWARE_VERSION_REVISION=0

# ANT+
CONFIG_ANT=y
CONFIG_ANT_BPWR=y

CONFIG_ANT_EVALUATION_KEY=n

# coros key
CONFIG_ANT_LICENSE_KEY="9734-7686-8c22-06b2-4782-582d-4645-f530"
#ble scan
CONFIG_BT_BROADCASTER=y
CONFIG_BT_OBSERVER=y
CONFIG_BT_DEVICE_APPEARANCE_DYNAMIC=y
CONFIG_BT_FILTER_ACCEPT_LIST=y
CONFIG_BT_DATA_LEN_UPDATE=y
CONFIG_BT_BUF_CMD_TX_COUNT=10
# CONFIG_BT_DEVICE_APPEARANCE=833

CONFIG_SPI=y
CONFIG_SPI_SLAVE=y
CONFIG_SPI_ASYNC=y
CONFIG_NRFX_SPIS=y



CONFIG_REBOOT=y
CONFIG_SYS_HEAP_RUNTIME_STATS=y
CONFIG_BT_CENTRAL=y
CONFIG_BT_MAX_CONN=10
CONFIG_BT_GATT_CLIENT=y
CONFIG_BT_HCI_ERR_TO_STR=y

CONFIG_PM_DEVICE=n
CONFIG_PM_DEVICE_RUNTIME=n

CONFIG_SPI_NOR=n
CONFIG_FLASH_BASE_ADDRESS=0x0

CONFIG_MPSL=y
CONFIG_MPSL_CX=y
CONFIG_MPSL_CX_3WIRE=y

CONFIG_BT_CTLR_CONN_RSSI=y
# ancs
CONFIG_BT_ANCS_CLIENT=y
CONFIG_BT_GATT_DM=y
CONFIG_BT_ANCS_CLIENT=y
CONFIG_BT_GATTP=y
CONFIG_BT_AMS_CLIENT=y

# 2. Speed optimization (alternative: Release -> -O3)
# CONFIG_SPEED_OPTIMIZATIONS=y

# 3. No optimization (Debug -> -g)
# CONFIG_NO_OPTIMIZATIONS=y

# 4. Balanced optimization (RelWithDebInfo -> -O2 -g)
# CONFIG_DEBUG_OPTIMIZATIONS=y

# CONFIG_THREAD_ANALYZER=y
# CONFIG_THREAD_ANALYZER_USE_PRINTK=y   # 想自己处理就不用 AUTO
# CONFIG_THREAD_NAME=y
CONFIG_SETTINGS_LOG_LEVEL_DBG=y
# CONFIG_BT_GATT_LOG_LEVEL_DBG=y
# Configure HW stack protection
CONFIG_HW_STACK_PROTECTION=y

CONFIG_DYNAMIC_THREAD=y
CONFIG_DYNAMIC_THREAD_ALLOC=y

