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

#####################################################################
#  Build Configuration
#####################################################################

config RP2040_FLASH_BOOT
	bool "flash boot"
	default y
	---help---
		If y, the built binary can be used for flash boot.
		If not, the binary is for SRAM boot.

config RP2040_FLASH_CHIP
	string "Second stage boot loader"
	default "w25q080"
	---help---
		This is the name of the Pico-SDK second stage boot loader
		to use for this board.  This board using a Q16 flash chip
		which is compatible with the w25q080 boot loader.
		Basically this option should not be changed.

config RP2040_UF2_BINARY
	bool "uf2 binary format"
	default y
	---help---
		Create nuttx.uf2 binary format used on RP2040 based arch.

#####################################################################
#  UART Configuration
#####################################################################

if RP2040_UART0

config RP2040_UART0_TX_GPIO
	int "GPIO pin for UART0 TX (0, 12, 16, or 28)"
	default 0
	range 0 28
	---help---
		RP2040 UART0 TX pin number used for data transmitted
		from the RP2040.  Refer to board documentation to see
		which pins are available.

config RP2040_UART0_RX_GPIO
	int "GPIO pin for UART0 RX (1, 13, 17, or 29)"
	default 1
	range 1 29
	---help---
		RP2040 UART0 RX pin number used for data received by the
		RP2040.  Refer to board documentation to see which pins
		are available.

if SERIAL_IFLOWCONTROL

config RP2040_UART0_CTS_GPIO
	int "GPIO pin for UART0 CTS (2, 14, or 18)"
	default 2
	range 2 18
	---help---
		RP2040 UART0 CTS pin number an output pin that reflects the
		UARTs ability to receive data.  This pin will be asserted when
		the UART is able to receive another character.  Refer to board
		documentation to see which pins are available.

endif # SERIAL_IFLOWCONTROL

if SERIAL_OFLOWCONTROL

config RP2040_UART0_RTS_GPIO
	int "GPIO pin for UART0 RTS (3, 15, or 19)"
	default 3
	range 2 19
	---help---
		RP2040 UART0 RTS pin number an input pin used to control
		transmission by the UART.  If output flow control is
		enabled this pin must be asserted before data will be
		transmitted.  Refer to board documentation to see which
		pins are available.

endif # SERIAL_OFLOWCONTROL

endif # RP2040_UART0

#####################################################################

if RP2040_UART1

config RP2040_UART1_TX_GPIO
	int "GPIO pin for UART1 TX (4, 8, 20, or 24)"
	default 20
	range 4 24
	---help---
		RP2040 UART1 TX pin number.  Refer to board documentation
		to see which pins are available.

config RP2040_UART1_RX_GPIO
	int "GPIO pin for UART1 RX (5, 9, 21, or 25)"
	default 21
	range 5 25
	---help---
		RP2040 UART1 RX pin number.  Refer to board documentation
		to see which pins are available.

if SERIAL_IFLOWCONTROL

config RP2040_UART1_CTS_GPIO
	int "GPIO pin for UART1 CTS (6, 10, 22, or 26)"
	default 22
	range 6 26
	---help---
		RP2040 UART1 CTS pin number an output pin that reflects the
		UARTs ability to receive data.  This pin will be asserted when
		the UART is able to receive another character.  Refer to board
		documentation to see which pins are available.

endif # SERIAL_IFLOWCONTROL

if SERIAL_OFLOWCONTROL

config RP2040_UART1_RTS_GPIO
	int "GPIO pin for UART1 RTS (7, 11, 23, or 27)"
	default 23
	range 7 27
	---help---
		RP2040 UART01 RTS pin number an input pin used to control
		transmission by the UART.  If output flow control is
		enabled this pin must be asserted before data will be
		transmitted.  Refer to board documentation to see which
		pins are available.

endif # SERIAL_OFLOWCONTROL

endif # RP2040_UART1

#####################################################################
#  SPI Configuration
#####################################################################

if RP2040_SPI0

config RP2040_SPI0_RX_GPIO
	int "GPIO pin for SPI0 RX (0, 4, 16, or 20)"
	default 16
	range 0 20
	---help---
		Refer to board documentation to see which pins are available.
		This line is also known as MISO when we are configured in
		SPI master mode.

