#
# Copyright (c) 2021 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
################################################################################
# Application configuration

CONFIG_ML_APP_SENSOR_EVENT_DESCR="accel_sim_xyz"

CONFIG_ML_APP_EI_DATA_FORWARDER=y
CONFIG_ML_APP_EI_DATA_FORWARDER_UART=y

CONFIG_ML_APP_ML_RUNNER=y
CONFIG_ML_APP_ML_RUNNER_WINDOW_SHIFT=1
CONFIG_ML_APP_ML_RUNNER_FRAME_SHIFT=0

CONFIG_ML_APP_SENSOR_SIM_CTRL=n
#CONFIG_ML_APP_SENSOR_SIM_CTRL_TRIG_BUTTON=y
#CONFIG_ML_APP_SENSOR_SIM_CTRL_TRIG_BUTTON_ID=0x0002

CONFIG_ML_APP_MODE=y
CONFIG_ML_APP_MODE_CONTROL_BUTTON_ID=0x0000

CONFIG_ML_APP_LED_STATE=y
CONFIG_ML_APP_LED_STATE_VALUE_THRESH=900
CONFIG_ML_APP_LED_STATE_ANOMALY_THRESH=500

CONFIG_CAF=y

CONFIG_CAF_POWER_MANAGER=y

CONFIG_CAF_INIT_LOG_SENSOR_EVENTS=n

CONFIG_CAF_SENSOR_MANAGER=y

CONFIG_CAF_BUTTONS=y
CONFIG_CAF_BUTTONS_POLARITY_INVERSED=y

CONFIG_CAF_CLICK_DETECTOR=y

CONFIG_CAF_BLE_STATE=y
CONFIG_CAF_BLE_USE_LLPM=n

CONFIG_CAF_BLE_ADV=y
CONFIG_CAF_BLE_ADV_FAST_ADV=y

CONFIG_CAF_BLE_BOND=y
CONFIG_CAF_BLE_BOND_PEER_ERASE_CLICK=y
CONFIG_CAF_BLE_BOND_PEER_ERASE_CLICK_KEY_ID=0x0000
CONFIG_CAF_BLE_BOND_PEER_ERASE_CLICK_DOUBLE=y
CONFIG_CAF_BLE_BOND_PEER_ERASE_CLICK_TIMEOUT=3000

CONFIG_CAF_BLE_SMP=y
CONFIG_CAF_INIT_LOG_BLE_SMP_TRANSFER_EVENTS=n

CONFIG_CAF_LEDS=y
CONFIG_CAF_LEDS_PWM=y

CONFIG_CAF_SETTINGS_LOADER=y

################################################################################
# EI wrapper configuration

CONFIG_CPP=y
CONFIG_STD_CPP11=y
CONFIG_FP16=n

# Use the NCS machine learning model for simulated acceleration signal
CONFIG_EDGE_IMPULSE=y
CONFIG_EDGE_IMPULSE_URI="https://developer.nordicsemi.com/nRF_Connect_SDK/EdgeImpulse/nrf_accel_sim-v35.zip; https://buranrgstorageacc.blob.core.windows.net/nrf-connect-sdk-edgeimpulse/nrf_accel_sim-v35.zip"
CONFIG_EI_WRAPPER=y

################################################################################
# System configuration

CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2800
CONFIG_ISR_STACK_SIZE=1536
CONFIG_MAIN_STACK_SIZE=1024
CONFIG_IDLE_STACK_SIZE=512
CONFIG_BT_RX_STACK_SIZE=2000

CONFIG_HEAP_MEM_POOL_SIZE=2048

CONFIG_SPEED_OPTIMIZATIONS=y
CONFIG_HW_STACK_PROTECTION=y

CONFIG_BOOT_BANNER=n
CONFIG_NUM_COOP_PRIORITIES=10
CONFIG_NUM_PREEMPT_PRIORITIES=11

CONFIG_APP_EVENT_MANAGER=y
CONFIG_REBOOT=y

CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_NVS=y

CONFIG_SETTINGS=y
CONFIG_SETTINGS_NVS=y

CONFIG_GPIO=y

CONFIG_LED=y
CONFIG_PWM=y
CONFIG_LED_PWM=y

# Using simulated sensor (the DK does not have built-in sensor)
CONFIG_SENSOR=y
CONFIG_I2C=y
CONFIG_LIS2DH=y
CONFIG_SENSOR_SIM=n

# UART can be used only by EI data forwarder
CONFIG_CONSOLE=n
CONFIG_UART_CONSOLE=n
CONFIG_LOG_BACKEND_UART=n
CONFIG_UART_ASYNC_API=y
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y

CONFIG_BT=y
CONFIG_BT_SMP=y
CONFIG_BT_SIGNING=y
CONFIG_BT_BONDABLE=y
CONFIG_BT_SETTINGS=y

CONFIG_BT_PERIPHERAL=y
CONFIG_BT_PERIPHERAL_PREF_MIN_INT=6
CONFIG_BT_PERIPHERAL_PREF_MAX_INT=9
CONFIG_BT_PERIPHERAL_PREF_LATENCY=99
CONFIG_BT_PERIPHERAL_PREF_TIMEOUT=400
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=y

CONFIG_BT_DEVICE_NAME="EI nRF53DK"

################################################################################
# Debug configuration (logger using RTT)

CONFIG_ASSERT=y
CONFIG_RESET_ON_FATAL_ERROR=n

CONFIG_LOG=y
CONFIG_LOG_MODE_DEFERRED=y
CONFIG_LOG_PROCESS_THREAD_STACK_SIZE=1024
CONFIG_USE_SEGGER_RTT=y
CONFIG_SEGGER_RTT_BUFFER_SIZE_UP=4096
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_PRINTK=y

################################################################################
# Bootloader and MCUmgr (OTA DFU) Configuration

CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_UPDATEABLE_IMAGE_NUMBER=2
CONFIG_NRF53_UPGRADE_NETWORK_CORE=y

CONFIG_IMG_MANAGER=y
CONFIG_MCUBOOT_IMG_MANAGER=y
CONFIG_IMG_ERASE_PROGRESSIVELY=y

CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y
CONFIG_MCUMGR_MGMT_NOTIFICATION_HOOKS=y
CONFIG_MCUMGR_GRP_IMG_UPLOAD_CHECK_HOOK=y

################################################################################
# External flash configuration

CONFIG_NORDIC_QSPI_NOR=y
CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16
