config ESP_RMT
	bool "Remote Control Module (RMT)"
	default n
	depends on RMT
	---help---
		The RMT (Remote Control Transceiver) peripheral was designed to act as
		an infrared transceiver. However, due to the flexibility of its data
		format, RMT can be extended to a versatile and general-purpose
		transceiver, transmitting or receiving many other types of signals.

config ESP_MCPWM
	bool "Motor Control PWM (MCPWM)"
	default n
	depends on ARCH_CHIP_ESP32 || ARCH_CHIP_ESP32S3
	---help---
		Enable support for timer capture and motor control using
		the Motor Control PWM peripheral.

config ESPRESSIF_TEMP
	bool "Internal Temperature Sensor"
	default n
	depends on ARCH_CHIP_ESP32S2 || ARCH_CHIP_ESP32S3
	---help---
		A built-in sensor used to measure the chip's internal temperature.

config ESPRESSIF_SPIFLASH
	bool "SPI Flash"
	depends on ARCH_CHIP_ESP32S2
	default n

menu "Internal Temperature Sensor Configuration"
	depends on ESPRESSIF_TEMP

config ESPRESSIF_TEMP_PATH
	string "Internal Temperature Sensor Path"
	default "dev/temp"

endmenu # ESPRESSIF_TEMP

config ESPRESSIF_HAVE_OTA_PARTITION
	bool
	default n

menu "SPI Flash Configuration"

choice ESPRESSIF_FLASH_MODE
	prompt "SPI Flash mode"
	default ESPRESSIF_FLASH_MODE_DIO
	---help---
		These options control how many I/O pins are used for communication
		with the attached SPI Flash chip.
		The option selected here is then used by esptool when flashing.

config ESPRESSIF_FLASH_MODE_DIO
	bool "Dual IO (DIO)"

config ESPRESSIF_FLASH_MODE_DOUT
	bool "Dual Output (DOUT)"

config ESPRESSIF_FLASH_MODE_QIO
	bool "Quad IO (QIO)"

config ESPRESSIF_FLASH_MODE_QOUT
	bool "Quad Output (QOUT)"

endchoice # ESPRESSIF_FLASH_MODE

choice ESPRESSIF_FLASH_FREQ
	prompt "SPI Flash frequency"
	default ESPRESSIF_FLASH_FREQ_40M
	---help---
		SPI Flash frequency.

config ESPRESSIF_FLASH_FREQ_80M
	bool "80 MHz"

config ESPRESSIF_FLASH_FREQ_40M
	bool "40 MHz"

config ESPRESSIF_FLASH_FREQ_26M
	bool "26 MHz"

config ESPRESSIF_FLASH_FREQ_20M
	bool "20 MHz"

endchoice # ESPRESSIF_FLASH_FREQ

if ESPRESSIF_HAVE_OTA_PARTITION

comment "Application Image OTA Update support"

config ESPRESSIF_OTA_PRIMARY_SLOT_OFFSET
	hex "Application image primary slot offset"
	default 0x10000

config ESPRESSIF_OTA_PRIMARY_SLOT_DEVPATH
	string "Application image primary slot device path"
	default "/dev/ota0"

config ESPRESSIF_OTA_SECONDARY_SLOT_OFFSET
	hex "Application image secondary slot offset"
	default 0x110000

config ESPRESSIF_OTA_SECONDARY_SLOT_DEVPATH
	string "Application image secondary slot device path"
	default "/dev/ota1"

config ESPRESSIF_OTA_SLOT_SIZE
	hex "Application image slot size (in bytes)"
	default 0x100000

config ESPRESSIF_OTA_SCRATCH_OFFSET
	hex "Scratch partition offset"
	default 0x210000

config ESPRESSIF_OTA_SCRATCH_SIZE
	hex "Scratch partition size"
	default 0x40000

config ESPRESSIF_OTA_SCRATCH_DEVPATH
	string "Scratch partition device path"
	default "/dev/otascratch"

endif

if ESPRESSIF_SPIFLASH

comment "General storage MTD configuration"

