#
# Copyright (c) 2022 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
# General config
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
CONFIG_ASSERT=y
CONFIG_REBOOT=y
CONFIG_GPIO=y
CONFIG_TRUSTED_EXECUTION_NONSECURE=y

# Log
CONFIG_LOG=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_BACKEND_UART=n
CONFIG_LOG_DEFAULT_LEVEL=4
CONFIG_LOG_MODE_OVERFLOW=y
CONFIG_LOG_BACKEND_RTT_MODE_DROP=y
CONFIG_LOG_BACKEND_SHOW_COLOR=n
CONFIG_LOG_BACKEND_FORMAT_TIMESTAMP=n

# PinCtrl
CONFIG_PINCTRL=y
CONFIG_PINCTRL_NRF=y

# watch dog
CONFIG_WATCHDOG=y
CONFIG_WATCHDOG_TIMEOUT_MSEC=10000

# Modem
CONFIG_MODEM_INFO=y
CONFIG_NRF_MODEM_LIB=y

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

# Console
CONFIG_CONSOLE_SUBSYS=n
CONFIG_CONSOLE_HANDLER=n
CONFIG_CONSOLE_GETCHAR=n
CONFIG_CONSOLE=y
CONFIG_RTT_CONSOLE=y
CONFIG_UART_CONSOLE=n

# Network
CONFIG_NETWORKING=y
CONFIG_NET_NATIVE=n
CONFIG_NET_SOCKETS_OFFLOAD=y
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_POSIX_NAMES=y

# Socket
CONFIG_POSIX_MAX_FDS=15
CONFIG_NET_SOCKETS_TLS_MAX_CONTEXTS=5

# LTE link control
CONFIG_LTE_LINK_CONTROL=y
CONFIG_LTE_NETWORK_USE_FALLBACK=n
CONFIG_LTE_NETWORK_TIMEOUT=600
CONFIG_LTE_NETWORK_MODE_LTE_M_GPS=n
CONFIG_LTE_NETWORK_MODE_NBIOT_GPS=y

# PSM
CONFIG_MODEM_AUTO_REQUEST_POWER_SAVING_FEATURES=y
# Set Periodic-TAU timer to 70 mins and Active-Time to 10 seconds.
CONFIG_LTE_PSM_REQ_RPTAU="00000111"
CONFIG_LTE_PSM_REQ_RAT="00000101"

# MQTT
CONFIG_MQTT_LIB=y
CONFIG_MQTT_LIB_TLS=n
CONFIG_MQTT_KEEPALIVE=60
CONFIG_MQTT_PUB_TOPIC="device/pd1/pushdata"
CONFIG_MQTT_LOG_PUB_TOPIC="device/pd1/pushlog"
CONFIG_MQTT_SUB_TOPIC="device/pd1/"
CONFIG_MQTT_CLIENT_ID="my-client-id"
CONFIG_MQTT_USER_NAME="admin123"
CONFIG_MQTT_PASSWORD="admin123"
CONFIG_MQTT_DOMESTIC_BROKER_HOSTNAME="device.audarhealth.cn"
CONFIG_MQTT_DOMESTIC_BROKER_PORT=1883
CONFIG_MQTT_FOREIGN_BROKER_HOSTNAME="device.audarhealth.com"
CONFIG_MQTT_FOREIGN_BROKER_PORT=1883
CONFIG_MQTT_MESSAGE_BUFFER_SIZE=4096
CONFIG_MQTT_PAYLOAD_BUFFER_SIZE=4096

# Library for buttons and LEDs
CONFIG_DK_LIBRARY=y

# Heap and stacks
CONFIG_HEAP_MEM_POOL_SIZE=16384
CONFIG_MAIN_STACK_SIZE=8192
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
CONFIG_HW_STACK_PROTECTION=y

# SPI
CONFIG_SPI=y

# I2C
CONFIG_I2C=y

# UART
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_UART_USE_RUNTIME_CONFIGURE=y
CONFIG_UART_0_NRF_TX_BUFFER_SIZE=2048

# wrist off check
CONFIG_WRIST_CHECK_SUPPORT=n

# IMU
CONFIG_IMU_SUPPORT=y
CONFIG_STEP_SUPPORT=n
CONFIG_SLEEP_SUPPORT=n
CONFIG_FALL_DETECT_SUPPORT=n

# GPS
CONFIG_GPS_SUPPORT=y
# Enable to use nRF Cloud A-GNSS
CONFIG_GNSS_SAMPLE_ASSISTANCE_NRF_CLOUD=n

# WIFI
CONFIG_WIFI_SUPPORT=y

# AUDIO
CONFIG_AUDIO_SUPPORT=y

# BLE
CONFIG_BLE_SUPPORT=n

# Data Sync
CONFIG_SYNC_SUPPORT=y

# Pressure
CONFIG_PRESSURE_SUPPORT=y

# Facotry test
CONFIG_FACTORY_TEST_SUPPORT=n
CONFIG_ENTROPY_GENERATOR=y
CONFIG_TEST_RANDOM_GENERATOR=y

# DEVICE POWER MANAGEMENT
CONFIG_PM_DEVICE=y

# Download client
CONFIG_DOWNLOAD_CLIENT=y
CONFIG_DOWNLOAD_CLIENT_MAX_HOSTNAME_SIZE=192
CONFIG_DOWNLOAD_CLIENT_MAX_FILENAME_SIZE=64
CONFIG_DOWNLOAD_CLIENT_STACK_SIZE=4096
CONFIG_USE_HTTPS=y

# fota download
CONFIG_FOTA_DOWNLOAD=y
CONFIG_FOTA_DOWNLOAD_PROGRESS_EVT=y
CONFIG_FOTA_DOWNLOAD_HOST_HK="aug-fm-files-hk.oss-cn-hongkong.aliyuncs.com"
CONFIG_FOTA_DOWNLOAD_HOST_CN="aug-fm-files-cn.oss-cn-shenzhen.aliyuncs.com"
CONFIG_FOTA_DOWNLOAD_FILE="pd1_update.bin"

# Image manager
CONFIG_IMG_MANAGER=y
CONFIG_FLASH_MAP=y
CONFIG_STREAM_FLASH=y
CONFIG_IMG_ERASE_PROGRESSIVELY=y
# DFU Target
CONFIG_DFU_TARGET=y

# Modem key management
CONFIG_MODEM_KEY_MGMT=y

# Application Upgrade support
CONFIG_BOOTLOADER_MCUBOOT=y