config RP2040_SPI0_CS_GPIO
	int "GPIO pin for SPI0 CSn (1, 5, 17, or 21)"
	default 17
	range 1 21
	---help---
		Refer to board documentation to see which pins are available.


config RP2040_SPI0_SCK_GPIO
	int "GPIO pin for SPI0 SCK (2, 6, 18, or 22)"
	default 18
	range 2 22
	---help---
		Refer to board documentation to see which pins are available.

config RP2040_SPI0_TX_GPIO
	int "GPIO pin for SPI0 TX (3, 7, 19, or 23)"
	default 19
	range 3 23
	---help---
		Refer to board documentation to see which pins are available.
		This line is also known as MOSI when we are configured in
		SPI master mode.

endif # RP2040_SPI0

#####################################################################

if RP2040_SPI1

config RP2040_SPI1_RX_GPIO
	int "GPIO pin for SPI1 RX (8, 12, 24, or 28)"
	default 8
	range 8 28
	---help---
		Refer to board documentation to see which pins are available.
		This line is also known as MISO when we are configured in
		SPI master mode, or MOSI when slave mode is configured.

config RP2040_SPI1_CS_GPIO
	int "GPIO pin for SPI1 CSn (9, 13, 25, or 29)"
	default 9
	range 9 29
	---help---
		Refer to board documentation to see which pins are available.

config RP2040_SPI1_SCK_GPIO
	int "GPIO pin for SPI1 SCK (10, 14, or 26)"
	default 10
	range 10 26
	---help---
		Refer to board documentation to see which pins are available.

config RP2040_SPI1_TX_GPIO
	int "GPIO pin for SPI1 TX (11, 15, or 27)"
	default 11
	range 11 27
	---help---
		Refer to board documentation to see which pins are available.
		This line is also known as MOSI when we are configured in
		SPI master mode, or MISO when slave mode is configured.

endif # RP2040_SPI1

#####################################################################
#  I2C Configuration
#####################################################################

if RP2040_I2C0 || RP2040_I2C0_SLAVE

config RP2040_I2C0_SDA_GPIO
	int "GPIO pin for I2C0 SDA (0, 4, 8, 12, 16, 20, 24, or 28)"
	default 4
	range 0 28
	---help---
		Refer to board documentation to see which pins are available.

config RP2040_I2C0_SCL_GPIO
	int "GPIO pin for I2C0 SCL (1, 5, 9, 13, 17, 21, 25, or 29)"
	default 5
	range 1 29
	---help---
		Refer to board documentation to see which pins are available.

endif # RP2040_I2C0 || RP2040_I2C0_SLAVE

#####################################################################

if RP2040_I2C1 || RP2040_I2C1_SLAVE

config RP2040_I2C1_SDA_GPIO
	int "GPIO pin for I2C1 SDA (2, 6, 10, 14, 18, 22, or 26)"
	default 6
	range 2 26
	---help---
		Refer to board documentation to see which pins are available.

config RP2040_I2C1_SCL_GPIO
	int "GPIO pin for I2C1 SCL (3, 7, 11, 15, 19, 23, or 27)"
	default 7
	range 3 27
	---help---
		Refer to board documentation to see which pins are available.

endif # RP2040_I2C1 || RP2040_I2C1_SLAVE

#####################################################################
#  PWM Configuration
#####################################################################

if RP2040_PWM0

config RP2040_PWM0A_GPIO
	int "GPIO pin for PWM0 channel 1 (0, 16 or -1:no assign)"
	default 0
	range -1 16
	---help---
		This sets the GPIO pin to use for the A channel it must be
		either 0 or 16, any other value disables the output.
		Refer to board documentation to see which pins are available.

if PWM_MULTICHAN && PWM_NCHANNELS > 1

config RP2040_PWM0B_GPIO
	int "GPIO pin for PWM0 channel 2 (1, 17 or -1:no assign)"
	default 1
	range -1 29
	---help---
		This sets the GPIO pin to use for the B channel it must be
		either 1 or 17, any other value disables the output.
		Refer to board documentation to see which pins are available.

endif # PWM_MULTICHAN && PWM_NCHANNELS > 1

