# NOTE : Please keep the module related Configurations seperate as a chunk, can be done as below.
# Or alternatively a seperate .conf file can also be used for specific module configs

## ------ General Configurations ----------------------------------------------------*

# saves memory a little
CONFIG_ASSERT=n

CONFIG_SHELL=y
CONFIG_FILE_SYSTEM_SHELL=y

## ------ logger Configurations ----------------------------------------------------*

# Logger module configuration
CONFIG_LOG=y
CONFIG_CONSOLE=y
CONFIG_LOG_MODE_MINIMAL=y
CONFIG_LOG_BUFFER_SIZE=4096
CONFIG_LOG_PRINTK=y
CONFIG_FPU=y
CONFIG_CBPRINTF_FP_SUPPORT=y
CONFIG_PM=y

# Default log level if not explicitely specified for modules.
CONFIG_LOG_DEFAULT_LEVEL=2

# Minimum log level used by each module. Module level is overriden with this level if module level is below this level.
#CONFIG_LOG_OVERRIDE_LEVEL=2

# UART Logging
CONFIG_LOG_BACKEND_UART=y

# ACM Logging

# RTT Logging
CONFIG_USE_SEGGER_RTT=n
CONFIG_LOG_BACKEND_RTT=n

# disable secure uart as it interferes with logging
CONFIG_TFM_SECURE_UART=n
CONFIG_TFM_LOG_LEVEL_SILENCE=y

# ------ I2C configurations -------------------------------------------------------------*
 
CONFIG_I2C=y

# ------ state machine configurations ---------------------------------------------------*

# Enable the state machine framework
CONFIG_SMF=y
CONFIG_SMF_ANCESTOR_SUPPORT=y
CONFIG_SMF_INITIAL_TRANSITION=y

CONFIG_EVENTS=y

# ------ LIS2DE12 configurations ---------------------------------------------------*

CONFIG_GPIO=y

# ------ File System configs -------------------------------------------------------------*

CONFIG_SPI=y
CONFIG_NRFX_QSPI=y
CONFIG_NORDIC_QSPI_NOR=y
CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096

# For SPI interface
# CONFIG_SPI_NOR=y 
# CONFIG_NORDIC_QSPI_NOR=n
# CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
# CONFIG_SPI_NOR_SFDP_RUNTIME=y

CONFIG_FLASH=y
CONFIG_FLASH_MAP=y

CONFIG_FILE_SYSTEM=y
CONFIG_FILE_SYSTEM_LITTLEFS=y
CONFIG_FS_LITTLEFS_NUM_FILES=5
CONFIG_FS_LITTLEFS_FMP_DEV=y

CONFIG_FLASH_JESD216_API=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y
CONFIG_PM_PARTITION_REGION_LITTLEFS_EXTERNAL=y
CONFIG_PM_PARTITION_SIZE_LITTLEFS=0x07D0000
# ------ LZ4 configuration ---------------------------------------------------------*
 
CONFIG_LZ4=y
CONFIG_REQUIRES_FULL_LIBC=y
CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=24576
# ------ ADC configurations ---------------------------------------------------*

CONFIG_ADC=y

# -------- BLE Configuration -----------

CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="Wearable_Bracelet"
CONFIG_BT_MAX_CONN=1
CONFIG_BT_MAX_PAIRED=1

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

CONFIG_MAIN_STACK_SIZE=4096
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=8192
# ---------------------------------------------------------------------------------------*

CONFIG_SERIAL=y
CONFIG_UART_CONSOLE=y
CONFIG_UART_LINE_CTRL=y

CONFIG_SHELL=y

# If enabled Creates duplicate logs
CONFIG_SHELL_BACKEND_SERIAL=n
CONFIG_SHELL_BACKEND_SERIAL_INTERRUPT_DRIVEN=y


# ------ AWS configurations -------------------------------------------------------------*

# General
CONFIG_HEAP_MEM_POOL_SIZE=81920
CONFIG_LOG_MODE_IMMEDIATE=y
CONFIG_HW_STACK_PROTECTION=y
CONFIG_HW_ID_LIBRARY_SOURCE_NET_MAC=y
CONFIG_POSIX_MAX_FDS=25