config ESPRESSIF_MTD
	bool "MTD driver"
	default y
	select MTD
	select MTD_BYTE_WRITE
	select MTD_PARTITION
	---help---
		Initialize an MTD driver for the ESP32-S2 SPI Flash, which will
		add an entry at /dev for application access from userspace.

config ESPRESSIF_SPIFLASH_MTD_BLKSIZE
	int "Storage MTD block size"
	default 64
	depends on ESPRESSIF_MTD

config ESPRESSIF_STORAGE_MTD_DEBUG
	bool "Storage MTD Debug"
	default n
	depends on ESPRESSIF_MTD && DEBUG_FS_INFO
	---help---
		If this option is enabled, Storage MTD driver read and write functions
		will output input parameters and return values (if applicable).

endif # ESPRESSIF_SPIFLASH

endmenu # SPI Flash Configuration

config ESPRESSIF_WIRELESS
	bool
	default n
	select NET
	select ARCH_PHY_INTERRUPT
	select ESP32S2_RNG if ARCH_CHIP_ESP32S2
	select ESP32S2_RT_TIMER if ARCH_CHIP_ESP32S2
	select ESP32S2_TIMER0 if ARCH_CHIP_ESP32S2
	depends on ARCH_CHIP_ESP32S2
	---help---
		Enable Wireless support

config ESPRESSIF_WIFI
	bool "Wi-Fi"
	default n
	select ESPRESSIF_WIRELESS
	---help---
		Enable Wi-Fi support

menu "Wi-Fi Configuration"
	depends on ESPRESSIF_WIFI

menu "ESP WPA-Supplicant"

config WPA_WAPI_PSK
	bool "Enable WAPI PSK support"
	default n
	---help---
		Select this option to enable WAPI-PSK
		which is a Chinese National Standard Encryption for Wireless LANs (GB 15629.11-2003).

config WPA_SUITE_B_192
	bool "Enable NSA suite B support with 192-bit key"
	default n
	select ESP_WIFI_GCMP_SUPPORT
	select ESP_WIFI_GMAC_SUPPORT
	---help---
		Select this option to enable 192-bit NSA suite-B.
		This is necessary to support WPA3 192-bit security.

config ESP_WPA_DEBUG_PRINT
	bool "Print debug messages from Espressif's WPA Supplicant"
	default n
	---help---
		Select this option to print logging information from WPA supplicant,
		this includes handshake information and key hex dumps depending
		on the project logging level.

		Enabling this could increase the build size ~60kb
		depending on the project logging level.

endmenu # ESP WPA-Supplicant

choice ESPRESSIF_WIFI_MODE
	prompt "ESP Wi-Fi mode"
	default ESPRESSIF_WIFI_STATION

config ESPRESSIF_WIFI_STATION
	bool "Station mode"

config ESPRESSIF_WIFI_SOFTAP
	bool "SoftAP mode"

config ESPRESSIF_WIFI_STATION_SOFTAP
	bool "Station + SoftAP"

endchoice # ESP Wi-Fi mode

config ESP_WIFI_ENABLE_SAE_PK
	bool "Enable SAE-PK"
	default y
	---help---
		Select this option to enable SAE-PK

config ESP_WIFI_ENABLE_WPA3_OWE_STA
	bool "Enable OWE STA"
	default y
	---help---
		Select this option to allow the device to establish OWE connection with eligible AP's.
		PMF (Protected Management Frames) is a prerequisite feature for a WPA3 connection, it needs to be
		explicitly configured before attempting connection. Please refer to the Wi-Fi Driver API Guide for details.

config ESPRESSIF_WIFI_STATIC_RXBUF_NUM
	int "Wi-Fi static RX buffer number"
	default 10

config ESPRESSIF_WIFI_DYNAMIC_RXBUF_NUM
	int "Wi-Fi dynamic RX buffer number"
	default 32

config ESPRESSIF_WIFI_DYNAMIC_TXBUF_NUM
	int "Wi-Fi dynamic TX buffer number"
	default 32

config ESPRESSIF_WIFI_TX_AMPDU
	bool "Wi-Fi TX AMPDU"
	default y

