CONFIG_GPIO=y
CONFIG_SPI=y
CONFIG_LOG=y
CONFIG_LOG_MODE_IMMEDIATE=n
CONFIG_PWM=y
CONFIG_WATCHDOG=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_RTT_CONSOLE=y
CONFIG_LOG_BACKEND_RTT=y
CONFIG_STDOUT_CONSOLE=y

CONFIG_SERIAL=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_SYNTH=y

###
# Bluetooth Low Energy configurations
####
CONFIG_BT=y
CONFIG_BT_CTLR_TX_PWR_PLUS_4=y
CONFIG_BT_HCI=y
CONFIG_BT_PERIPHERAL=y
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

# Settings (required for persistent bond storage)
CONFIG_SETTINGS=y
CONFIG_SETTINGS_RUNTIME=y
CONFIG_NVS=y
CONFIG_FLASH_PAGE_LAYOUT=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_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_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_CONN_TX_MAX=10
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n
CONFIG_BT_GATT_DM=y
CONFIG_BT_GATT_DYNAMIC_DB=y

# Allow only LESC pairing
CONFIG_BT_SMP_SC_PAIR_ONLY=y
CONFIG_BT_RX_STACK_SIZE=4096

# Configure Bluetooth connection settings
CONFIG_BT_CTLR_TX_PWR_PLUS_4=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

CONFIG_BT_DEVICE_NAME="POC Refresh"
CONFIG_BT_DEVICE_NAME_GATT_WRITABLE=n

CONFIG_BT_HCI_TX_STACK_SIZE=4096
CONFIG_MPSL_WORK_STACK_SIZE=4096
CONFIG_BT_HCI_TX_STACK_SIZE_WITH_PROMPT=y

# Enable FOTA/DFU over Bluetooth LE
CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y

CONFIG_MCUMGR=y
CONFIG_NET_BUF=y
CONFIG_ZCBOR=y
CONFIG_CRC=y
CONFIG_MCUMGR_TRANSPORT_BT=y
CONFIG_MCUMGR_TRANSPORT_BT_CONN_PARAM_CONTROL=y
CONFIG_IMG_MANAGER=y
CONFIG_STREAM_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_MCUMGR_GRP_IMG=y
CONFIG_MCUMGR_GRP_OS=y
CONFIG_MCUMGR_GRP_OS_BOOTLOADER_INFO=y
CONFIG_MCUMGR_GRP_FS=y
CONFIG_MCUMGR_GRP_FS_CHECKSUM_HASH=y
CONFIG_MCUMGR_GRP_FS_PATH_LEN=64
CONFIG_MCUMGR_TRANSPORT_BT_REASSEMBLY=y
CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU_SPEEDUP=y
CONFIG_BOOTLOADER_MCUBOOT=y


CONFIG_NCS_BOOT_BANNER=y
CONFIG_BOOT_BANNER=y

# Additional MCUmgr settings (if needed beyond what NCS_SAMPLE provides)
CONFIG_MCUMGR_MGMT_NOTIFICATION_HOOKS=y
CONFIG_MCUMGR_SMP_COMMAND_STATUS_HOOKS=y
CONFIG_MCUMGR_GRP_IMG_UPLOAD_CHECK_HOOK=y
CONFIG_MCUMGR_GRP_IMG_STATUS_HOOKS=y

# MCUmgr callback support for OTA progress monitoring
CONFIG_MCUMGR_GRP_IMG_UPLOAD_CHECK_HOOK=y
CONFIG_MCUMGR_TRANSPORT_NETBUF_COUNT=4
CONFIG_MCUMGR_TRANSPORT_NETBUF_SIZE=4096

###
# Stack Config
###
###
# Stack Config
###
CONFIG_MAIN_STACK_SIZE=8192
CONFIG_MCUMGR_TRANSPORT_WORKQUEUE_STACK_SIZE=4608
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
CONFIG_ISR_STACK_SIZE=4096
CONFIG_HEAP_MEM_POOL_SIZE=16384

CONFIG_PRINTK=y

###
# External Flash
###
CONFIG_FLASH=y
CONFIG_SPI_NOR=y
CONFIG_FLASH_MAP=y
CONFIG_STREAM_FLASH=y
# Disable device power management to keep flash always active
CONFIG_PM_DEVICE=n

###
# File System
###
CONFIG_FILE_SYSTEM=y
CONFIG_FILE_SYSTEM_LITTLEFS=y
CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
CONFIG_NORDIC_QSPI_NOR=n

###
# Display
###
CONFIG_DISPLAY=y
CONFIG_ST7789V=y
CONFIG_DISPLAY_LOG_LEVEL_INF=y

###
# Debugging
###
CONFIG_DEBUG_OPTIMIZATIONS=y
CONFIG_DEBUG_THREAD_INFO=y
CONFIG_THREAD_NAME=y

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