# nRF9160 DK NRF52840 board configuration

# Copyright (c) 2018-2020 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

if BOARD_NRF9160DK_NRF52840

config BOARD_ENABLE_DCDC
	bool "Enable DCDC mode"
	select SOC_DCDC_NRF52X
	default y

choice
	prompt "nRF9160 UART0 routing"
	default BOARD_NRF9160DK_UART0_VCOM

config BOARD_NRF9160DK_UART0_VCOM
	bool "Route to VCOM0"

config BOARD_NRF9160DK_UART0_ARDUINO
	bool "Route to Arduino pins"

endchoice

choice
	prompt "nRF9160 UART1 routing"
	default BOARD_NRF9160DK_UART1_VCOM

config BOARD_NRF9160DK_UART1_VCOM
	bool "Route to VCOM2"

config BOARD_NRF9160DK_UART1_ARDUINO
	bool "Route to Arduino pins"

endchoice

choice
	prompt "LED 1 routing"
	default BOARD_NRF9160DK_LED0_PHY

config BOARD_NRF9160DK_LED0_PHY
	bool "Route to LED on the kit"

config BOARD_NRF9160DK_LED0_ARDUINO
	bool "Route to Arduino pins"

endchoice

choice
	prompt "LED 2 routing"
	default BOARD_NRF9160DK_LED1_PHY

config BOARD_NRF9160DK_LED1_PHY
	bool "Route to LED on the kit"

config BOARD_NRF9160DK_LED1_ARDUINO
	bool "Route to Arduino pins"

endchoice

choice
	prompt "LED 3 routing"
	default BOARD_NRF9160DK_LED2_PHY

config BOARD_NRF9160DK_LED2_PHY
	bool "Route to LED on the kit"

config BOARD_NRF9160DK_LED2_ARDUINO
	bool "Route to Arduino pins"

endchoice

choice
	prompt "LED 4 routing"
	default BOARD_NRF9160DK_LED3_PHY

config BOARD_NRF9160DK_LED3_PHY
	bool "Route to LED on the kit"

config BOARD_NRF9160DK_LED3_ARDUINO
	bool "Route to Arduino pins"

endchoice

choice
	prompt "Button 1 routing"
	default BOARD_NRF9160DK_BUTTON0_PHY

config BOARD_NRF9160DK_BUTTON0_PHY
	bool "Route to buttons on the kit"

config BOARD_NRF9160DK_BUTTON0_ARDUINO
	bool "Route to Arduino pins"

endchoice

choice
	prompt "Button 2 routing"
	default BOARD_NRF9160DK_BUTTON1_PHY

config BOARD_NRF9160DK_BUTTON1_PHY
	bool "Route to buttons on the kit"

config BOARD_NRF9160DK_BUTTON1_ARDUINO
	bool "Route to Arduino pins"

endchoice

choice
	prompt "Switch 1 routing"
	default BOARD_NRF9160DK_SWITCH0_PHY

config BOARD_NRF9160DK_SWITCH0_PHY
	bool "Route to switches on the kit"

config BOARD_NRF9160DK_SWITCH0_ARDUINO
	bool "Route to Arduino pins"

endchoice

choice
	prompt "Switch 2 routing"
	default BOARD_NRF9160DK_SWITCH1_PHY

config BOARD_NRF9160DK_SWITCH1_PHY
	bool "Route to switches on the kit"

config BOARD_NRF9160DK_SWITCH1_ARDUINO
	bool "Route to Arduino pins"

endchoice

choice
	prompt "Interface pins 0-2"
	default BOARD_NRF9160DK_INTERFACE0_MCU

config BOARD_NRF9160DK_INTERFACE0_ARDUINO
	bool "Route to Arduino pins"
	help
	  Pin 0: nRF9160 P0.17 connects to A3
	  Pin 1: nRF9160 P0.18 connects to A4
	  Pin 2: nRF9160 P0.19 connects to A5