endif # RP2040_PWM0

#####################################################################

if RP2040_PWM1

config RP2040_PWM1A_GPIO
	int "GPIO pin for PWM1 channel 1 (2, 18 or -1:no assign)"
	default 2
	range -1 29
	---help---
		This sets the GPIO pin to use for the A channel it must be
		either 2 or 18, any other value disables the output.
		Refer to board documentation to see which pins are available.

if PWM_MULTICHAN && PWM_NCHANNELS > 1

config RP2040_PWM1B_GPIO
	int "GPIO pin for PWM1 channel 2 (3, 19 or -1:no assign)"
	default 3
	range -1 29
	---help---
		This sets the GPIO pin to use for the B channel it must be
		either 3 or 19, any other value disables the output.
		Refer to board documentation to see which pins are available.

endif # PWM_MULTICHAN && PWM_NCHANNELS > 1

endif # RP2040_PWM1

#####################################################################

if RP2040_PWM2

config RP2040_PWM2A_GPIO
	int "GPIO pin for PWM2 channel 1 (4, 20 or -1:no assign)"
	default 4
	range -1 29
	---help---
		This sets the GPIO pin to use for the A channel it must be
		either 4 or 20, any other value disables the output.
		Refer to board documentation to see which pins are available.

if PWM_MULTICHAN && PWM_NCHANNELS > 1

config RP2040_PWM2B_GPIO
	int "GPIO pin for PWM2 channel 2 (5, 21 or -1:no assign)"
	default 5
	range -1 29
	---help---
		This sets the GPIO pin to use for the B channel it must be
		either 5 or 21, any other value disables the output.
		Refer to board documentation to see which pins are available.

endif # PWM_MULTICHAN && PWM_NCHANNELS > 1

endif # RP2040_PWM2

#####################################################################

if RP2040_PWM3

config RP2040_PWM3A_GPIO
	int "GPIO pin for PWM3 channel 1 (6, 22 or -1:no assign)"
	default 6
	range -1 29
	---help---
		This sets the GPIO pin to use for the A channel it must be
		either 6 or 22, any other value disables the output.
		Refer to board documentation to see which pins are available.

if PWM_MULTICHAN && PWM_NCHANNELS > 1

config RP2040_PWM3B_GPIO
	int "GPIO pin for PWM3 channel 2 (7, 23 or -1:no assign)"
	default 7
	range -1 29
	---help---
		This sets the GPIO pin to use for the B channel it must be
		either 7 or 23, any other value disables the output.
		Refer to board documentation to see which pins are available.

endif # PWM_MULTICHAN && PWM_NCHANNELS > 1

endif # RP2040_PWM3

#####################################################################

if RP2040_PWM4

config RP2040_PWM4A_GPIO
	int "GPIO pin for PWM4 channel 1 (8, 24 or -1:no assign)"
	default 8
	range -1 29
	---help---
		This sets the GPIO pin to use for the A channel it must be
		either 8 or 24, any other value disables the output.
		Refer to board documentation to see which pins are available.

if PWM_MULTICHAN && PWM_NCHANNELS > 1

config RP2040_PWM4B_GPIO
	int "GPIO pin for PWM4 channel 2 (9, 25 or -1:no assign)"
	default 9
	range -1 29
	---help---
		This sets the GPIO pin to use for the B channel it must be
		either 9 or 25, any other value disables the output.
		Refer to board documentation to see which pins are available.

endif # PWM_MULTICHAN && PWM_NCHANNELS > 1

endif # RP2040_PWM4

#####################################################################

if RP2040_PWM5

config RP2040_PWM5A_GPIO
	int "GPIO pin for PWM5 channel 1 (10, 26 or -1:no assign)"
	default 10
	range -1 29
	---help---
		This sets the GPIO pin to use for the A channel it must be
		either 10 or 26, any other value disables the output.
		Refer to board documentation to see which pins are available.

if PWM_MULTICHAN && PWM_NCHANNELS > 1

config RP2040_PWM5B_GPIO
	int "GPIO pin for PWM5 channel 2 (11, 27 or -1:no assign)"
	default 11
	range -1 29
	---help---
		This sets the GPIO pin to use for the B channel it must be
		either 11 or 27, any other value disables the output.
		Refer to board documentation to see which pins are available.

