#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

config CANUTILS_LIBUAVCAN
	bool "libuavcan Library"
	default n
	depends on STM32_HAVE_CAN1
	depends on !STM32_CAN1
	depends on !STM32_CAN2
	depends on !STM32_TIM2 || (STM32_HAVE_TIM3 && !STM32_TIM3) || (STM32_HAVE_TIM4 && !STM32_TIM4) || (STM32_HAVE_TIM5 && !STM32_TIM5) || (STM32_HAVE_TIM6 && !STM32_TIM6) || (STM32_HAVE_TIM7 && !STM32_TIM7)
	depends on C99_BOOL8
	depends on HAVE_CXX
	depends on !DISABLE_POLL
	---help---
		Enables support for the libuavcan library.

if CANUTILS_LIBUAVCAN

config LIBUAVCAN_URL
	string "libuavcan URL"
	default "https://github.com/UAVCAN/libuavcan/archive"
	---help---
		libuavcan URL.

config LIBUAVCAN_VERSION
	string "libuavcan Version"
	default "b04396ace50155573e545ed9bf2fb09964ee2367"
	---help---
		libuavcan version.

config LIBUAVCAN_DSDL_URL
	string "DSDL URL"
	default "https://github.com/UAVCAN/dsdl/archive"
	---help---
		DSDL URL.

config LIBUAVCAN_DSDL_VERSION
	string "DSDL Version"
	default "9804a3e6972825586be252ce08dd899f44994b14"
	---help---
		DSDL version.

config LIBUAVCAN_PYUAVCAN_URL
	string "pyuavcan URL"
	default "https://github.com/UAVCAN/pyuavcan/archive"
	---help---
		pyuavcan URL.

config LIBUAVCAN_PYUAVCAN_VERSION
	string "pyuavcan Version"
	default "c58477a644d20ccf95a20c151f3a0402f271c3b8"
	---help---
		pyuavcan version.

config LIBUAVCAN_STM32_NUM_IFACES
	int "Number of CAN Interfaces"
	default 1
	range 1 1 if !STM32_HAVE_CAN2
	range 1 2 if STM32_HAVE_CAN2

choice
	prompt "Timer"
	default LIBUAVCAN_STM32_TIM2 if !STM32_TIM2
	default LIBUAVCAN_STM32_TIM3 if STM32_HAVE_TIM3 && !STM32_TIM3
	default LIBUAVCAN_STM32_TIM4 if STM32_HAVE_TIM4 && !STM32_TIM4
	default LIBUAVCAN_STM32_TIM5 if STM32_HAVE_TIM5 && !STM32_TIM5
	default LIBUAVCAN_STM32_TIM6 if STM32_HAVE_TIM6 && !STM32_TIM6
	default LIBUAVCAN_STM32_TIM7 if STM32_HAVE_TIM7 && !STM32_TIM7

config LIBUAVCAN_STM32_TIM2
	bool "TIM2"
	depends on !STM32_TIM2
	---help---
		The library will use TIM2.

config LIBUAVCAN_STM32_TIM3
	bool "TIM3"
	depends on STM32_HAVE_TIM3 && !STM32_TIM3
	---help---
		The library will use TIM3.

config LIBUAVCAN_STM32_TIM4
	bool "TIM4"
	depends on STM32_HAVE_TIM4 && !STM32_TIM4
	---help---
		The library will use TIM4.

config LIBUAVCAN_STM32_TIM5
	bool "TIM5"
	depends on STM32_HAVE_TIM5 && !STM32_TIM5
	---help---
		The library will use TIM5.

config LIBUAVCAN_STM32_TIM6
	bool "TIM6"
	depends on STM32_HAVE_TIM6 && !STM32_TIM6
	---help---
		The library will use TIM6.

config LIBUAVCAN_STM32_TIM7
	bool "TIM7"
	depends on STM32_HAVE_TIM7 && !STM32_TIM7
	---help---
		The library will use TIM7.

endchoice

choice
	prompt "C++ Version"
	default LIBUAVCAN_CPP03

config LIBUAVCAN_CPP03
	bool "C++03"
	---help---
		The library will use C++03.

config LIBUAVCAN_CPP11
	bool "C++11"
	---help---
		The library will use C++11.

endchoice

config LIBUAVCAN_DEBUG
	bool "Debug"
	default n
	---help---
		Enables debug.

config LIBUAVCAN_EXCEPTIONS
	bool "Exceptions"
	default n
	---help---
		Enables exceptions.

config LIBUAVCAN_TINY
	bool "Tiny"
	default n
	---help---
		Removes some features to save memory.

config LIBUAVCAN_NO_GLOBAL_DATA_TYPE_REGISTRY
	bool "No Global Data Type Registry"
	default n
	---help---
		Removes the global data type registry.

config LIBUAVCAN_TOSTRING
	bool "Implement toString"
	default n
	depends on LIBUAVCAN_EXCEPTIONS
	---help---
		The library will add a toString method to most of its classes.

config LIBUAVCAN_IMPLEMENT_PLACEMENT_NEW
	bool "Implement Placement new"
	default n
	---help---
		The library will implement placement new.

config LIBUAVCAN_USE_EXTERNAL_SNPRINTF
	bool "Use External snprintf"
	default n
	---help---
		The library will use an external snprintf.

config LIBUAVCAN_USE_EXTERNAL_FLOAT16_CONVERSION
	bool "Use External float16 Conversion"
	default n
	---help---
		The library will use an external float16 conversion.

config LIBUAVCAN_NO_ASSERTIONS
	bool "No Assertions"
	default n
	---help---
		Disables assertions.

config LIBUAVCAN_MEM_POOL_BLOCK_SIZE
	int "Memory Pool Block Size"
	default 0
	---help---
		Specifies the memory pool block size.  If the value is 0, the
		library will use a default value.

config LIBUAVCAN_FLOAT_COMPARISON_EPSILON_MULT
	int "Float Comparion Epsilon Mult"
	default 0
	---help---
		Specifies the float comparison epsilon mult.  If the value is
		0, the library will use a default value.

config LIBUAVCAN_MAX_CAN_ACCEPTANCE_FILTERS
	int "Max CAN Acceptance Filters"
	default 0
	---help---
		Specifies the maximum number of CAN acceptance filters.  If
		the value is 0, the library will use a default value.

config LIBUAVCAN_MAX_NETWORK_SIZE_HINT
	int "Max Network Size Hint"
	default 0
	---help---
		Specifies the maximum network size.  If the value is 0, the
		library will use a default value.

config LIBUAVCAN_RX_QUEUE_CAPACITY
	int "Rx Queue Capacity"
	default 0
	---help---
		Specifies the rx queue capacity.  If the value is 0, the
		library will use a default value.

config LIBUAVCAN_BIT_RATE
	int "Bit Rate"
	default 0
	range 0 1000000
	---help---
		Specifies the CAN bit rate.  If the value is 0, the library
		will automatically detect the bit rate.

config LIBUAVCAN_INIT_RETRIES
	int "Initialization Retries"
	default 0
	---help---
		Specifies the number of times to try initializing the CAN
		peripherals before panicking.  A value of 0 means to try
		forever.

endif