config BOARD_NRF9160DK_INTERFACE0_MCU
	bool "Route to nRF52840"
	help
	  This connects the following pins on the nRF9160 to pins on the nRF52840:
	  Pin 0: nRF9160 P0.17 connects to nRF52840 P0.17
	  Pin 1: nRF9160 P0.18 connects to nRF52840 P0.20
	  Pin 2: nRF9160 P0.19 connects to nRF52840 P0.15

endchoice

choice
	prompt "Interface pins 3-5"
	default BOARD_NRF9160DK_INTERFACE1_TRACE

config BOARD_NRF9160DK_INTERFACE1_TRACE
	bool "Route to TRACE interface"
	help
	  Pin 3: nRF9160 P0.21 connects to TRACECLK
	  Pin 4: nRF9160 P0.22 connects to TRACEDATA0
	  Pin 5: nRF9160 P0.23 connects to TRACEDATA1

config BOARD_NRF9160DK_INTERFACE1_MCU
	bool "Route to nRF52840"
	help
	  Pin 3: nRF9160 P0.21 connects to nRF52840 P0.22
	  Pin 4: nRF9160 P0.22 connects to nRF52840 P1.04
	  Pin 5: nRF9160 P0.23 connects to nRF52840 P1.02

endchoice

choice
	prompt "Interface pins 6-8"
	default BOARD_NRF9160DK_INTERFACE2_COEX

config BOARD_NRF9160DK_INTERFACE2_COEX
	bool "Route to COEX interface"
	help
	  Pin 6: nRF9160 COEX0 connects to COEX0_PH
	  Pin 7: nRF9160 COEX1 connects to COEX1_PH
	  Pin 8: nRF9160 COEX2 connects to COEX2_PH

config BOARD_NRF9160DK_INTERFACE2_MCU
	bool "Route to nRF52840"
	help
	  Pin 6: nRF9160 COEX0 connects to nRF52840 P1.13
	  Pin 7: nRF9160 COEX1 connects to nRF52840 P1.11
	  Pin 8: nRF9160 COEX2 connects to nRF52840 P1.15

endchoice

config BOARD_NRF9160DK_NRF52840_RESET
	bool "Enable GPIO reset line"
	help
	  Let the nRF52840 be reset from the nRF9160 via a GPIO line.
	  The GPIO line may only be one of the first 6 MCU interface pins.
	  The line is active high.

choice
	prompt "Pin used for reset"
	depends on BOARD_NRF9160DK_NRF52840_RESET

comment "nRF52840 pins"

config BOARD_NRF9160DK_NRF52840_RESET_P0_17
	bool "P0.17"
	depends on BOARD_NRF9160DK_INTERFACE0_MCU
	help
	  Pin P0.17 on nRF52840,
	  connected to P0.17 on the nRF9160.

config BOARD_NRF9160DK_NRF52840_RESET_P0_20
	bool "P0.20"
	depends on BOARD_NRF9160DK_INTERFACE0_MCU
	help
	  Pin P0.20 on nRF52840,
	  connected to P0.18 on the nRF9160.

config BOARD_NRF9160DK_NRF52840_RESET_P0_15
	bool "P0.15"
	depends on BOARD_NRF9160DK_INTERFACE0_MCU
	help
	  Pin P0.15 on nRF52840,
	  connected to P0.19 on the nRF9160.

config BOARD_NRF9160DK_NRF52840_RESET_P0_22
	bool "P0.22"
	depends on BOARD_NRF9160DK_INTERFACE1_MCU
	help
	  Pin P0.22 on nRF52840,
	  connected to P0.21 on the nRF9160.

config BOARD_NRF9160DK_NRF52840_RESET_P1_04
	bool "P1.04"
	depends on BOARD_NRF9160DK_INTERFACE1_MCU
	help
	  Pin P1.04 on nRF52840,
	  connected to P0.22 on the nRF9160.

config BOARD_NRF9160DK_NRF52840_RESET_P1_02
	bool "P1.02"
	depends on BOARD_NRF9160DK_INTERFACE1_MCU
	help
	  Pin P1.02 on nRF52840,
	  connected to P0.23 on the nRF9160.

endchoice

module = BOARD_NRF9160DK
module-str = Board Control
source "subsys/logging/Kconfig.template.log_config"

endif # BOARD_NRF52840_NRF9160DK
