menu "I2C Port Settings"
    depends on LV_I2C && !HAVE_I2C_MANAGER

	menu "I2C Port 0"

		config I2C_MANAGER_0_ENABLED
			bool "Enable I2C port 0"

		if I2C_MANAGER_0_ENABLED
			config I2C_MANAGER_0_SDA
				int "SDA (GPIO pin)"
			config I2C_MANAGER_0_SCL
				int "SCL (GPIO pin)"
			config I2C_MANAGER_0_FREQ_HZ
				int "Frequency (Hz)"
				default 400000
				range 100000 5000000
				help
					The clock speed in Hz. Ranges from 100000 (100 kHz) to
					5000000 (5 Mhz). I2C busses that involve external wires may
					have to be slower, and the real maximum speed the bus will
					support depends on the value of the pullup resistors and the
					design of the overall circuit.
			config I2C_MANAGER_0_TIMEOUT
				int "R/W timeout (ms)"
				default 20
				range 10 1000
				help
					Timeout for I2C read and write operations. This does not
					include the time waiting for a lock.
			config I2C_MANAGER_0_LOCK_TIMEOUT
				int "Stale lock override (ms)"
				default 50
				range 10 1000
				help
					Timeout at which point an operation waiting for its turn on
					the port will assume that whatever set the lock has died and
					overrides it. Set this somewhat larger than the previous
					timeout.
			config I2C_MANAGER_0_PULLUPS
				bool "Use ESP32 built-in bus pull-up resistors"
				help
					The I2C bus needs resistors to make sure it's in a defined
					state when nobody is talking. Many circuits have external
					pullup resistors already and turning these on will increase
					power consumption slightly and may limit the speed your bus
					can attain. Try with these off first if you don't know.
		endif

	endmenu


	menu "I2C Port 1"

		config I2C_MANAGER_1_ENABLED
			bool "Enable I2C port 1"

		if I2C_MANAGER_1_ENABLED
			config I2C_MANAGER_1_SDA
				int "SDA (GPIO pin)"
			config I2C_MANAGER_1_SCL
				int "SCL (GPIO pin)"
			config I2C_MANAGER_1_FREQ_HZ
				int "Frequency (Hz)"
				default 1000000
				range 100000 5000000
				help
					The clock speed in Hz. Ranges from 100000 (100 kHz) to
					5000000 (5 Mhz). I2C busses that involve external wires may
					have to be slower, and the real maximum speed the bus will
					support depends on the value of the pullup resistors and the
					design of the overall circuit.
			config I2C_MANAGER_1_TIMEOUT
				int "R/W timeout (ms)"
				default 20
				range 10 1000
				help
					Timeout for I2C read and write operations. This does not
					include the time waiting for a lock. Default should be fine.
			config I2C_MANAGER_1_LOCK_TIMEOUT
				int "Stale lock override (ms)"
				default 50
				help
					Timeout at which point an operation waiting for its turn on
					the port will assume that whatever set the lock has died and
					overrides it. Set this somewhat larger than the previous
					timeout. Default should be fine.
				range 30 1000
			config I2C_MANAGER_1_PULLUPS
				bool "Use ESP32 built-in bus pull-up resistors"
				help
					The I2C bus needs resistors to make sure it's in a defined
					state when nobody is talking. Many circuits have external
					pullup resistors already and turning these on will increase
					power consumption slightly and may limit the speed your bus
					can attain. Try with these off first if you don't know.
		endif

	endmenu

endmenu