#CONFIG_CPP=y
#CONFIG_REQUIRES_FULL_LIBCPP=y
# UART support
CONFIG_SERIAL=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_PRINTK=n

CONFIG_STDOUT_CONSOLE=n
CONFIG_EARLY_CONSOLE=n

# Optional but useful
CONFIG_GPIO=y

# Enable Bluetooth
CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="mS_BLE"
CONFIG_BT_MAX_CONN=1
CONFIG_BT_LL_SOFTDEVICE=y
# Enable advertising
CONFIG_BT_BROADCASTER=y
CONFIG_BT_OBSERVER=n
#CONFIG_BT_GATT_CLIENT=n #updated to n

CONFIG_CLOCK_CONTROL=y
CONFIG_CLOCK_CONTROL_NRF=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
CONFIG_UART_INTERRUPT_DRIVEN=y

# Debug (optional)
CONFIG_USE_SEGGER_RTT=n

# Save RAM (important for nRF52811)
CONFIG_LOG=n

#CONFIG_BT_BUF_ACL_TX_COUNT=2

#CONFIG_BT_L2CAP_RX_MTU=100
CONFIG_BT_RX_STACK_SIZE=1030
CONFIG_BT_HCI_TX_STACK_SIZE_WITH_PROMPT=y
CONFIG_BT_HCI_TX_STACK_SIZE=640
CONFIG_MAIN_STACK_SIZE=1030

CONFIG_IDLE_STACK_SIZE=128
CONFIG_ISR_STACK_SIZE=1024
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=1024

# Event buffers
CONFIG_BT_BUF_EVT_DISCARDABLE_COUNT=1
CONFIG_BT_BUF_EVT_DISCARDABLE_SIZE=43
CONFIG_BT_BUF_EVT_RX_COUNT=2

#CONFIG_THREAD_NAME=y
#CONFIG_BT_USER_DATA_LEN_UPDATE=y

CONFIG_BT_L2CAP_TX_MTU=65
CONFIG_BT_BUF_ACL_RX_SIZE=69
CONFIG_BT_BUF_ACL_TX_SIZE=69
CONFIG_BT_CTLR_DATA_LENGTH_MAX=27

#CONFIG_BT_BUF_ACL_RX_COUNT=2

# Connection / L2CAP / ACL buffers
CONFIG_BT_CONN_TX_MAX=2
CONFIG_BT_L2CAP_TX_BUF_COUNT=2
CONFIG_BT_BUF_ACL_TX_COUNT=1 

#CONFIG_BT_LL_SW_SPLIT=y
CONFIG_BT_HCI=y
#CONFIG_BT_DEBUG_LOG=y

# =========================
# Disable optional BT features
# =========================
CONFIG_BT_DATA_LEN_UPDATE=n
CONFIG_BT_PHY_UPDATE=n
CONFIG_BT_GATT_CACHING=n
CONFIG_BT_GATT_SERVICE_CHANGED=n
CONFIG_BT_GAP_PERIPHERAL_PREF_PARAMS=n

# Controller features
CONFIG_BT_CTLR_PRIVACY=n
CONFIG_BT_CTLR_PHY_2M=n

# =========================
# Build / misc optimizations
# =========================
CONFIG_SIZE_OPTIMIZATIONS=y
CONFIG_THREAD_STACK_INFO=n
CONFIG_THREAD_CUSTOM_DATA=n
CONFIG_FPU=n
CONFIG_BOOT_BANNER=n
CONFIG_BOOT_DELAY=0
CONFIG_THREAD_NAME=n

# =========================
# Drivers and peripherals
# =========================
CONFIG_I2C=n
CONFIG_WATCHDOG=n
CONFIG_PINCTRL=y
CONFIG_SPI=n

# Disable GATT client to save RAM (enable only if really needed)
CONFIG_BT_GATT_CLIENT=n

# Security / Passkey
CONFIG_BT_SMP=y
CONFIG_BT_BONDABLE=y
CONFIG_BT_SETTINGS=n
CONFIG_BT_SIGNING=n
CONFIG_BT_FIXED_PASSKEY=y
CONFIG_BT_MAX_PAIRED=1
CONFIG_BT_PRIVACY=n

#CONFIG_BT_SMP_SC_PAIRING=n


# Authentication callbacks (IMPORTANT)
#CONFIG_BT_CONN=n
#CONFIG_BT_USER_PHY_UPDATE=n

#flash
CONFIG_FLASH=y
CONFIG_FLASH_MAP=y

#CONFIG_PM=y
CONFIG_NVS=y
CONFIG_FLASH_PAGE_LAYOUT=y

CONFIG_MPU_ALLOW_FLASH_WRITE=y
#CONFIG_HEAP_MEM_POOL_SIZE=256

#CONFIG_FILE_SYSTEM=y
#CONFIG_FS_NVS=y                #unable to edit
CONFIG_SETTINGS=y
CONFIG_SETTINGS_RUNTIME=y
#CONFIG_SETTINGS_NVS_SECTOR_COUNT=2  #added
CONFIG_SETTINGS_NVS=y
#CONFIG_FAULT_DUMP=n                 #added


CONFIG_SETTINGS_NVS_SECTOR_COUNT=2
CONFIG_SETTINGS_NVS_SECTOR_SIZE_MULT=1

#CONFIG_SETTINGS_BACKEND=y
#CONFIG_SETTINGS_NVS_NAME_CACHE=y
#CONFIG_SETTINGS_STORAGE=y          #unable to edit
#CONFIG_PARTITION_MANAGER_ENABLED=n

#boot log
CONFIG_NCS_BOOT_BANNER=n
#CONFIG_BOOT_BANNER=n

#phy
CONFIG_BT_USER_PHY_UPDATE=n
CONFIG_BT_PHY_UPDATE=n

CONFIG_BT_CTLR_PHY_2M=n
CONFIG_BT_CTLR_PHY_CODED=n