# Optimize Wi-Fi stack to save some memory
CONFIG_NRF700X_RX_NUM_BUFS=16
CONFIG_NRF700X_MAX_TX_AGGREGATION=4

CONFIG_FLASH_MAP=y

CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.168.1.99"
CONFIG_NET_CONFIG_MY_IPV4_NETMASK="255.255.255.0"
CONFIG_NET_CONFIG_MY_IPV4_GW="192.168.1.1"

# Shell
CONFIG_SHELL_STACK_SIZE=6144

# NET sockets
CONFIG_NET_SOCKETS_OFFLOAD=n
CONFIG_NET_CONTEXT_SNDTIMEO=y
CONFIG_NET_CONTEXT_RCVTIMEO=y

# DNS
CONFIG_DNS_RESOLVER=y
CONFIG_NET_SOCKETS_DNS_TIMEOUT=30000

# Native network stack
CONFIG_NRF_SECURITY=y
CONFIG_MBEDTLS=y
CONFIG_MBEDTLS_ENABLE_HEAP=y
CONFIG_MBEDTLS_HEAP_SIZE=81920
CONFIG_MBEDTLS_RSA_C=y

# NET Sockets
CONFIG_NET_SOCKETS_SOCKOPT_TLS=y
CONFIG_NET_SOCKETS_TLS_MAX_CONTEXTS=2

# Zephyr NET Connection Manager Connectivity layer.
CONFIG_L2_WIFI_CONNECTIVITY=y
CONFIG_L2_WIFI_CONNECTIVITY_AUTO_CONNECT=n
CONFIG_L2_WIFI_CONNECTIVITY_AUTO_DOWN=n


# MCUBOOT
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_MCUBOOT_USE_ALL_AVAILABLE_RAM=y
CONFIG_MCUBOOT_IMG_MANAGER=y

# Image manager
CONFIG_IMG_MANAGER=y
CONFIG_STREAM_FLASH=y
CONFIG_IMG_ERASE_PROGRESSIVELY=y

# AWS FOTA
# CONFIG_AWS_FOTA=y
# CONFIG_FOTA_DOWNLOAD=y
# CONFIG_DFU_TARGET=y

# Download client (needed by AWS FOTA)
CONFIG_DOWNLOAD_CLIENT=y
CONFIG_DOWNLOAD_CLIENT_STACK_SIZE=4096
CONFIG_DOWNLOAD_CLIENT_BUF_SIZE=4096
CONFIG_DOWNLOAD_CLIENT_HTTP_FRAG_SIZE_4096=y

# TLS credentials
CONFIG_TLS_CREDENTIALS_BACKEND_PROTECTED_STORAGE=y

# Optimize TF-M
CONFIG_TFM_PROFILE_TYPE_SMALL=y
CONFIG_PM_PARTITION_SIZE_TFM_SRAM=0xc000
# TODO Need to change partition size for https_client
CONFIG_PM_PARTITION_SIZE_TFM=0x1fe00

# General
CONFIG_HW_ID_LIBRARY=y
CONFIG_JSON_LIBRARY=y
CONFIG_REBOOT=y

# Network
CONFIG_NET_NATIVE=y
CONFIG_NET_CONNECTION_MANAGER=y

# AWS IoT library
# CONFIG_AWS_IOT=y
# CONFIG_AWS_IOT_CLIENT_ID_STATIC="my-thing"
# CONFIG_AWS_IOT_BROKER_HOST_NAME="xxx.amazonaws.com"
# CONFIG_AWS_IOT_TOPIC_UPDATE_DELTA_SUBSCRIBE=y
# CONFIG_AWS_IOT_TOPIC_GET_ACCEPTED_SUBSCRIBE=y
# CONFIG_AWS_IOT_TOPIC_GET_REJECTED_SUBSCRIBE=y

# HTTPS Configure
CONFIG_POSIX_API=y

# NET sockets
CONFIG_NET_DHCPV4=y

# TLS networking
CONFIG_NET_SOCKETS_ENABLE_DTLS=n

# mbedTLS
CONFIG_MBEDTLS_TLS_LIBRARY=y


# ---------------------------------------------------------------------------------------*