config ESPRESSIF_WIFI_RX_AMPDU
	bool "Wi-Fi RX AMPDU"
	default y

config ESPRESSIF_WIFI_RXBA_AMPDU_WZ
	int "Wi-Fi RX BA AMPDU windown size"
	default 6

config ESPRESSIF_WLAN_PKTBUF_NUM
	int "WLAN netcard packet buffer number per netcard"
	default 16

config ESP_WIFI_GCMP_SUPPORT
	bool "WiFi GCMP Support(GCMP128 and GCMP256)"
	default n
	---help---
		Select this option to enable GCMP support. GCMP support is compulsory for WiFi Suite-B support.

config ESP_WIFI_GMAC_SUPPORT
	bool "WiFi GMAC Support(GMAC128 and GMAC256)"
	default n
	---help---
		Select this option to enable GMAC support. GMAC support is compulsory for WiFi 192-bit certification.

config ESPRESSIF_WIFI_CONNECT_TIMEOUT
	int "Connect timeout in second"
	default 10
	---help---
		Max waiting time of connecting to AP.

config ESPRESSIF_WIFI_SCAN_RESULT_SIZE
	int "Scan result buffer"
	default 4096
	---help---
		Maximum scan result buffer size.

config ESPRESSIF_WIFI_STA_DISCONNECT_PM
	bool "Power Management for station when disconnected"
	default y
	---help---
		Select this option to enable power management for station when disconnected.
		Chip will do modem-sleep when RF module is not in use anymore.

choice ESPRESSIF_POWER_SAVE_MODE
	prompt "Wi-Fi Power save mode"
	default ESPRESSIF_POWER_SAVE_NONE
	---help---
		Wi-Fi supports the Modem-sleep mode which refers to the legacy power-saving mode in the IEEE 802.11 protocol.
		Modem-sleep mode works in station-only mode and the station must connect to the AP first. If the Modem-sleep
		mode is enabled, station will switch between active and sleep state periodically. In sleep state, RF, PHY and
		BB are turned off in order to reduce power consumption. Station can keep connection with AP in modem-sleep mode.

		Modem-sleep mode includes minimum and maximum power-saving modes.

		In minimum power-saving mode, station wakes
		up every DTIM to receive beacon. Broadcast data will not be lost because it is transmitted after DTIM.
		However, it cannot save much more power if DTIM is short for DTIM is determined by AP.

		In maximum power-saving mode, station wakes up in every listen interval to receive beacon. This listen interval
		can be set to be longer than the AP DTIM period. Broadcast data may be lost because station may be in sleep
		state at DTIM time. If listen interval is longer, more power is saved, but broadcast data is more easy to lose.
		Listen interval can be configured by setting ESPRESSIF_WIFI_LISTEN_INTERVAL.

		ESPRESSIF_POWER_SAVE_NONE disables Modem-sleep mode entirely. Disabling it increases power consumption, but
		minimizes the delay in receiving Wi-Fi data in real time. When Modem-sleep mode is enabled, the delay in
		receiving Wi-Fi data may be the same as the DTIM cycle (minimum power-saving mode) or the listening interval
		(maximum power-saving mode). Setting ESPRESSIF_POWER_SAVE_NONE is suitable when high throughput is required.

config ESPRESSIF_POWER_SAVE_NONE
	bool "No power save"

config ESPRESSIF_POWER_SAVE_MIN_MODEM
	bool "Minimum modem power saving."

config ESPRESSIF_POWER_SAVE_MAX_MODEM
	bool "Maximum modem power saving"

endchoice # ESPRESSIF_POWER_SAVE_MODE

config ESPRESSIF_WIFI_LISTEN_INTERVAL
	int "Wi-Fi listen interval"
	depends on ESPRESSIF_POWER_SAVE_MAX_MODEM
	default 3
	---help---
		Interval for station to listen to beacon from AP. The unit of listen interval is one beacon interval.
		For example, if beacon interval is 100 ms and listen interval is 3, the interval for station to listen
		to beacon is 300 ms.

endmenu # ESPRESSIF_WIFI
