# GPIO
CONFIG_GPIO=y
CONFIG_GPIO_GET_CONFIG=y


# LORA
CONFIG_SPI=y
CONFIG_LORA=y
CONFIG_LORAWAN=y
CONFIG_LORAMAC_REGION_EU868=y
CONFIG_LORAMAC_REGION_US915=y
CONFIG_LORAMAC_REGION_AS923=y
CONFIG_LORAMAC_REGION_AU915=y
CONFIG_LORAMAC_REGION_CN470=y
CONFIG_LORAMAC_REGION_CN779=y
CONFIG_LORAMAC_REGION_EU433=y
CONFIG_LORAMAC_REGION_KR920=y
CONFIG_LORAMAC_REGION_IN865=y
CONFIG_LORAMAC_REGION_RU864=y

CONFIG_HAS_SEMTECH_RADIO_DRIVERS=y
CONFIG_LORA_SX126X=y
CONFIG_LORAWAN_SERVICES=y
CONFIG_LORAWAN_SERVICES_THREAD_STACK_SIZE=10240
CONFIG_LORAWAN_NVM_NONE=y

# Some command handlers require a large stack.
CONFIG_MAIN_STACK_SIZE=10240
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=8196

# BT
CONFIG_BT=y
CONFIG_BT_CENTRAL=y
CONFIG_BT_GATT_CLIENT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="WeatherXM WS1300 000000"
CONFIG_BT_DEVICE_APPEARANCE=833
CONFIG_BT_MAX_CONN=1
CONFIG_BT_MAX_PAIRED=1
CONFIG_BT_ID_MAX=1
CONFIG_BT_L2CAP_TX_MTU=247
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_BUF_ACL_TX_COUNT=10
CONFIG_BT_BUF_ACL_TX_SIZE=251

CONFIG_BT_NUS_SENSECAP=y

# RTT CONSOLE
CONFIG_LOG=n
CONFIG_USE_SEGGER_RTT=n
CONFIG_RTT_CONSOLE=n
# CONFIG_LOG_DEFAULT_LEVEL=4
# CONFIG_CONSOLE=y
# # CONFIG_UART_CONSOLE=n
# CONFIG_LOG_BACKEND_RTT=y
# # CONFIG_LOG_BACKEND_UART=n
# CONFIG_LOG_BUFFER_SIZE=10240
# CONFIG_LOG_DEFAULT_LEVEL=4   
# CONFIG_LOG_MODE_IMMEDIATE=y 
# CONFIG_LOG_PROCESS_THREAD_STACK_SIZE=2048
# CONFIG_MULTITHREADING=y
# CONFIG_LOG_PROCESS_THREAD=y

# UART
CONFIG_SERIAL=y
CONFIG_UART_CONSOLE=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_PRINTK=y
# CONFIG_USERSPACE=y
# CONFIG_PRINTK_BUFFER_SIZE=4096
# ADC
CONFIG_ADC=y

# PWM
CONFIG_PWM=y


# PM
# CONFIG_PM=y
CONFIG_PM_DEVICE=y
CONFIG_PM_DEVICE_RUNTIME=y


# NVS
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_NVS=y
CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y


# PSA CRYPTO  Enable nordic security backend and PSA APIs
CONFIG_PSA_CRYPTO_DRIVER_OBERON=n
CONFIG_PSA_CRYPTO_DRIVER_CC3XX=y

CONFIG_NRF_SECURITY=y
CONFIG_MBEDTLS_PSA_CRYPTO_C=y

CONFIG_MBEDTLS_ENABLE_HEAP=y
CONFIG_MBEDTLS_HEAP_SIZE=8192

CONFIG_PSA_WANT_ALG_ECDSA=y
CONFIG_PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY=y
CONFIG_PSA_WANT_ECC_SECP_R1_192=y
CONFIG_PSA_WANT_ALG_SHA_256=y

# For key generation
CONFIG_PSA_WANT_GENERATE_RANDOM=y



