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

menuconfig EDGE_IMPULSE
	bool "Enable Edge Impulse"
	depends on CPP
	depends on STD_CPP11
	depends on !FP16
	select REQUIRES_FULL_LIBCPP
	imply FPU
	imply CBPRINTF_FP_SUPPORT
	help
	  Enable Edge Impulse library.

if EDGE_IMPULSE

config APP_LINK_WITH_EDGE_IMPULSE
	bool "Link 'app' with Edge Impulse"
	depends on !EI_WRAPPER
	default y
	help
	  Add Edge Impulse header files to the 'app' include path. It may be
	  disabled if the include paths for Edge Impulse are causing aliasing
	  issues for 'app'.

config EDGE_IMPULSE_DOWNLOAD_ALWAYS
	bool "Download Edge Impulse library on each build"
	default y
	help
	  Request the build system to download the Edge Impulse library on each
	  build. This results in the build target to always be considered out
	  of date.
	  If the re-downloaded zip has no code changes, then no re-building of
	  source is performed and only download of zip file will be done.

config EDGE_IMPULSE_URI
	string "Edge Impulse library URI"
	default ''
	help
	  Specify URI used to access archive with Edge Impulse library.
	  The library will be downloaded into the build directory. You can specify
	  more than one URI separated by a semicolon.
	  Make sure to specify the HTTP API key header as EI_API_KEY_HEADER
	  variable during build if the HTTP server uses it.
	  You can also specify the absolute file path of a local file. In that
	  case, only one URI has to be defined.

endif # EDGE_IMPULSE

menuconfig EI_WRAPPER
	bool "Enable Edge Impulse wrapper"
	depends on EDGE_IMPULSE
	default y
	help
	  Enable Edge Impulse library wrapper in NCS.

if EI_WRAPPER

config EI_WRAPPER_DATA_BUF_SIZE
	int "Size of input data buffer"
	default 2500
	help
	  The buffer is used to store input data for the Edge Impulse library.
	  Size of the buffer is expressed as number of floats.

config EI_WRAPPER_THREAD_STACK_SIZE
	int "Size of EI wrapper thread stack"
	default 4096
	help
	  Edge Impulse library processes the data in a low-priority thread.
	  The stack size needs to be sufficient for used impulse.

config EI_WRAPPER_THREAD_PRIORITY
	int "Priority of EI wrapper thread"
	default 5
	help
	  It is recommended to use preemptive thread priority to make sure
	  that the thread will not block other operations in system for
	  a long time.

config EI_WRAPPER_PROFILING
	bool "Run Edge Impulse library with profiling logging"
	depends on LOG
	help
	  EI wrapper provides logs with execution time in ms of the classifier
	  with detailed information about time spent in the following stages:
	  sampling, dsp, classification, and anomaly.

config EI_WRAPPER_DEBUG_MODE
	bool "Run Edge Impulse library in debug mode"
	imply NEWLIB_LIBC_FLOAT_PRINTF
	help
	  Enables additional log information from Edge Impulse library.

module=EI_WRAPPER
module-dep=LOG
module-str=Edge Impulse NCS wrapper
source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config"

endif # EI_WRAPPER
