CONFIG_NCS_SAMPLES_DEFAULTS=y

# General Debugging and Logging
CONFIG_LOG=y
CONFIG_LOG_BACKEND_UART=y
CONFIG_LOG_PRINTK=y
CONFIG_CBPRINTF_FP_SUPPORT=y
CONFIG_CONSOLE=n
CONFIG_PRINTK=y
CONFIG_SHELL=y
CONFIG_SHELL_LOG_BACKEND=y
CONFIG_SHELL_CMD_BUFF_SIZE=1024
CONFIG_USE_SEGGER_RTT=y
CONFIG_LOG_BACKEND_RTT=y
CONFIG_RTT_CONSOLE=n
CONFIG_UART_CONSOLE=y
CONFIG_SEGGER_RTT_BUFFER_SIZE_UP=4096
CONFIG_SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL=n
CONFIG_LOG_PROCESS_THREAD_STACK_SIZE=2048
CONFIG_LOG_BLOCK_IN_THREAD=y
CONFIG_LOG_BUFFER_SIZE=4096
CONFIG_DEBUG=n
CONFIG_DEBUG_INFO=n
CONFIG_DEBUG_THREAD_INFO=n
CONFIG_BOOT_BANNER=y
CONFIG_SERIAL=y
CONFIG_NVS_LOG_LEVEL_DBG=y
CONFIG_LOG_BACKEND_UART_BUFFER_SIZE=4096
CONFIG_LOG_DEFAULT_LEVEL=3
CONFIG_LOG_MODE_IMMEDIATE=n
CONFIG_LOG_MODE_DEFERRED=y
CONFIG_DEBUG_OPTIMIZATIONS=n
CONFIG_MCUBOOT_UTIL_LOG_LEVEL_WRN=y
CONFIG_SHELL_BT_NUS_LOG_LEVEL_DBG=y
CONFIG_MCUMGR_TRANSPORT_UART=y

# Peripheral and Sensor Drivers
CONFIG_I2C=y
CONFIG_SPI=y
CONFIG_SPI_NOR=y
CONFIG_NORDIC_QSPI_NOR=y
CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
# CONFIG_ADC=y
CONFIG_SENSOR=y
# TMP116 is disabled (enable if in device tree)
# CONFIG_TMP116=y
CONFIG_BMI270=y
CONFIG_WDT_LOG_LEVEL_DBG=y
CONFIG_BMI270_TRIGGER_GLOBAL_THREAD=y
CONFIG_WATCHDOG=y
CONFIG_TASK_WDT=y
CONFIG_TASK_WDT_MIN_TIMEOUT=1000
CONFIG_WDT_LOG_LEVEL_ERR=y
CONFIG_WDT_DISABLE_AT_BOOT=n
CONFIG_LED=y
CONFIG_REGULATOR=y
CONFIG_MFD_NPM1300=y
CONFIG_PM_DEVICE=n
CONFIG_PM_DEVICE_RUNTIME=n
CONFIG_SYS_CLOCK_EXISTS=y
CONFIG_PM=y
CONFIG_POWEROFF=y
CONFIG_NRF_FUEL_GAUGE=y
CONFIG_TASK_WDT=y

# Enable nrfx drivers
CONFIG_NRFX_SAADC=y
CONFIG_NRFX_PPI=y
CONFIG_NRFX_DPPI=y

CONFIG_NRFX_TIMER3=y
CONFIG_NRFX_TIMER4=y

CONFIG_NRFX_PWM0=y
CONFIG_NRFX_PWM1=y
CONFIG_NRFX_PWM2=y
CONFIG_NRFX_PWM3=y
CONFIG_NRF52_ANOMALY_109_WORKAROUND=n
# CONFIG_NRFX_QSPI=y
# CONFIG_NRFX_QSPI_LOG=y

# Memory Optimizations
CONFIG_MAIN_STACK_SIZE=4096
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
CONFIG_HEAP_MEM_POOL_SIZE=8192
CONFIG_ASSERT=n
CONFIG_THREAD_ANALYZER=n
CONFIG_SIZE_OPTIMIZATIONS=y
CONFIG_EVENTS=y
CONFIG_PM_SINGLE_IMAGE=n
CONFIG_RESET_ON_FATAL_ERROR=y

# Flash and Filesystem
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y
CONFIG_FLASH_JESD216_API=y
CONFIG_SPI_NOR_IDLE_IN_DPD=n
CONFIG_NVS=y
CONFIG_IMG_MANAGER=y
CONFIG_IMG_ERASE_PROGRESSIVELY=y
CONFIG_SETTINGS_NVS_SECTOR_COUNT=4

# Enable Bluetooth settings
CONFIG_BT_SETTINGS=y

# Enable settings subsystem
CONFIG_SETTINGS=y

# Enable Bluetooth and controller settings
CONFIG_BT=y
CONFIG_BT_CTLR_TX_PWR_PLUS_4=y
CONFIG_BT_HCI=y
CONFIG_BT_CTLR=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_BROADCASTER=n
CONFIG_BT_SMP=y
CONFIG_BT_BONDABLE=y
CONFIG_BT_CTLR_ADV_EXT=n
CONFIG_BT_DEVICE_APPEARANCE=1345
CONFIG_BT_DEVICE_NAME_DYNAMIC=y
CONFIG_BT_GATT_CLIENT=y
CONFIG_BT_FILTER_ACCEPT_LIST=y
CONFIG_BT_SIGNING=y