# WDT
CONFIG_WATCHDOG=y
CONFIG_WDT_DISABLE_AT_BOOT=n


# RNG
CONFIG_ENTROPY_GENERATOR=y
CONFIG_ENTROPY_DEVICE_RANDOM_GENERATOR=y
# CONFIG_ENTROPY_NRF5_RNG=y

# I2C
CONFIG_I2C=y


# LITTLEFS
CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FILE_SYSTEM=y
CONFIG_FILE_SYSTEM_LITTLEFS=y


# Enable bonding
CONFIG_BT_SETTINGS=y
CONFIG_FLASH_MAP=y
CONFIG_SETTINGS=y
# CONFIG_PM_PARTITION_SIZE_SETTINGS_STORAGE=0x2000


# 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 file system commands
CONFIG_MCUMGR_GRP_FS=y

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

# Disable Bluetooth ping support
CONFIG_BT_CTLR_LE_PING=n


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



# Ensure an MCUboot-compatible binary is generated.
CONFIG_BOOTLOADER_MCUBOOT=y

# Support for taskstat command
CONFIG_MCUMGR_GRP_OS_TASKSTAT=y


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

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

# # Timer
CONFIG_TIMER=y

# External clock
CONFIG_SOC_ENABLE_LFXO=y
# CONFIG_SOC_LFXO_CAP_EXTERNAL=y
# CONFIG_SOC_LFXO_CAP_INT_6PF=y
# CONFIG_SOC_LFXO_CAP_INT_7PF=y
# CONFIG_SOC_LFXO_CAP_INT_9PF=y
# CONFIG_SOC_HFXO_CAP_DEFAULT=y
# CONFIG_SOC_HFXO_CAP_EXTERNAL=y
CONFIG_SOC_HFXO_CAP_INTERNAL=y
CONFIG_SOC_HFXO_CAP_INT_VALUE_X2=24

# RTC 
CONFIG_RTC=y
CONFIG_COUNTER=y
CONFIG_CLOCK_CONTROL=y
CONFIG_CLOCK_CONTROL_NRF=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=y  

# CONFIG_BOOT_DELAY=1000

# # Enable the Shell mcumgr transport.
# CONFIG_BASE64=y
# CONFIG_SHELL=y
# CONFIG_SHELL_BACKEND_SERIAL=y
# CONFIG_MCUMGR_TRANSPORT_SHELL=y

# Disable shell commands that are not needed
CONFIG_CLOCK_CONTROL_NRF_SHELL=n
CONFIG_DEVICE_SHELL=n
CONFIG_DEVMEM_SHELL=n
CONFIG_FLASH_SHELL=n

# Required by QSPI
CONFIG_MULTITHREADING=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_FLASH_SIMULATOR=n
CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16
CONFIG_STREAM_FLASH_ERASE=y


# Thread debugging
# Required by the `taskstat` command.
CONFIG_THREAD_MONITOR=y
CONFIG_THREAD_NAME=y


# Update application core and network core together in a zip file
# CONFIG_MCUBOOT_IMAGE_VERSION="1.0.0+0"
CONFIG_UPDATEABLE_IMAGE_NUMBER=2
CONFIG_IMG_ERASE_PROGRESSIVELY=y
CONFIG_NRF53_UPGRADE_NETWORK_CORE=y



# # Test the external low speed clock
# CONFIG_PPI_TRACE=y
# CONFIG_COUNTER=y
# CONFIG_SYSTEM_CLOCK_NO_WAIT=y
# # CONFIG_PPI_TRACE_PIN_RTC_COMPARE_EVT=28

# # nRF_RX
# CONFIG_PPI_TRACE_PIN_RTC_TICK_EVT=43    
# # CONFIG_PPI_TRACE_PIN_LFCLOCK_STARTED_EVT=31

# Enable stack analysis
CONFIG_THREAD_STACK_INFO=y
CONFIG_THREAD_MONITOR=y
CONFIG_INIT_STACKS=y