endif # PWM_MULTICHAN && PWM_NCHANNELS > 1

endif # RP2040_PWM5

#####################################################################

if RP2040_PWM6

config RP2040_PWM6A_GPIO
	int "GPIO pin for PWM6 channel 1 (12, 28 or -1:no assign)"
	default 12
	range -1 29
	---help---
		This sets the GPIO pin to use for the A channel it must be
		either 12 or 28, any other value disables the output.
		Refer to board documentation to see which pins are available.

if PWM_MULTICHAN && PWM_NCHANNELS > 1

config RP2040_PWM6B_GPIO
	int "GPIO pin for PWM6 channel 2 (13, 29 or -1:no assign)"
	default 13
	range -1 29
	---help---
		This sets the GPIO pin to use for the B channel it must be
		either 13 or 29, any other value disables the output.
		Refer to board documentation to see which pins are available.

endif # PWM_MULTICHAN && PWM_NCHANNELS > 1

endif # RP2040_PWM6

#####################################################################

if RP2040_PWM7

config RP2040_PWM7A_GPIO
	int "GPIO pin for PWM7 channel 1 (14 or -1:no assign)"
	default 14
	range -1 29
	---help---
		This sets the GPIO pin to use for the A channel it must be
		either 14, any other value disables the output.
		Refer to board documentation to see if pin 14 is available.

if PWM_MULTICHAN && PWM_NCHANNELS > 1

config RP2040_PWM7B_GPIO
	int "GPIO pin for PWM7 channel 2 (15 or -1:no assign)"
	default 15
	range -1 29
	---help---
		This sets the GPIO pin to use for the B channel it must be
		either 15, any other value disables the output.
		Refer to board documentation to see if pin 15 is available.

endif # PWM_MULTICHAN && PWM_NCHANNELS > 1

endif # RP2040_PWM7

#####################################################################
#  I2S Configuration
#####################################################################

if RP2040_I2S

config RP2040_I2S_DATA
	int "GPIO pin for I2S DATA (0-29)"
	default 9
	range 0 29

config RP2040_I2S_CLOCK
	int "GPIO pin for I2S CLOCK (0-29)"
	default 10
	range 0 29

endif # RP2040_I2S

#####################################################################
#  WS2812 Configuration
#####################################################################

if RP2040_BOARD_HAS_WS2812

config RP2040_WS2812_GPIO_PIN
	int "GPIO pin for ws2812 data line (0-29)"
	default 0
	range 0 29
	---help---
		This is the GPIO pin used to send data to the
		configured ws2812 pixels.

config RP2040_WS2812_PWR_GPIO
	int "GPIO pin for ws2812 power (0-29, or -1 if not used)"
	default -1
	range -1 29
	---help---
		Some RP2040 boards have an on-board ws2812
		that is powered by a GPIO pin.  Set this
		value to -1 if your board does not have
		such a pin.

endif # RP2040_BOARD_HAS_WS2812

#####################################################################
#  FLASH File System Configuration
#####################################################################

if RP2040_FLASH_FILE_SYSTEM

config RP2040_FLASH_LENGTH
	int "Size of flash memory in bytes."
	default 2097152
	---help---
		This is the overall amount of flash memory on the board.

endif # RP2040_FLASH_FILE_SYSTEM

#####################################################################
#  LCD Configuration
#####################################################################

if LCD

config RP2040_LCD_SPI_CH
	int "RP2040 LCD SPI channel number"
	default 0
	range 0 1
	---help---
		Select SPI channel number to use LCD display.

endif # LCD

#####################################################################
#  Ethernet Configuration
#####################################################################

if ENC28J60

config RP2040_ENC28J60_SPI_CH
	int "ENC28J60 SPI channel number"
	default 1
	range 0 1
	---help---
		Select SPI channel number to use ENC28J60 ethernet.

config RP2040_ENC28J60_INTR_GPIO
	int "ENC28J60 interrupt GPIO pin assign"
	default -1
	range -1 29

config RP2040_ENC28J60_RESET_GPIO
	int "ENC28J60 reset GPIO pin assign (optional)"
	default -1
	range -1 29

endif # ENC28J60