# Bluetooth security and bonding settings
CONFIG_BT_KEYS_OVERWRITE_OLDEST=y
CONFIG_BT_SMP_ALLOW_UNAUTH_OVERWRITE=y
CONFIG_BT_ID_UNPAIR_MATCHING_BONDS=y
CONFIG_BT_PRIVACY=n
CONFIG_BT_TINYCRYPT_ECC=y
CONFIG_BT_CTLR_PHY_2M=y

# Bluetooth buffer and connection settings
CONFIG_BT_BUF_ACL_RX_SIZE=502
CONFIG_BT_ATT_PREPARE_COUNT=2
CONFIG_BT_BUF_ACL_TX_SIZE=502
CONFIG_BT_BUF_ACL_TX_COUNT=10
CONFIG_BT_L2CAP_TX_MTU=247
CONFIG_BT_L2CAP_TX_BUF_COUNT=10
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_CTLR_RX_BUFFERS=2
CONFIG_BT_CONN_TX_MAX=10
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n
CONFIG_BT_HCI_VS_EXT=n
CONFIG_BT_GATT_DM=y

# Allow only LESC pairing
CONFIG_BT_SMP_SC_PAIR_ONLY=y

# Configure Bluetooth connection settings
CONFIG_BT_CTLR_TX_PWR_0=y
CONFIG_BT_MAX_CONN=1
CONFIG_BT_MAX_PAIRED=1

# Enable PHY updates
CONFIG_BT_USER_PHY_UPDATE=y
CONFIG_BT_USER_DATA_LEN_UPDATE=y

# Enable Bluetooth shell for debugging
CONFIG_BT_SHELL=n
CONFIG_SHELL_BACKEND_SERIAL=y

# Enable BT NUS (Nordic UART Service) shell for testing
CONFIG_SHELL_BT_NUS=y

# Enable Battery Service (BAS) for battery level reporting
CONFIG_BT_BAS=y

# Cryptography
CONFIG_TINYCRYPT=y
CONFIG_BT_TINYCRYPT_ECC=y

# MCUboot + FOTA
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y
CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU_SPEEDUP=y
CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y

# Enable the Bluetooth mcumgr transport (unauthenticated).
CONFIG_MCUMGR_TRANSPORT_BT=y
CONFIG_MCUMGR_TRANSPORT_BT_AUTHEN=n
CONFIG_MCUMGR_TRANSPORT_BT_CONN_PARAM_CONTROL=y

# Enable the mcumgr Packet Reassembly feature over Bluetooth and its configuration dependencies.
# MCUmgr buffer size is optimized to fit one SMP packet divided into five Bluetooth Write Commands,
# transmitted with the maximum possible MTU value: 498 bytes.
CONFIG_MCUMGR_TRANSPORT_BT_REASSEMBLY=y
CONFIG_MCUMGR_TRANSPORT_NETBUF_SIZE=2475
CONFIG_MCUMGR_GRP_OS_MCUMGR_PARAMS=y
CONFIG_MCUMGR_TRANSPORT_WORKQUEUE_STACK_SIZE=4608

# Enable the storage erase command.
CONFIG_MCUMGR_GRP_ZBASIC=y
CONFIG_MCUMGR_GRP_ZBASIC_STORAGE_ERASE=y

# Disable the Flash Patch and Breakpoint unit for secure production
CONFIG_DISABLE_FLASH_PATCH=y

# Use internal RC oscillator instead of external 32.768 kHz crystal
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y

# Reboot and Miscellaneous
CONFIG_REBOOT=y
CONFIG_BOOT_DELAY=0

# Enable MCUmgr and dependencies.
CONFIG_NET_BUF=y
CONFIG_ZCBOR=y
CONFIG_CRC=y
CONFIG_MCUMGR=y
CONFIG_STREAM_FLASH=y
CONFIG_FLASH_MAP=y

# Required by the `taskstat` command.
CONFIG_THREAD_MONITOR=y

# Support for taskstat command
CONFIG_MCUMGR_GRP_OS_TASKSTAT=y

# Enable statistics and statistic names.
CONFIG_STATS=y
CONFIG_STATS_NAMES=y
CONFIG_STATS_SHELL=y

# Enable most core commands.
CONFIG_MCUMGR_GRP_IMG=y
CONFIG_MCUMGR_GRP_OS=y
CONFIG_MCUMGR_GRP_STAT=y

# Disable debug logging
CONFIG_LOG_MAX_LEVEL=3

# Enable the shell MCUmgr transport.
CONFIG_BASE64=y
CONFIG_MCUMGR_TRANSPORT_SHELL=y

# Enable shell commands for MCUmgr
CONFIG_MCUMGR_GRP_SHELL=y
CONFIG_UART_CONSOLE_MCUMGR=y
CONFIG_SHELL_BACKEND_DUMMY_BUF_SIZE=4096
CONFIG_SHELL_HISTORY=y
CONFIG_SHELL_TAB=y
CONFIG_SHELL_TAB_AUTOCOMPLETION=y

# Enable shell commands
CONFIG_SHELL_CMDS=y
CONFIG_CLOCK_CONTROL_NRF_SHELL=y
CONFIG_DEVICE_SHELL=y
CONFIG_DEVMEM_SHELL=y
CONFIG_FLASH_SHELL=y
CONFIG_MCUBOOT_SHELL=y
CONFIG_SENSOR_SHELL=y
CONFIG_GPIO_SHELL=y
CONFIG_I2C_SHELL=y

# Enable the settings access hook for mcumgr.
CONFIG_MCUMGR_MGMT_NOTIFICATION_HOOKS=y
CONFIG_SHELL_BACKEND_DUMMY=y
CONFIG_MCUMGR_GRP_SETTINGS_ACCESS_HOOK=y

CONFIG_MCUBOOT_IMG_MANAGER=y