Added Adafruit QT Py RP2040 board.

Added ability to configure indivdual UART, SPI and I2C pin location.
This commit is contained in:
curuvar 2022-07-21 21:04:05 -04:00 committed by Xiang Xiao
parent 421b8ae3e7
commit c21c7ac8dc
113 changed files with 4007 additions and 1836 deletions

View File

@ -55,9 +55,10 @@ the power.
Pin Mapping
===========
Pads numbered anticlockwise from USB connector.
===== ========== ==========
Pin Signal Notes
Pad Signal Notes
===== ========== ==========
1 Reset Pull to ground to reset the RP2040 processor.
2 3.3V Power out to peripherals.

View File

@ -50,9 +50,10 @@ A ws2812 (NeoPixel) smart RGB LED controlled by GPIO17.
Pin Mapping
===========
Pads numbered anticlockwise from USB connector.
===== ========== ==========
Pin Signal Notes
Pad Signal Notes
===== ========== ==========
1 D+ Alternate USB data connection.
2 GPIO0 Default TX for UART0 serial console

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

View File

@ -0,0 +1,119 @@
=======================
Adafruit QT Py RP2040
=======================
The QT Py RP2040 is a tiny general purpose RP2040 board supplied by
Adafruit.
.. figure:: QT-Py.png
:align: center
Features
========
* RP2040 microcontroller chip
* Dual-core ARM Cortex M0+ processor, flexible clock running up to 133 MHz
* 264kB of SRAM, and 8MB of on-board Flash memory
* Castellated module allows soldering direct to carrier boards
* USB Host and Device support via type C connector.
* Low-power sleep and dormant modes
* Drag & drop programming using mass storage over USB
* 13 multi-function GPIO pins (11 breakout pads and two QT pads)
* 2× SPI, 2× I2C, 2× UART, 4× 12-bit ADC, 16× controllable PWM channels
* Accurate clock and timer on-chip
* Temperature sensor
* Accelerated floating point libraries on-chip
* 8 × Programmable IO (PIO) state machines for custom peripheral support
Serial Console
==============
By default a serial console appears on GPIO pins 20 (RX GPIO1) and pin 5
(TX GPIO1). This console runs a 115200-8N1.
The board can be configured to use the USB connection as the serial console.
Buttons and LEDs
================
A ws2812 (NeoPixel) smart RGB LED controlled by GPIO12 (data) and
GPIO11 (power).
There is a BOOT button which if held down when power is first
applied or the RESET button is pressed will cause the RP2040 to
boot into program mode and appear as a storage device to
a USB connecter. Saving a .UF2 file to this device will
replace the Flash ROM contents on the RP2040.
A RESET button that allows rebooting the board without disconnecting
the power.
Pin Mapping
===========
Pads numbered anticlockwise from USB connector.
===== ========== ==========
Pad Signal Notes
===== ========== ==========
1 GPIO26 ADC0
2 GPIO27 ADC1
3 GPIO28 ADC2
4 GPIO29 ADC3
5 GPIO24
6 GPIO25
7 GPIO20 Default TX for UART1 serial console
8 GPIO5 Default RX for UART1 serial console
9 GPIO6
10 GPIO4
11 GPIO3
12 3.3V Power out to peripherals.
13 Ground
14 5V
===== ========== ==========
The board has a STEMMA QT connector that is also connected to
pins GPIO22 (I2C1 SDA) and GPIO23 (I2C1 SCL).
Power Supply
============
The Raspberry Pi Pico can be powered via the USB connector,
or by supplying +5V to pin 14. The board had a diode that prevents
power from pin 14 from flowing back to the USB socket, although
this can be disabled by connecting on-board solder pads if there
is need to run as a usb host.
The Raspberry Pi Pico chip run on 3.3 volts which is supplied by
an on board regulator.
Configurations
==============
gpio
--------
NuttShell configuration (console enabled in UART1, at 115200 bps) with GPIO examples.
nsh
---
Basic NuttShell configuration (console enabled in UART1, at 115200 bps).
nshsram
-------
NuttShell configuration (console enabled in UART1, at 115200 bps) with interrupt
vectors in RAM.
smp
---
Basic NuttShell configuration (console enabled in UART1, at 115200 bps) with
both ARM cores enabled.
usbnsh
------
Basic NuttShell configuration (console enabled in USB Port, at 115200 bps).

View File

@ -46,9 +46,10 @@ on the RP2040.
Pin Mapping
===========
Pads numbered anticlockwise from USB connector.
===== ========== ==========
Pin Signal Notes
Pad Signal Notes
===== ========== ==========
1 VBUS Connected to USB +5V
2 Ground

View File

@ -46,9 +46,10 @@ on the RP2040.
Pin Mapping
===========
Pads numbered anticlockwise from USB connector.
===== ========== ==========
Pin Signal Notes
Pad Signal Notes
===== ========== ==========
1 GPIO0 Default TX for UART0 serial console
2 GPIO1 Default RX for UART1 serial console

View File

@ -236,6 +236,7 @@ config ARCH_CHIP_RP2040
select ARM_HAVE_WFE_SEV
select LIBC_ARCH_ATOMIC
select ARCH_HAVE_PWM_MULTICHAN
select ARCH_BOARD_COMMON
---help---
Raspberry Pi RP2040 architectures (ARM dual Cortex-M0+).

View File

@ -3,229 +3,261 @@
# see the file kconfig-language.txt in the NuttX tools repository.
#
comment "RP2040 Configuration Options"
config RP2040_UART0
bool "UART0"
default y
select UART0_SERIALDRIVER
select ARCH_HAVE_SERIAL_TERMIOS
if RP2040_UART0
config RP2040_UART0_BAUD
int "RP2040 UART0 BAUD"
default 115200
config RP2040_UART0_PARITY
int "RP2040 UART0 parity"
default 0
range 0 2
---help---
RP2040 UART0 parity. 0=None, 1=Odd, 2=Even. Default: None
config RP2040_UART0_BITS
int "RP2040 UART0 number of bits"
default 8
range 5 8
---help---
RP2040 UART0 number of bits. Default: 8
config RP2040_UART0_2STOP
int "RP2040 UART0 two stop bits"
default 0
---help---
0=1 stop bit, 1=Two stop bits. Default: 1 stop bit
endif
config RP2040_UART1
bool "UART1"
default n
select UART1_SERIALDRIVER
select ARCH_HAVE_SERIAL_TERMIOS
if RP2040_UART1
config RP2040_UART1_BAUD
int "RP2040 UART1 BAUD"
default 115200
config RP2040_UART1_PARITY
int "RP2040 UART1 parity"
default 0
range 0 2
---help---
RP2040 UART1 parity. 0=None, 1=Odd, 2=Even. Default: None
config RP2040_UART1_BITS
int "RP2040 UART1 number of bits"
default 8
range 5 8
---help---
RP2040 UART1 number of bits. Default: 8
config RP2040_UART1_2STOP
int "RP2040 UART1 two stop bits"
default 0
---help---
0=1 stop bit, 1=Two stop bits. Default: 1 stop bit
endif
comment "RP2040 Configuration Options"
config RP2040_DMAC
bool "DMAC support"
default y
select ARCH_DMA
#####################################################################
# UART Configuration
#####################################################################
config RP2040_UART0
bool "UART0"
default y
select UART0_SERIALDRIVER
select ARCH_HAVE_SERIAL_TERMIOS
---help---
Most UART parameters are configured here. See also the
Board Selection menu to configure the pins used by UART0
if RP2040_UART0
config RP2040_UART0_BAUD
int "RP2040 UART0 BAUD"
default 115200
---help---
RP2040 UART0 communication bit rate. The range of available
baud rates depend on the clock supplied to the UART. Given
the normally configured 125 MHz clock, the baud
rates between 120 and 7 812 500 baud are available.
config RP2040_UART0_PARITY
int "RP2040 UART0 parity"
default 0
range 0 2
---help---
RP2040 UART0 parity. 0=None, 1=Odd, 2=Even. Default: None
config RP2040_UART0_BITS
int "RP2040 UART0 number of bits"
default 8
range 5 8
---help---
RP2040 UART0 number of bits. Default: 8
config RP2040_UART0_2STOP
int "RP2040 UART0 two stop bits"
default 0
---help---
0=1 stop bit, 1=Two stop bits. Default: 1 stop bit
endif # RP2040_UART0
#####################################################################
config RP2040_UART1
bool "UART1"
default n
select UART1_SERIALDRIVER
select ARCH_HAVE_SERIAL_TERMIOS
---help---
Most UART parameters are configured here. See also the
Board Selection menu to configure the pins used by UART1
if RP2040_UART1
config RP2040_UART1_BAUD
int "RP2040 UART1 BAUD"
default 115200
---help---
RP2040 UART0 communication bit rate. The range of available
baud rates depend on the clock supplied to the UART. Given
the normally configured 125 MHz clock, the baud
rates between 120 and 7 812 500 baud are available.
config RP2040_UART1_PARITY
int "RP2040 UART1 parity"
default 0
range 0 2
---help---
RP2040 UART1 parity. 0=None, 1=Odd, 2=Even. Default: None
config RP2040_UART1_BITS
int "RP2040 UART1 number of bits"
default 8
range 5 8
---help---
RP2040 UART1 number of bits. Default: 8
config RP2040_UART1_2STOP
int "RP2040 UART1 two stop bits"
default 0
---help---
0=1 stop bit, 1=Two stop bits. Default: 1 stop bit
endif
#####################################################################
# SPI Configuration
#####################################################################
config RP2040_SPI
bool "SPI"
bool "SPI Master Mode Support"
select SPI
if RP2040_SPI
config RP2040_SPI0
bool "SPI0"
config RP2040_SPI0
bool "SPI0"
default n
---help---
Most SPI parameters are configured here. See also the
Board Selection menu to configure the pins used by SPI0
config RP2040_SPI1
bool "SPI1"
config RP2040_SPI1
bool "SPI1"
default n
---help---
Most SPI parameters are configured here. See also the
Board Selection menu to configure the pins used by SPI1
config RP2040_SPI_DMA
bool "SPI DMA"
default y
depends on RP2040_DMAC
---help---
Use DMA to improve SPI transfer performance.
config RP2040_SPI_DMA
bool "SPI DMA"
default y
depends on RP2040_DMAC
---help---
Use DMA to improve SPI transfer performance.
config RP2040_SPI_DMATHRESHOLD
int "SPI DMA threshold"
default 4
depends on RP2040_SPI_DMA
---help---
When SPI DMA is enabled, small DMA transfers will still be performed
by polling logic. But we need a threshold value to determine what
is small. That value is provided by RP2040_SPI_DMATHRESHOLD.
config RP2040_SPI_DMATHRESHOLD
int "SPI DMA threshold"
default 4
depends on RP2040_SPI_DMA
---help---
When SPI DMA is enabled, small DMA transfers will still be performed
by polling logic. But we need a threshold value to determine what
is small. That value is provided by RP2040_SPI_DMATHRESHOLD.
config RP2040_SPI_DRIVER
bool "SPI character driver"
default y
select SPI_DRIVER
---help---
Build in support for a character driver at /dev/spi[N] that may be
used to perform SPI bus transfers from applications. The intent of
this driver is to support SPI testing.
config RP2040_SPI_DRIVER
bool "SPI character driver"
default y
select SPI_DRIVER
---help---
Build in support for a character driver at /dev/spi[N] that may be
used to perform SPI bus transfers from applications. The intent of
this driver is to support SPI testing.
endif
endif # RP2040_SPI
#####################################################################
# I2C Configuration (Master)
#####################################################################
config RP2040_I2C
bool "I2C Master"
select I2C
---help---
Build in support for I2C master mode.
Note: Do not configure the same port as both master and slave.
if RP2040_I2C
config RP2040_I2C0
bool "I2C0"
config RP2040_I2C0
bool "I2C0"
default n
---help---
See the Board Selection menu to configure the pins used by I2C0.
config RP2040_I2C1
bool "I2C1"
config RP2040_I2C1
bool "I2C1"
default n
---help---
See the Board Selection menu to configure the pins used by I2C1.
config RP2040_I2C_DRIVER
bool "I2C character driver"
default n
select I2C_DRIVER
---help---
Build in support for a character driver at /dev/i2c[N] that may be
used to perform I2C bus transfers from applications. The intent of
this driver is to support I2C testing. It is not suitable for use
in any real driver application.
config RP2040_I2C_DRIVER
bool "I2C character driver"
default n
select I2C_DRIVER
---help---
Build in support for a character driver at /dev/i2c[N] that may be
used to perform I2C bus transfers from applications. The intent of
this driver is to support I2C testing. It is not suitable for use
in any real driver application.
endif
endif # RP2040_I2C
#####################################################################
# I2C Configuration (Slave)
#####################################################################
config RP2040_I2C_SLAVE
bool "I2C Slave"
select I2C_SLAVE
---help---
Build in support for I2C slave mode.
Note: Do not configure the same port as both master and slave.
if RP2040_I2C_SLAVE
config RP2040_I2C0_SLAVE
bool "I2C0"
config RP2040_I2C0_SLAVE
bool "I2C0"
default n
---help---
See the Board Selection menu to configure the pins used by I2C0.
if RP2040_I2C0_SLAVE
if RP2040_I2C0_SLAVE
config RP2040_I2C0_SLAVE_SDA
int "GPIO pin number for SDA (data) line"
default 4
---help---
This pin must be one of: 0, 4, 8, 12, 16, 20, 24, or 28
config RP2040_I2C0_SLAVE_ADDRESS
int "Slave Address (in decimal)"
default 42
---help---
This is the default address of this device on the I2C bus.
It should be the canonical address (not the shifted address)
in the range 8-119 for 7-bit mode and in the range 0-1023
for 10-bit mode.
config RP2040_I2C0_SLAVE_SCL
int "GPIO pin number for SCL (clock) line"
default 5
---help---
This pin must be one of: 1, 5, 9, 13, 17, 21, 25, or 29
config RP2040_I2C0_SLAVE_10BIT
bool "Enable 10-bit slave address"
default n
---help---
Set to enable 10-bit mode addressing.
config RP2040_I2C0_SLAVE_ADDRESS
int "Slave Address (in decimal)"
default 42
---help---
This is the default address of this device on the I2C bus.
It should be the canonical address (not the shifted address)
in the range 8-119 for 7-bit mode and in the range 0-1023
for 10-bit mode.
endif # RP2040_I2C0_SLAVE
config RP2040_I2C0_SLAVE_10BIT
bool "Enable 10-bit slave address"
default n
---help---
Set to enable 10-bit mode addressing.
config RP2040_I2C1_SLAVE
bool "I2C1"
default n
---help---
See the Board Selection menu to configure the pins used by I2C0.
endif
if RP2040_I2C1_SLAVE
config RP2040_I2C1_SLAVE
bool "I2C1"
config RP2040_I2C1_SLAVE_ADDRESS
int "Slave Address (in decimal)"
default 42
---help---
This is the default address of this device on the I2C bus.
It should be the canonical address (not the shifted address)
in the range 8-119 for 7-bit mode and in the range 0-1023
for 10-bit mode.
if RP2040_I2C1_SLAVE
config RP2040_I2C1_SLAVE_10BIT
bool "Enable 10-bit slave address"
default n
---help---
Set to enable 10-bit mode addressing.
config RP2040_I2C1_SLAVE_SDA
int "GPIO pin number for SDA (data) line"
default 6
---help---
This pin must be one of: 2, 6, 10, 14, 18, 22, or 26
endif # RP2040_I2C1_SLAVE
config RP2040_I2C1_SLAVE_SCL
int "GPIO pin number for SCL (clock) line"
default 7
---help---
This pin must be one of: 3, 7, 11, 15, 19, 23, or 27
endif # RP2040_I2C_SLAVE
config RP2040_I2C1_SLAVE_ADDRESS
int "Slave Address (in decimal)"
default 42
---help---
This is the default address of this device on the I2C bus.
It should be the canonical address (not the shifted address)
in the range 8-119 for 7-bit mode and in the range 0-1023
for 10-bit mode.
#####################################################################
# PWM Configuration
#####################################################################
config RP2040_I2C1_SLAVE_10BIT
bool "Enable 10-bit slave address"
default n
---help---
Set to enable 10-bit mode addressing.
endif
endif
menuconfig RP2040_PWM
config RP2040_PWM
bool "PWM"
select PWM
---help---
@ -234,145 +266,425 @@ menuconfig RP2040_PWM
if RP2040_PWM
config PWM_MULTICHAN
bool "Support Multi-Channel PWM"
default y
---help---
If support for multi-channel PWM is disabled, the generated code
will only support the A channel of the PWM slices.
config PWM_MULTICHAN
bool "Support Multi-Channel PWM"
default y
---help---
If support for multi-channel PWM is disabled, the generated code
will only support the A channel of the PWM slices.
if PWM_MULTICHAN
config PWM_NCHANNELS
int "Number of channels"
default 2
---help---
If the number of channels is set to 1, the generated code will
only support the A channel of the PWM slices. This is functionally
identical to disabling multi-channel PWM support.
endif
int "Number of channels"
default 2
---help---
If the number of channels is set to 1, the generated code will
only support the A channel of the PWM slices. This is functionally
identical to disabling multi-channel PWM support.
endif # PWM_MULTICHAN
config RP2040_PWM0
bool "PWM0"
---help---
Drives GPIO pin 0 or 16 with the A channel, and
drives GPIO pin 1 or 17 with the B channel.
See the Board Selection menu to configure the pins used by I2C0.
if RP2040_PWM0
config RP2040_PWM0A_INVERT
bool "PWM0 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM0B_INVERT
bool "PWM0 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif # PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM0_PHASE_CORRECT
bool "PWM0 phase correct"
default n
endif # RP2040_PWM0
###################################################################
config RP2040_PWM1
bool "PWM1"
---help---
Drives GPIO pin 2 or 18 with the A channel, and
drives GPIO pin 3 or 19 with the B channel.
See the Board Selection menu to configure the pins used by I2C0.
if RP2040_PWM1
config RP2040_PWM1A_INVERT
bool "PWM1 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM1B_INVERT
bool "PWM1 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif # PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM1_PHASE_CORRECT
bool "PWM1 phase correct"
default n
endif # RP2040_PWM1
###################################################################
config RP2040_PWM2
bool "PWM2"
---help---
Drives GPIO pin 4 or 20 with the A channel, and
drives GPIO pin 5 or 21 with the B channel.
See the Board Selection menu to configure the pins used by I2C0.
if RP2040_PWM2
config RP2040_PWM2A_INVERT
bool "PWM2 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM2B_INVERT
bool "PWM2 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif # PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM2_PHASE_CORRECT
bool "PWM2 phase correct"
default n
endif # RP2040_PWM2
###################################################################
config RP2040_PWM3
bool "PWM3"
---help---
Drives GPIO pin 6 or 22 with the A channel, and
drives GPIO pin 7 or 23 with the B channel.
See the Board Selection menu to configure the pins used by I2C0.
if RP2040_PWM3
config RP2040_PWM3A_GPIO
config RP2040_PWM3A_INVERT
bool "PWM3 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM3B_INVERT
bool "PWM3 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif # PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM3_PHASE_CORRECT
bool "PWM3 phase correct"
default n
endif # RP2040_PWM3
#####################################################################
config RP2040_PWM4
bool "PWM4"
---help---
Drives GPIO pin 8 or 24 with the A channel, and
drives GPIO pin 9 or 25 with the B channel.
See the Board Selection menu to configure the pins used by I2C0.
if RP2040_PWM4
config RP2040_PWM4A_INVERT
bool "PWM4 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM4B_INVERT
bool "PWM4 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif # PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM4_PHASE_CORRECT
bool "PWM4 phase correct"
default n
endif # RP2040_PWM4
#####################################################################
config RP2040_PWM5
bool "PWM5"
---help---
Drives GPIO pin 10 or 26 with the A channel, and
drives GPIO pin 11 or 27 with the B channel.
See the Board Selection menu to configure the pins used by I2C0.
if RP2040_PWM5
config RP2040_PWM5A_INVERT
bool "PWM5 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM5B_INVERT
bool "PWM5 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif # PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM5_PHASE_CORRECT
bool "PWM5 phase correct"
default n
endif # RP2040_PWM5
#####################################################################
config RP2040_PWM6
bool "PWM6"
---help---
Drives GPIO pin 12 or 28 with the A channel, and
drives GPIO pin 13 or 29 with the B channel.
See the Board Selection menu to configure the pins used by I2C0.
if RP2040_PWM6
config RP2040_PWM6A_INVERT
bool "PWM6 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM6B_INVERT
bool "PWM6 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif # PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM6_PHASE_CORRECT
bool "PWM6 phase correct"
default n
endif # RP2040_PWM6
#####################################################################
config RP2040_PWM7
bool "PWM7"
---help---
Drives GPIO pin 14 with the A channel, and
drives GPIO pin 15 with the B channel.
See the Board Selection menu to configure the pins used by I2C0.
endif
if RP2040_PWM7
config RP2040_PWM7A_INVERT
bool "PWM7 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM7B_GPIO
config RP2040_PWM7B_INVERT
bool "PWM7 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif # PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM7_PHASE_CORRECT
bool "PWM7 phase correct"
default n
endif # RP2040_PWM7
endif # RP2040_PWM
#####################################################################
# I2S Configuration
#####################################################################
config RP2040_I2S
bool "I2S"
select I2S
---help---
See the Board Selection menu to configure the pins used by I2S.
if RP2040_I2S
config RP2040_I2S_MAXINFLIGHT
int "I2S queue size"
default 16
---help---
This is the total number of transfers that can be enqueue before
the caller is required to wait. This setting determines the number
certain queue data structures that will be pre-allocated.
config RP2040_I2S_MAXINFLIGHT
int "I2S queue size"
default 16
---help---
This is the total number of transfers that can be enqueue before
the caller is required to wait. This setting determines the number
certain queue data structures that will be pre-allocated.
config RP2040_I2S_DATALEN
int "Data width (bits)"
default 16
---help---
Data width in bits. This is a default value and may be change
via the I2S interface
config RP2040_I2S_DATALEN
int "Data width (bits)"
default 16
---help---
Data width in bits. This is a default value and may be change
via the I2S interface
config RP2040_I2S_DATA
int "I2S DATA GPIO pin assign (0-29)"
default 9
range 0 29
config RP2040_I2S_PIO
int "RP2040 PIO number used for I2S (0-1)"
default 0
range 0 1
config RP2040_I2S_CLOCK
int "I2S CLOCk GPIO pin assign (0-29)"
default 10
range 0 29
config RP2040_I2S_PIO
int "RP2040 PIO number used for I2S (0-1)"
default 0
range 0 1
config RP2040_I2S_PIO_SM
int "RP2040 PIO state machine number used for I2S (0-3)"
default 0
range 0 3
config RP2040_I2S_PIO_SM
int "RP2040 PIO state machine number used for I2S (0-3)"
default 0
range 0 3
endif
#####################################################################
# I2S Configuration
#####################################################################
menuconfig RP2040_SPISD
config RP2040_SPISD
bool "SPI SD Card"
default n
select MMCSD_SPI
if RP2040_SPISD
config RP2040_SPISD_SLOT_NO
int "SPI SD Card Slot Number"
default 0
---help---
Select spi sd card slot number.
config RP2040_SPISD_SLOT_NO
int "SPI SD Card Slot Number"
default 0
---help---
Select spi sd card slot number.
config RP2040_SPISD_SPI_CH
int "SPI channel number"
default 0
range 0 1
---help---
Select spi channel number to use spi sd card.
config RP2040_SPISD_SPI_CH
int "SPI channel number"
default 0
range 0 1
---help---
Select spi channel number to use spi sd card.
endif # SPISD Configuration
#####################################################################
# ADC Configuration
#####################################################################
config RP2040_ADC
bool "Enable ADC Support"
default n
---help---
If y, the RP2040 ADC code will be built.
If the ADC device driver is not built, basic functions
to programmatically access the ADC ports will be added.
if RP2040_ADC
config ADC
bool "Include ADC device driver"
default n
---help---
Additional ADC device drivers can be set under the
"Analog-to-Digital Conversion" item in the
"Device Driver/Analog Device Support" menu.
if ADC
config RPC2040_ADC_CHANNEL0
bool "Read ADC channel 0"
default n
---help---
If y, then ADC0 will be read.
config RPC2040_ADC_CHANNEL1
bool "Read ADC channel 1"
default n
---help---
If y, then ADC1 will be read.
config RPC2040_ADC_CHANNEL2
bool "Read ADC channel 2"
default n
---help---
If y, then ADC2 will be read.
config RPC2040_ADC_CHANNEL3
bool "Read ADC channel 3"
default n
---help---
If y, then ADC3 will be read.
config RPC2040_ADC_TEMPERATURE
bool "Read ADC chip temperature channel"
default n
---help---
If y, then the ADC chip temperature
will be read.
endif # ADC
endif # RP2040_ADC
#####################################################################
# WS2812 Configuration
#####################################################################
config RP2040_BOARD_HAS_WS2812
bool "Has ws2812 pixels"
default n
depends on WS2812
menuconfig RP2040_WS2812_GPIO_PIN
int "GPIO pin for ws2812 pixels"
default 0
range 0 29
depends on RP2040_BOARD_HAS_WS2812
---help---
See the Board Selection menu to configure the pins used
by ws2812.

View File

@ -487,15 +487,15 @@ struct i2c_slave_s * rp2040_i2c0_slave_initialize
{
rp2040_i2c_slave_t *priv = &i2c0_slave_dev;
rp2040_gpio_set_function(CONFIG_RP2040_I2C0_SLAVE_SDA,
rp2040_gpio_set_function(CONFIG_RP2040_I2C0_SDA_GPIO,
RP2040_GPIO_FUNC_I2C);
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C0_SLAVE_SDA, true, false);
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C0_SDA_GPIO, true, false);
rp2040_gpio_set_function(CONFIG_RP2040_I2C0_SLAVE_SCL,
rp2040_gpio_set_function(CONFIG_RP2040_I2C0_SCL_GPIO,
RP2040_GPIO_FUNC_I2C);
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C0_SLAVE_SCL, true, false);
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C0_SCL_GPIO, true, false);
priv->rx_buffer = rx_buffer;
priv->rx_buf_ptr = rx_buffer;
@ -552,15 +552,15 @@ struct i2c_slave_s * rp2040_i2c1_slave_initialize
{
rp2040_i2c_slave_t *priv = &i2c1_slave_dev;
rp2040_gpio_set_function(CONFIG_RP2040_I2C1_SLAVE_SDA,
rp2040_gpio_set_function(CONFIG_RP2040_I2C1_SDA_GPIO,
RP2040_GPIO_FUNC_I2C);
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C1_SLAVE_SDA, true, false);
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C1_SDA_GPIO, true, false);
rp2040_gpio_set_function(CONFIG_RP2040_I2C1_SLAVE_SCL,
rp2040_gpio_set_function(CONFIG_RP2040_I2C1_SCL_GPIO,
RP2040_GPIO_FUNC_I2C);
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C1_SLAVE_SCL, true, false);
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C1_SCL_GPIO, true, false);
priv->rx_buffer = rx_buffer;
priv->rx_buf_ptr = rx_buffer;

View File

@ -48,6 +48,7 @@ struct instance
FAR uint8_t *pixels; /* Buffer to hold pixels */
size_t open_count; /* Number of opens on this instance. */
clock_t last_dma; /* when last DMA completed. */
int power_pin; /* pin for ws2812 power */
};
/****************************************************************************
@ -168,57 +169,40 @@ static int my_open(FAR struct file *filep)
{
FAR struct inode *inode = filep->f_inode;
FAR struct ws2812_dev_s *dev_data = inode->i_private;
FAR struct instance *priv;
FAR struct instance *priv = (FAR struct instance *)
dev_data->private;
rp2040_pio_sm_config config;
int divisor;
int ret;
nxsem_wait(&dev_data->exclsem);
if (dev_data->private != NULL)
priv->open_count += 1;
if (priv->pixels != NULL)
{
/* We've already been initialized. Keep on truckin' */
ledinfo("rp2040_ws2812 re-open dev: 0x%08lX\n", (uint32_t) dev_data);
priv = (FAR struct instance *) dev_data->private;
priv->open_count += 1;
ret = OK;
goto post_and_return;
}
ledinfo("rp2040_ws2812 open dev: 0x%08lX\n", (uint32_t) dev_data);
/* Allocate struct holding out persistent data */
priv = kmm_zalloc(sizeof(struct instance));
if (priv == NULL)
{
lederr("rp2040_ws2812 open: out of memory\n");
ret = -ENOMEM;
goto post_and_return;
}
priv->open_count = 1;
/* Allocate the pixel buffer */
priv->pixels = kmm_zalloc(4 * dev_data->nleds);
priv->pixels = kmm_zalloc(4 * dev_data->nleds);
if (priv->pixels == NULL)
{
kmm_free(priv);
lederr("rp2040_ws2812 open: out of memory\n");
ret = -ENOMEM;
goto post_and_return;
}
dev_data->private = priv;
/* ==== Load the pio program ==== */
/* get pio instance and load program */
@ -254,9 +238,6 @@ static int my_open(FAR struct file *filep)
{
kmm_free(priv->pixels);
dev_data->private = NULL;
kmm_free(priv);
ret = -ENOMEM;
goto post_and_return;
}
@ -329,6 +310,15 @@ static int my_open(FAR struct file *filep)
rp2040_pio_sm_set_enabled(priv->pio, priv->pio_sm, true);
/* Turn on the power pin if any */
if (priv->power_pin >= 0)
{
rp2040_gpio_init(priv->power_pin);
rp2040_gpio_setdir(priv->power_pin, true);
rp2040_gpio_put(priv->power_pin, true);
}
ret = OK;
post_and_return:
@ -363,6 +353,11 @@ static int my_close(FAR struct file *filep)
priv->open_count -= 1;
if (priv->open_count == 0 && priv->power_pin >= 0)
{
rp2040_gpio_put(priv->power_pin, false);
}
nxsem_post(&dev_data->exclsem);
return OK;
@ -538,6 +533,7 @@ static ssize_t my_read(FAR struct file *filep,
* Input Parameters:
* Path to the ws2812 device (e.g. "/dev/leds0")
* Port number for the ws2812 chain
* Pin for ws2812 power
* The number of pixels in the chain
* Whether ws2812s have white LEDs
*
@ -548,10 +544,12 @@ static ssize_t my_read(FAR struct file *filep,
FAR void * rp2040_ws2812_setup(FAR const char *path,
int port,
int power_pin,
uint16_t pixel_count,
bool has_white)
{
FAR struct ws2812_dev_s * dev_data;
FAR struct instance * priv;
int err;
dev_data = kmm_zalloc(sizeof(struct ws2812_dev_s));
@ -562,6 +560,19 @@ FAR void * rp2040_ws2812_setup(FAR const char *path,
return NULL;
}
/* Allocate struct holding out persistent data */
priv = kmm_zalloc(sizeof(struct instance));
if (priv == NULL)
{
lederr("rp2040_ws2812 open: out of memory\n");
kmm_free(dev_data);
set_errno(ENOMEM);
return NULL;
}
dev_data->open = my_open;
dev_data->close = my_close;
dev_data->write = my_write;
@ -569,9 +580,12 @@ FAR void * rp2040_ws2812_setup(FAR const char *path,
dev_data->port = port;
dev_data->nleds = pixel_count;
dev_data->clock = CONFIG_WS2812_FREQUENCY;
dev_data->private = priv;
nxsem_init(&dev_data->exclsem, 0, 1);
priv->power_pin = power_pin;
ledinfo("register dev_data: 0x%08lX\n", (uint32_t) dev_data);
err = ws2812_register(path, dev_data);

View File

@ -53,6 +53,7 @@ extern "C"
* Input Parameters:
* Path to the ws2812 device (e.g. "/dev/leds0")
* Port number for the ws2812 chain
* Pin for ws2812 power
* The number of pixels in the chain
* Whether ws2812s have white LEDs
*
@ -63,6 +64,7 @@ extern "C"
FAR void * rp2040_ws2812_setup(FAR const char *path,
int port,
int power_pin,
uint16_t pixel_count,
bool has_white);

View File

@ -1494,6 +1494,13 @@ config ARCH_BOARD_ADAFRUIT_KB2040
This is a port to the Adafruit KB2040 board.
Support is derived from Raspberry Pi Pico support.
config ARCH_BOARD_ADAFRUIT_QT_PY_RP2040
bool "Adafruit QT Py RP2040 board"
depends on ARCH_CHIP_RP2040
---help---
This is a port to the Adafruit QT Py RP2040 board.
Support is derived from Raspberry Pi Pico support.
config ARCH_BOARD_RX65N
bool "RX65N renesas board"
depends on ARCH_CHIP_R5F565NEDDFC
@ -2645,6 +2652,7 @@ config ARCH_BOARD
default "pimoroni-tiny2040" if ARCH_BOARD_PIMORONI_TINY2040
default "adafruit-feather-rp2040" if ARCH_BOARD_ADAFRUIT_FEATHER_RP2040
default "adafruit-kb2040" if ARCH_BOARD_ADAFRUIT_KB2040
default "adafruit-qt-py-rp2040" if ARCH_BOARD_ADAFRUIT_QT_PY_RP2040
default "rx65n" if ARCH_BOARD_RX65N
default "rx65n-rsk1mb" if ARCH_BOARD_RX65N_RSK1MB
default "rx65n-rsk2mb" if ARCH_BOARD_RX65N_RSK2MB
@ -2989,6 +2997,9 @@ endif
if ARCH_BOARD_ADAFRUIT_KB2040
source "boards/arm/rp2040/adafruit-kb2040/Kconfig"
endif
if ARCH_BOARD_ADAFRUIT_QT_PY_RP2040
source "boards/arm/rp2040/adafruit-qt-py-rp2040/Kconfig"
endif
if ARCH_BOARD_ARDUINO_DUE
source "boards/arm/sam34/arduino-due/Kconfig"
endif

View File

@ -13,11 +13,12 @@ config RP2040_FLASH_BOOT
If not, the binary is for SRAM boot.
config RP2040_FLASH_CHIP
string "flash chip name"
string "Second stage boot loader"
default "w25q080"
---help---
Name of NOR flash device connected to RP2040 SoC.
(Used to choose the secondary boot loader.)
This is the name of the Pico-SDK second stage boot loader
to use for this board. This board using a Q64 flash chip
which is compatible with the w25q080 boot loader.
Basically this option should not be changed.
config RP2040_UF2_BINARY
@ -26,291 +27,6 @@ config RP2040_UF2_BINARY
---help---
Create nuttx.uf2 binary format used on RP2040 based arch.
config RP2040_UART0_GPIO
int "UART0 GPIO pin assign (0,12,28 or -1:no assign)"
default 0
range -1 29
depends on RP2040_UART0
config RP2040_UART1_GPIO
int "UART1 GPIO pin assign (8,20,24 or -1:no assign)"
default -1
range -1 29
depends on RP2040_UART1
config RP2040_I2C0_GPIO
int "I2C0 GPIO pin assign (0,8,12,20,24,28 or -1:no assign)"
default -1
range -1 29
depends on RP2040_I2C0
config RP2040_I2C1_GPIO
int "I2C1 GPIO pin assign (2,6,10,18,26 or -1:no assign)"
default -1
range -1 29
depends on RP2040_I2C1
if RP2040_PWM0
config RP2040_PWM0A_GPIO
int "PWM0 channel 1 GPIO pin assign (0 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.
config RP2040_PWM0A_INVERT
bool "PWM0 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM0B_GPIO
int "PWM0 channel 2 GPIO pin assign (1 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.
config RP2040_PWM0B_INVERT
bool "PWM0 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif
config RP2040_PWM0_PHASE_CORRECT
bool "PWM0 phase correct"
default n
endif
if RP2040_PWM1
config RP2040_PWM1A_GPIO
int "PWM1 channel 1 GPIO pin assign (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.
config RP2040_PWM1A_INVERT
bool "PWM1 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM1B_GPIO
int "PWM1 channel 2 GPIO pin assign (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.
config RP2040_PWM1B_INVERT
bool "PWM1 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif
config RP2040_PWM1_PHASE_CORRECT
bool "PWM1 phase correct"
default n
endif
if RP2040_PWM2
config RP2040_PWM2A_GPIO
int "PWM2 channel 1 GPIO pin assign (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.
config RP2040_PWM2A_INVERT
bool "PWM2 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
config RP2040_PWM2_PHASE_CORRECT
bool "PWM2 phase correct"
default n
endif
if RP2040_PWM3
config RP2040_PWM3A_GPIO
int "PWM3 channel 1 GPIO pin assign (6 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.
config RP2040_PWM3A_INVERT
bool "PWM3 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM3B_GPIO
int "PWM3 channel 2 GPIO pin assign (7 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.
config RP2040_PWM3B_INVERT
bool "PWM3 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif
config RP2040_PWM3_PHASE_CORRECT
bool "PWM3 phase correct"
default n
endif
if RP2040_PWM4
config RP2040_PWM4A_GPIO
int "PWM4 channel 1 GPIO pin assign (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.
config RP2040_PWM4A_INVERT
bool "PWM4 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM4B_GPIO
int "PWM4 channel 2 GPIO pin assign (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.
config RP2040_PWM4B_INVERT
bool "PWM4 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif
config RP2040_PWM4_PHASE_CORRECT
bool "PWM4 phase correct"
default n
endif
if RP2040_PWM5
config RP2040_PWM5A_GPIO
int "PWM5 channel 1 GPIO pin assign (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.
config RP2040_PWM5A_INVERT
bool "PWM5 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM5B_GPIO
int "PWM5 channel 2 GPIO pin assign (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.
config RP2040_PWM5B_INVERT
bool "PWM5 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif
config RP2040_PWM5_PHASE_CORRECT
bool "PWM5 phase correct"
default n
endif
if RP2040_PWM6
config RP2040_PWM6A_GPIO
int "PWM6 channel 1 GPIO pin assign (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.
config RP2040_PWM6A_INVERT
bool "PWM6 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM6B_GPIO
int "PWM6 channel 2 GPIO pin assign (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.
config RP2040_PWM6B_INVERT
bool "PWM6 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif
config RP2040_PWM6_PHASE_CORRECT
bool "PWM6 phase correct"
default n
endif
config RP2040_SPI0_GPIO
int "SPI0 GPIO pin assign (0,16 or -1:no assign)"
default -1
range -1 29
depends on RP2040_SPI0
config RP2040_SPI1_GPIO
int "SPI1 GPIO pin assign (8,24,28 or -1:no assign)"
default -1
range -1 29
depends on RP2040_SPI1
config RP2040_LCD_SPI_CH
int "RP2040 LCD SPI channel number"
default 0

View File

@ -22,7 +22,6 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-feather-rp2040"
CONFIG_ARCH_BOARD_ADAFRUIT_FEATHER_RP2040=y
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_RAMVECTORS=y
@ -55,7 +54,10 @@ CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_BOARD_HAS_WS2812=y
CONFIG_RP2040_I2S=y
CONFIG_RP2040_SPI0=y
CONFIG_RP2040_SPI0_GPIO=16
CONFIG_RP2040_SPI0_CS_GPIO=5
CONFIG_RP2040_SPI0_RX_GPIO=4
CONFIG_RP2040_SPI0_SCK_GPIO=6
CONFIG_RP2040_SPI0_TX_GPIO=7
CONFIG_RP2040_SPI=y
CONFIG_RP2040_SPISD=y
CONFIG_RP2040_WS2812_GPIO_PIN=16

View File

@ -18,7 +18,6 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-feather-rp2040"
CONFIG_ARCH_BOARD_ADAFRUIT_FEATHER_RP2040=y
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_RAMVECTORS=y
@ -54,7 +53,10 @@ CONFIG_RAM_START=0x20000000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_BOARD_HAS_WS2812=y
CONFIG_RP2040_SPI0=y
CONFIG_RP2040_SPI0_GPIO=16
CONFIG_RP2040_SPI0_CS_GPIO=5
CONFIG_RP2040_SPI0_RX_GPIO=4
CONFIG_RP2040_SPI0_SCK_GPIO=6
CONFIG_RP2040_SPI0_TX_GPIO=7
CONFIG_RP2040_SPI=y
CONFIG_RP2040_SPISD=y
CONFIG_RP2040_WS2812_GPIO_PIN=16

View File

@ -21,7 +21,6 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-feather-rp2040"
CONFIG_ARCH_BOARD_ADAFRUIT_FEATHER_RP2040=y
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_RAMVECTORS=y
@ -82,7 +81,10 @@ CONFIG_RAM_START=0x20000000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_BOARD_HAS_WS2812=y
CONFIG_RP2040_SPI0=y
CONFIG_RP2040_SPI0_GPIO=16
CONFIG_RP2040_SPI0_CS_GPIO=5
CONFIG_RP2040_SPI0_RX_GPIO=4
CONFIG_RP2040_SPI0_SCK_GPIO=6
CONFIG_RP2040_SPI0_TX_GPIO=7
CONFIG_RP2040_SPI=y
CONFIG_RP2040_WS2812_GPIO_PIN=16
CONFIG_RR_INTERVAL=200

View File

@ -15,7 +15,6 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-feather-rp2040"
CONFIG_ARCH_BOARD_ADAFRUIT_FEATHER_RP2040=y
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_RAMVECTORS=y
@ -57,12 +56,14 @@ CONFIG_RAM_SIZE=270336
CONFIG_RAM_START=0x20000000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_BOARD_HAS_WS2812=y
CONFIG_RP2040_ENC28J60_INTR_GPIO=11
CONFIG_RP2040_ENC28J60_RESET_GPIO=10
CONFIG_RP2040_ENC28J60_INTR_GPIO=19
CONFIG_RP2040_ENC28J60_RESET_GPIO=18
CONFIG_RP2040_SPI0=y
CONFIG_RP2040_SPI0_GPIO=16
CONFIG_RP2040_SPI0_CS_GPIO=5
CONFIG_RP2040_SPI0_RX_GPIO=4
CONFIG_RP2040_SPI0_SCK_GPIO=6
CONFIG_RP2040_SPI0_TX_GPIO=7
CONFIG_RP2040_SPI1=y
CONFIG_RP2040_SPI1_GPIO=12
CONFIG_RP2040_SPI=y
CONFIG_RP2040_WS2812_GPIO_PIN=16
CONFIG_RR_INTERVAL=200

View File

@ -15,7 +15,6 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-feather-rp2040"
CONFIG_ARCH_BOARD_ADAFRUIT_FEATHER_RP2040=y
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_RAMVECTORS=y
@ -42,7 +41,8 @@ CONFIG_RAM_START=0x20000000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_BOARD_HAS_WS2812=y
CONFIG_RP2040_I2C0=y
CONFIG_RP2040_I2C0_GPIO=4
CONFIG_RP2040_I2C0_SCL_GPIO=9
CONFIG_RP2040_I2C0_SDA_GPIO=8
CONFIG_RP2040_I2C=y
CONFIG_RP2040_I2C_DRIVER=y
CONFIG_RP2040_WS2812_GPIO_PIN=16

View File

@ -15,7 +15,6 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-feather-rp2040"
CONFIG_ARCH_BOARD_ADAFRUIT_FEATHER_RP2040=y
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_RAMVECTORS=y

View File

@ -16,7 +16,6 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-feather-rp2040"
CONFIG_ARCH_BOARD_ADAFRUIT_FEATHER_RP2040=y
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_STACKDUMP=y

View File

@ -15,7 +15,6 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-feather-rp2040"
CONFIG_ARCH_BOARD_ADAFRUIT_FEATHER_RP2040=y
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_INTERRUPTSTACK=2048

View File

@ -18,7 +18,6 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-feather-rp2040"
CONFIG_ARCH_BOARD_ADAFRUIT_FEATHER_RP2040=y
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_RAMVECTORS=y
@ -46,7 +45,6 @@ CONFIG_RAM_START=0x20000000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_BOARD_HAS_WS2812=y
CONFIG_RP2040_SPI0=y
CONFIG_RP2040_SPI0_GPIO=16
CONFIG_RP2040_SPI=y
CONFIG_RP2040_SPISD=y
CONFIG_RP2040_WS2812_GPIO_PIN=16

View File

@ -18,7 +18,6 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-feather-rp2040"
CONFIG_ARCH_BOARD_ADAFRUIT_FEATHER_RP2040=y
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_RAMVECTORS=y
@ -61,7 +60,8 @@ CONFIG_RAM_START=0x20000000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_BOARD_HAS_WS2812=y
CONFIG_RP2040_I2C0=y
CONFIG_RP2040_I2C0_GPIO=4
CONFIG_RP2040_I2C0_SCL_GPIO=9
CONFIG_RP2040_I2C0_SDA_GPIO=8
CONFIG_RP2040_I2C=y
CONFIG_RP2040_I2C_DRIVER=y
CONFIG_RP2040_WS2812_GPIO_PIN=16

View File

@ -15,7 +15,6 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-feather-rp2040"
CONFIG_ARCH_BOARD_ADAFRUIT_FEATHER_RP2040=y
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_RAMVECTORS=y
@ -45,7 +44,6 @@ CONFIG_RAM_START=0x20000000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_BOARD_HAS_WS2812=y
CONFIG_RP2040_SPI1=y
CONFIG_RP2040_SPI1_GPIO=12
CONFIG_RP2040_SPI=y
CONFIG_RP2040_WS2812_GPIO_PIN=16
CONFIG_RR_INTERVAL=200

View File

@ -18,7 +18,6 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-feather-rp2040"
CONFIG_ARCH_BOARD_ADAFRUIT_FEATHER_RP2040=y
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_RAMVECTORS=y
@ -48,7 +47,10 @@ CONFIG_RAM_START=0x20000000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_BOARD_HAS_WS2812=y
CONFIG_RP2040_SPI0=y
CONFIG_RP2040_SPI0_GPIO=16
CONFIG_RP2040_SPI0_CS_GPIO=5
CONFIG_RP2040_SPI0_RX_GPIO=4
CONFIG_RP2040_SPI0_SCK_GPIO=6
CONFIG_RP2040_SPI0_TX_GPIO=7
CONFIG_RP2040_SPI=y
CONFIG_RP2040_SPISD=y
CONFIG_RP2040_WS2812_GPIO_PIN=16

View File

@ -16,7 +16,6 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-feather-rp2040"
CONFIG_ARCH_BOARD_ADAFRUIT_FEATHER_RP2040=y
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_RAMVECTORS=y

View File

@ -20,7 +20,6 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-feather-rp2040"
CONFIG_ARCH_BOARD_ADAFRUIT_FEATHER_RP2040=y
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_RAMVECTORS=y
@ -79,7 +78,6 @@ CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_BOARD_HAS_WS2812=y
CONFIG_RP2040_LCD_SPI_CH=1
CONFIG_RP2040_SPI1=y
CONFIG_RP2040_SPI1_GPIO=8
CONFIG_RP2040_SPI=y
CONFIG_RP2040_WS2812_GPIO_PIN=16
CONFIG_RR_INTERVAL=200

View File

@ -20,7 +20,6 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-feather-rp2040"
CONFIG_ARCH_BOARD_ADAFRUIT_FEATHER_RP2040=y
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_RAMVECTORS=y
@ -76,7 +75,6 @@ CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_BOARD_HAS_WS2812=y
CONFIG_RP2040_LCD_SPI_CH=1
CONFIG_RP2040_SPI1=y
CONFIG_RP2040_SPI1_GPIO=8
CONFIG_RP2040_SPI=y
CONFIG_RP2040_WS2812_GPIO_PIN=16
CONFIG_RR_INTERVAL=200

View File

@ -20,7 +20,7 @@
MEMORY
{
flash (rx) : ORIGIN = 0x10000000, LENGTH = 2048K
flash (rx) : ORIGIN = 0x10000000, LENGTH = 8192K
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 264K
}

View File

@ -70,32 +70,32 @@ void rp2040_boardearlyinitialize(void)
/* Set default UART pin */
#if defined(CONFIG_RP2040_UART0) && CONFIG_RP2040_UART0_GPIO >= 0
rp2040_gpio_set_function(CONFIG_RP2040_UART0_GPIO,
#ifdef CONFIG_RP2040_UART0
rp2040_gpio_set_function(CONFIG_RP2040_UART0_TX_GPIO,
RP2040_GPIO_FUNC_UART); /* TX */
rp2040_gpio_set_function(CONFIG_RP2040_UART0_GPIO + 1,
rp2040_gpio_set_function(CONFIG_RP2040_UART0_RX_GPIO,
RP2040_GPIO_FUNC_UART); /* RX */
#ifdef CONFIG_SERIAL_OFLOWCONTROL
rp2040_gpio_set_function(CONFIG_RP2040_UART0_GPIO + 2,
rp2040_gpio_set_function(CONFIG_RP2040_UART0_CTS_GPIO,
RP2040_GPIO_FUNC_UART); /* CTS */
#endif
#ifdef CONFIG_SERIAL_IFLOWCONTROL
rp2040_gpio_set_function(CONFIG_RP2040_UART0_GPIO + 3,
rp2040_gpio_set_function(CONFIG_RP2040_UART0_RTS_GPIO,
RP2040_GPIO_FUNC_UART); /* RTS */
#endif
#endif
#if defined(CONFIG_RP2040_UART1) && CONFIG_RP2040_UART1_GPIO >= 0
rp2040_gpio_set_function(CONFIG_RP2040_UART1_GPIO,
#ifdef CONFIG_RP2040_UART1
rp2040_gpio_set_function(CONFIG_RP2040_UART1_TX_GPIO,
RP2040_GPIO_FUNC_UART); /* TX */
rp2040_gpio_set_function(CONFIG_RP2040_UART1_GPIO + 1,
rp2040_gpio_set_function(CONFIG_RP2040_UART1_RX_GPIO,
RP2040_GPIO_FUNC_UART); /* RX */
#ifdef CONFIG_SERIAL_OFLOWCONTROL
rp2040_gpio_set_function(CONFIG_RP2040_UART1_GPIO + 2,
rp2040_gpio_set_function(CONFIG_RP2040_UART1_CTS_GPIO,
RP2040_GPIO_FUNC_UART); /* CTS */
#endif
#ifdef CONFIG_SERIAL_IFLOWCONTROL
rp2040_gpio_set_function(CONFIG_RP2040_UART1_GPIO + 3,
rp2040_gpio_set_function(CONFIG_RP2040_UART1_RTS_GPIO,
RP2040_GPIO_FUNC_UART); /* RTS */
#endif
#endif
@ -112,55 +112,55 @@ void rp2040_boardinitialize(void)
{
/* Set default I2C pin */
#if defined(CONFIG_RP2040_I2C0) && CONFIG_RP2040_I2C0_GPIO >= 0
rp2040_gpio_set_function(CONFIG_RP2040_I2C0_GPIO,
#ifdef CONFIG_RP2040_I2C0
rp2040_gpio_set_function(CONFIG_RP2040_I2C0_SDA_GPIO,
RP2040_GPIO_FUNC_I2C); /* SDA */
rp2040_gpio_set_function(CONFIG_RP2040_I2C0_GPIO + 1,
rp2040_gpio_set_function(CONFIG_RP2040_I2C0_SCL_GPIO,
RP2040_GPIO_FUNC_I2C); /* SCL */
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C0_GPIO, true, false); /* Pull up */
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C0_GPIO + 1, true, false);
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C0_SDA_GPIO, true, false); /* Pull up */
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C0_SCL_GPIO, true, false);
#endif
#if defined(CONFIG_RP2040_I2C1) && CONFIG_RP2040_I2C1_GPIO >= 0
rp2040_gpio_set_function(CONFIG_RP2040_I2C1_GPIO,
#ifdef CONFIG_RP2040_I2C1
rp2040_gpio_set_function(CONFIG_RP2040_I2C1_SDA_GPIO,
RP2040_GPIO_FUNC_I2C); /* SDA */
rp2040_gpio_set_function(CONFIG_RP2040_I2C1_GPIO + 1,
rp2040_gpio_set_function(CONFIG_RP2040_I2C1_SCL_GPIO,
RP2040_GPIO_FUNC_I2C); /* SCL */
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C1_GPIO, true, false); /* Pull up */
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C1_GPIO + 1, true, false);
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C1_SDA_GPIO, true, false); /* Pull up */
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C1_SCL_GPIO, true, false);
#endif
/* Set default SPI pin */
#if defined(CONFIG_RP2040_SPI0) && CONFIG_RP2040_SPI0_GPIO >= 0
rp2040_gpio_set_function(CONFIG_RP2040_SPI0_GPIO,
#ifdef CONFIG_RP2040_SPI0
rp2040_gpio_set_function(CONFIG_RP2040_SPI0_RX_GPIO,
RP2040_GPIO_FUNC_SPI); /* RX */
rp2040_gpio_set_function(CONFIG_RP2040_SPI0_GPIO + 2,
rp2040_gpio_set_function(CONFIG_RP2040_SPI0_SCK_GPIO,
RP2040_GPIO_FUNC_SPI); /* SCK */
rp2040_gpio_set_function(CONFIG_RP2040_SPI0_GPIO + 3,
rp2040_gpio_set_function(CONFIG_RP2040_SPI0_TX_GPIO,
RP2040_GPIO_FUNC_SPI); /* TX */
/* CSn is controlled by board-specific logic */
rp2040_gpio_init(CONFIG_RP2040_SPI0_GPIO + 1); /* CSn */
rp2040_gpio_setdir(CONFIG_RP2040_SPI0_GPIO + 1, true);
rp2040_gpio_put(CONFIG_RP2040_SPI0_GPIO + 1, true);
rp2040_gpio_init(CONFIG_RP2040_SPI0_CS_GPIO); /* CSn */
rp2040_gpio_setdir(CONFIG_RP2040_SPI0_CS_GPIO, true);
rp2040_gpio_put(CONFIG_RP2040_SPI0_CS_GPIO, true);
#endif
#if defined(CONFIG_RP2040_SPI1) && CONFIG_RP2040_SPI1_GPIO >= 0
rp2040_gpio_set_function(CONFIG_RP2040_SPI1_GPIO,
#ifdef CONFIG_RP2040_SPI1
rp2040_gpio_set_function(CONFIG_RP2040_SPI1_RX_GPIO,
RP2040_GPIO_FUNC_SPI); /* RX */
rp2040_gpio_set_function(CONFIG_RP2040_SPI1_GPIO + 2,
rp2040_gpio_set_function(CONFIG_RP2040_SPI1_SCK_GPIO,
RP2040_GPIO_FUNC_SPI); /* SCK */
rp2040_gpio_set_function(CONFIG_RP2040_SPI1_GPIO + 3,
rp2040_gpio_set_function(CONFIG_RP2040_SPI1_TX_GPIO,
RP2040_GPIO_FUNC_SPI); /* TX */
/* CSn is controlled by board-specific logic */
rp2040_gpio_init(CONFIG_RP2040_SPI1_GPIO + 1); /* CSn */
rp2040_gpio_setdir(CONFIG_RP2040_SPI1_GPIO + 1, true);
rp2040_gpio_put(CONFIG_RP2040_SPI1_GPIO + 1, true);
rp2040_gpio_init(CONFIG_RP2040_SPI1_CS_GPIO); /* CSn */
rp2040_gpio_setdir(CONFIG_RP2040_SPI1_CS_GPIO, true);
rp2040_gpio_put(CONFIG_RP2040_SPI1_CS_GPIO, true);
#endif
}

View File

@ -462,6 +462,7 @@ int rp2040_bringup(void)
#if defined(CONFIG_RP2040_BOARD_HAS_WS2812) && defined(CONFIG_WS2812)
rp2040_ws2812_setup("/dev/leds0",
CONFIG_RP2040_WS2812_GPIO_PIN,
CONFIG_RP2040_WS2812_PWR_GPIO,
CONFIG_WS2812_LED_COUNT,
HAS_WHITE);
#endif

View File

@ -74,7 +74,7 @@ void rp2040_spi0select(struct spi_dev_s *dev, uint32_t devid,
spiinfo("devid: %d CS: %s\n", (int)devid,
selected ? "assert" : "de-assert");
rp2040_gpio_put(CONFIG_RP2040_SPI0_GPIO + 1, !selected);
rp2040_gpio_put(CONFIG_RP2040_SPI0_CS_GPIO, !selected);
}
uint8_t rp2040_spi0status(struct spi_dev_s *dev, uint32_t devid)
@ -97,7 +97,7 @@ int rp2040_spi0cmddata(struct spi_dev_s *dev, uint32_t devid, bool cmd)
* data bits are data or a command.
*/
rp2040_gpio_put(CONFIG_RP2040_SPI0_GPIO, !cmd);
rp2040_gpio_put(CONFIG_RP2040_SPI0_RX_GPIO, !cmd);
return OK;
}
@ -115,7 +115,7 @@ void rp2040_spi1select(struct spi_dev_s *dev, uint32_t devid,
spiinfo("devid: %d CS: %s\n", (int)devid,
selected ? "assert" : "de-assert");
rp2040_gpio_put(CONFIG_RP2040_SPI1_GPIO + 1, !selected);
rp2040_gpio_put(CONFIG_RP2040_SPI1_CS_GPIO, !selected);
}
uint8_t rp2040_spi1status(struct spi_dev_s *dev, uint32_t devid)
@ -138,7 +138,7 @@ int rp2040_spi1cmddata(struct spi_dev_s *dev, uint32_t devid, bool cmd)
* data bits are data or a command.
*/
rp2040_gpio_put(CONFIG_RP2040_SPI1_GPIO, !cmd);
rp2040_gpio_put(CONFIG_RP2040_SPI1_RX_GPIO, !cmd);
return OK;
}

View File

@ -13,11 +13,12 @@ config RP2040_FLASH_BOOT
If not, the binary is for SRAM boot.
config RP2040_FLASH_CHIP
string "flash chip name"
string "Second stage boot loader"
default "w25q080"
---help---
Name of NOR flash device connected to RP2040 SoC.
(Used to choose the secondary boot loader.)
This is the name of the Pico-SDK second stage boot loader
to use for this board. This board using a Q64 flash chip
which is compatible with the w25q080 boot loader.
Basically this option should not be changed.
config RP2040_UF2_BINARY
@ -26,308 +27,6 @@ config RP2040_UF2_BINARY
---help---
Create nuttx.uf2 binary format used on RP2040 based arch.
config RP2040_UART0_GPIO
int "UART0 GPIO pin assign (0,12,16,28 or -1:no assign)"
default 0
range -1 29
depends on RP2040_UART0
config RP2040_UART1_GPIO
int "UART1 GPIO pin assign (4,8,20,24 or -1:no assign)"
default -1
range -1 29
depends on RP2040_UART1
config RP2040_I2C0_GPIO
int "I2C0 GPIO pin assign (0,4,8,12,28 or -1:no assign)"
default -1
range -1 29
depends on RP2040_I2C0
config RP2040_I2C1_GPIO
int "I2C1 GPIO pin assign (2,6,10,18,26 or -1:no assign)"
default -1
range -1 29
depends on RP2040_I2C1
if RP2040_PWM0
config RP2040_PWM0A_GPIO
int "PWM0 channel 1 GPIO pin assign (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.
config RP2040_PWM0A_INVERT
bool "PWM0 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM0B_GPIO
int "PWM0 channel 2 GPIO pin assign (1 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.
config RP2040_PWM0B_INVERT
bool "PWM0 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif
config RP2040_PWM0_PHASE_CORRECT
bool "PWM0 phase correct"
default n
endif
if RP2040_PWM1
config RP2040_PWM1A_GPIO
int "PWM1 channel 1 GPIO pin assign (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.
config RP2040_PWM1A_INVERT
bool "PWM1 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM1B_GPIO
int "PWM1 channel 2 GPIO pin assign (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.
config RP2040_PWM1B_INVERT
bool "PWM1 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif
config RP2040_PWM1_PHASE_CORRECT
bool "PWM1 phase correct"
default n
endif
if RP2040_PWM2
config RP2040_PWM2A_GPIO
int "PWM2 channel 1 GPIO pin assign (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.
config RP2040_PWM2A_INVERT
bool "PWM2 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM2B_GPIO
int "PWM2 channel 2 GPIO pin assign (5 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.
config RP2040_PWM2B_INVERT
bool "PWM2 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif
config RP2040_PWM2_PHASE_CORRECT
bool "PWM2 phase correct"
default n
endif
if RP2040_PWM3
config RP2040_PWM3A_GPIO
int "PWM3 channel 1 GPIO pin assign (6 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.
config RP2040_PWM3A_INVERT
bool "PWM3 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM3B_GPIO
int "PWM3 channel 2 GPIO pin assign (7 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.
config RP2040_PWM3B_INVERT
bool "PWM3 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif
config RP2040_PWM3_PHASE_CORRECT
bool "PWM3 phase correct"
default n
endif
if RP2040_PWM4
config RP2040_PWM4A_GPIO
int "PWM4 channel 1 GPIO pin assign (8 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.
config RP2040_PWM4A_INVERT
bool "PWM4 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM4B_GPIO
int "PWM4 channel 2 GPIO pin assign (9 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.
config RP2040_PWM4B_INVERT
bool "PWM4 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif
config RP2040_PWM4_PHASE_CORRECT
bool "PWM4 phase correct"
default n
endif
if RP2040_PWM5
config RP2040_PWM5A_GPIO
int "PWM5 channel 1 GPIO pin assign (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.
config RP2040_PWM5A_INVERT
bool "PWM5 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM5B_GPIO
int "PWM5 channel 2 GPIO pin assign (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.
config RP2040_PWM5B_INVERT
bool "PWM5 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif
config RP2040_PWM5_PHASE_CORRECT
bool "PWM5 phase correct"
default n
endif
if RP2040_PWM6
config RP2040_PWM6A_GPIO
int "PWM6 channel 1 GPIO pin assign (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.
config RP2040_PWM6A_INVERT
bool "PWM6 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM6B_GPIO
int "PWM6 channel 2 GPIO pin assign (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.
config RP2040_PWM6B_INVERT
bool "PWM6 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif
config RP2040_PWM6_PHASE_CORRECT
bool "PWM6 phase correct"
default n
endif
config RP2040_SPI0_GPIO
int "SPI0 GPIO pin assign (0,4,16,20 or -1:no assign)"
default -1
range -1 29
depends on RP2040_SPI0
config RP2040_SPI1_GPIO
int "SPI1 GPIO pin assign (8,12,24,28 or -1:no assign)"
default -1
range -1 29
depends on RP2040_SPI1
config RP2040_LCD_SPI_CH
int "RP2040 LCD SPI channel number"
default 0

View File

@ -22,7 +22,6 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-kb2040"
CONFIG_ARCH_BOARD_ADAFRUIT_KB2040=y
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_RAMVECTORS=y
@ -55,7 +54,10 @@ CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_BOARD_HAS_WS2812=y
CONFIG_RP2040_I2S=y
CONFIG_RP2040_SPI0=y
CONFIG_RP2040_SPI0_GPIO=16
CONFIG_RP2040_SPI0_CS_GPIO=5
CONFIG_RP2040_SPI0_RX_GPIO=4
CONFIG_RP2040_SPI0_SCK_GPIO=6
CONFIG_RP2040_SPI0_TX_GPIO=7
CONFIG_RP2040_SPI=y
CONFIG_RP2040_SPISD=y
CONFIG_RP2040_WS2812_GPIO_PIN=17

View File

@ -18,7 +18,6 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-kb2040"
CONFIG_ARCH_BOARD_ADAFRUIT_KB2040=y
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_RAMVECTORS=y
@ -54,7 +53,10 @@ CONFIG_RAM_START=0x20000000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_BOARD_HAS_WS2812=y
CONFIG_RP2040_SPI0=y
CONFIG_RP2040_SPI0_GPIO=16
CONFIG_RP2040_SPI0_CS_GPIO=5
CONFIG_RP2040_SPI0_RX_GPIO=4
CONFIG_RP2040_SPI0_SCK_GPIO=6
CONFIG_RP2040_SPI0_TX_GPIO=7
CONFIG_RP2040_SPI=y
CONFIG_RP2040_SPISD=y
CONFIG_RP2040_WS2812_GPIO_PIN=17

View File

@ -21,7 +21,6 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-kb2040"
CONFIG_ARCH_BOARD_ADAFRUIT_KB2040=y
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_RAMVECTORS=y
@ -82,7 +81,10 @@ CONFIG_RAM_START=0x20000000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_BOARD_HAS_WS2812=y
CONFIG_RP2040_SPI0=y
CONFIG_RP2040_SPI0_GPIO=16
CONFIG_RP2040_SPI0_CS_GPIO=5
CONFIG_RP2040_SPI0_RX_GPIO=4
CONFIG_RP2040_SPI0_SCK_GPIO=6
CONFIG_RP2040_SPI0_TX_GPIO=7
CONFIG_RP2040_SPI=y
CONFIG_RP2040_WS2812_GPIO_PIN=17
CONFIG_RR_INTERVAL=200

View File

@ -15,7 +15,6 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-kb2040"
CONFIG_ARCH_BOARD_ADAFRUIT_KB2040=y
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_RAMVECTORS=y
@ -57,12 +56,15 @@ CONFIG_RAM_SIZE=270336
CONFIG_RAM_START=0x20000000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_BOARD_HAS_WS2812=y
CONFIG_RP2040_ENC28J60_INTR_GPIO=11
CONFIG_RP2040_ENC28J60_RESET_GPIO=10
CONFIG_RP2040_ENC28J60_INTR_GPIO=3
CONFIG_RP2040_ENC28J60_RESET_GPIO=2
CONFIG_RP2040_SPI0=y
CONFIG_RP2040_SPI0_GPIO=16
CONFIG_RP2040_SPI0_CS_GPIO=5
CONFIG_RP2040_SPI0_RX_GPIO=4
CONFIG_RP2040_SPI0_SCK_GPIO=6
CONFIG_RP2040_SPI0_TX_GPIO=7
CONFIG_RP2040_SPI1=y
CONFIG_RP2040_SPI1_GPIO=12
CONFIG_RP2040_SPI1_TX_GPIO=27
CONFIG_RP2040_SPI=y
CONFIG_RP2040_WS2812_GPIO_PIN=17
CONFIG_RR_INTERVAL=200

View File

@ -15,7 +15,6 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-kb2040"
CONFIG_ARCH_BOARD_ADAFRUIT_KB2040=y
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_RAMVECTORS=y
@ -42,7 +41,6 @@ CONFIG_RAM_START=0x20000000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_BOARD_HAS_WS2812=y
CONFIG_RP2040_I2C0=y
CONFIG_RP2040_I2C0_GPIO=4
CONFIG_RP2040_I2C=y
CONFIG_RP2040_I2C_DRIVER=y
CONFIG_RP2040_WS2812_GPIO_PIN=17

View File

@ -15,7 +15,6 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-kb2040"
CONFIG_ARCH_BOARD_ADAFRUIT_KB2040=y
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_RAMVECTORS=y

View File

@ -16,7 +16,6 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-kb2040"
CONFIG_ARCH_BOARD_ADAFRUIT_KB2040=y
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_STACKDUMP=y

View File

@ -15,7 +15,6 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-kb2040"
CONFIG_ARCH_BOARD_ADAFRUIT_KB2040=y
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_INTERRUPTSTACK=2048

View File

@ -18,7 +18,6 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-kb2040"
CONFIG_ARCH_BOARD_ADAFRUIT_KB2040=y
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_RAMVECTORS=y
@ -46,7 +45,10 @@ CONFIG_RAM_START=0x20000000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_BOARD_HAS_WS2812=y
CONFIG_RP2040_SPI0=y
CONFIG_RP2040_SPI0_GPIO=16
CONFIG_RP2040_SPI0_CS_GPIO=5
CONFIG_RP2040_SPI0_RX_GPIO=4
CONFIG_RP2040_SPI0_SCK_GPIO=6
CONFIG_RP2040_SPI0_TX_GPIO=7
CONFIG_RP2040_SPI=y
CONFIG_RP2040_SPISD=y
CONFIG_RP2040_WS2812_GPIO_PIN=17

View File

@ -18,7 +18,6 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-kb2040"
CONFIG_ARCH_BOARD_ADAFRUIT_KB2040=y
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_RAMVECTORS=y
@ -61,7 +60,6 @@ CONFIG_RAM_START=0x20000000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_BOARD_HAS_WS2812=y
CONFIG_RP2040_I2C0=y
CONFIG_RP2040_I2C0_GPIO=4
CONFIG_RP2040_I2C=y
CONFIG_RP2040_I2C_DRIVER=y
CONFIG_RP2040_WS2812_GPIO_PIN=17

View File

@ -15,7 +15,6 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-kb2040"
CONFIG_ARCH_BOARD_ADAFRUIT_KB2040=y
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_RAMVECTORS=y
@ -45,7 +44,7 @@ CONFIG_RAM_START=0x20000000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_BOARD_HAS_WS2812=y
CONFIG_RP2040_SPI1=y
CONFIG_RP2040_SPI1_GPIO=12
CONFIG_RP2040_SPI1_TX_GPIO=27
CONFIG_RP2040_SPI=y
CONFIG_RP2040_WS2812_GPIO_PIN=17
CONFIG_RR_INTERVAL=200

View File

@ -18,7 +18,6 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-kb2040"
CONFIG_ARCH_BOARD_ADAFRUIT_KB2040=y
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_RAMVECTORS=y
@ -48,7 +47,10 @@ CONFIG_RAM_START=0x20000000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_BOARD_HAS_WS2812=y
CONFIG_RP2040_SPI0=y
CONFIG_RP2040_SPI0_GPIO=16
CONFIG_RP2040_SPI0_CS_GPIO=5
CONFIG_RP2040_SPI0_RX_GPIO=4
CONFIG_RP2040_SPI0_SCK_GPIO=6
CONFIG_RP2040_SPI0_TX_GPIO=7
CONFIG_RP2040_SPI=y
CONFIG_RP2040_SPISD=y
CONFIG_RP2040_WS2812_GPIO_PIN=17

View File

@ -16,7 +16,6 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-kb2040"
CONFIG_ARCH_BOARD_ADAFRUIT_KB2040=y
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_RAMVECTORS=y

View File

@ -20,7 +20,6 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-kb2040"
CONFIG_ARCH_BOARD_ADAFRUIT_KB2040=y
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_RAMVECTORS=y
@ -79,7 +78,6 @@ CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_BOARD_HAS_WS2812=y
CONFIG_RP2040_LCD_SPI_CH=1
CONFIG_RP2040_SPI1=y
CONFIG_RP2040_SPI1_GPIO=8
CONFIG_RP2040_SPI=y
CONFIG_RP2040_WS2812_GPIO_PIN=17
CONFIG_RR_INTERVAL=200

View File

@ -20,7 +20,6 @@
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-kb2040"
CONFIG_ARCH_BOARD_ADAFRUIT_KB2040=y
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_RAMVECTORS=y
@ -76,7 +75,6 @@ CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_BOARD_HAS_WS2812=y
CONFIG_RP2040_LCD_SPI_CH=1
CONFIG_RP2040_SPI1=y
CONFIG_RP2040_SPI1_GPIO=8
CONFIG_RP2040_SPI=y
CONFIG_RP2040_WS2812_GPIO_PIN=17
CONFIG_RR_INTERVAL=200

View File

@ -62,10 +62,11 @@
/* GPIO definitions *********************************************************/
#undef BOARD_GPIO_LED_PIN
#define BOARD_NGPIOOUT 1
#define BOARD_NGPIOIN 1
#define BOARD_NGPIOINT 1
#undef BOARD_GPIO_LED_PIN
#define BOARD_GPIO_WS2812_PWR_PIN 11
#define BOARD_NGPIOOUT 1
#define BOARD_NGPIOIN 1
#define BOARD_NGPIOINT 1
/****************************************************************************
* Public Types

View File

@ -20,7 +20,7 @@
MEMORY
{
flash (rx) : ORIGIN = 0x10000000, LENGTH = 2048K
flash (rx) : ORIGIN = 0x10000000, LENGTH = 8192K
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 264K
}

View File

@ -64,32 +64,32 @@ void rp2040_boardearlyinitialize(void)
/* Set default UART pin */
#if defined(CONFIG_RP2040_UART0) && CONFIG_RP2040_UART0_GPIO >= 0
rp2040_gpio_set_function(CONFIG_RP2040_UART0_GPIO,
#ifdef CONFIG_RP2040_UART0
rp2040_gpio_set_function(CONFIG_RP2040_UART0_TX_GPIO,
RP2040_GPIO_FUNC_UART); /* TX */
rp2040_gpio_set_function(CONFIG_RP2040_UART0_GPIO + 1,
rp2040_gpio_set_function(CONFIG_RP2040_UART0_RX_GPIO,
RP2040_GPIO_FUNC_UART); /* RX */
#ifdef CONFIG_SERIAL_OFLOWCONTROL
rp2040_gpio_set_function(CONFIG_RP2040_UART0_GPIO + 2,
rp2040_gpio_set_function(CONFIG_RP2040_UART0_CTS_GPIO,
RP2040_GPIO_FUNC_UART); /* CTS */
#endif
#ifdef CONFIG_SERIAL_IFLOWCONTROL
rp2040_gpio_set_function(CONFIG_RP2040_UART0_GPIO + 3,
rp2040_gpio_set_function(CONFIG_RP2040_UART0_RTS_GPIO,
RP2040_GPIO_FUNC_UART); /* RTS */
#endif
#endif
#if defined(CONFIG_RP2040_UART1) && CONFIG_RP2040_UART1_GPIO >= 0
rp2040_gpio_set_function(CONFIG_RP2040_UART1_GPIO,
#ifdef CONFIG_RP2040_UART1
rp2040_gpio_set_function(CONFIG_RP2040_UART1_TX_GPIO,
RP2040_GPIO_FUNC_UART); /* TX */
rp2040_gpio_set_function(CONFIG_RP2040_UART1_GPIO + 1,
rp2040_gpio_set_function(CONFIG_RP2040_UART1_RX_GPIO,
RP2040_GPIO_FUNC_UART); /* RX */
#ifdef CONFIG_SERIAL_OFLOWCONTROL
rp2040_gpio_set_function(CONFIG_RP2040_UART1_GPIO + 2,
rp2040_gpio_set_function(CONFIG_RP2040_UART1_CTS_GPIO,
RP2040_GPIO_FUNC_UART); /* CTS */
#endif
#ifdef CONFIG_SERIAL_IFLOWCONTROL
rp2040_gpio_set_function(CONFIG_RP2040_UART1_GPIO + 3,
rp2040_gpio_set_function(CONFIG_RP2040_UART1_RTS_GPIO,
RP2040_GPIO_FUNC_UART); /* RTS */
#endif
#endif
@ -106,55 +106,55 @@ void rp2040_boardinitialize(void)
{
/* Set default I2C pin */
#if defined(CONFIG_RP2040_I2C0) && CONFIG_RP2040_I2C0_GPIO >= 0
rp2040_gpio_set_function(CONFIG_RP2040_I2C0_GPIO,
#ifdef CONFIG_RP2040_I2C0
rp2040_gpio_set_function(CONFIG_RP2040_I2C0_SDA_GPIO,
RP2040_GPIO_FUNC_I2C); /* SDA */
rp2040_gpio_set_function(CONFIG_RP2040_I2C0_GPIO + 1,
rp2040_gpio_set_function(CONFIG_RP2040_I2C0_SCL_GPIO,
RP2040_GPIO_FUNC_I2C); /* SCL */
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C0_GPIO, true, false); /* Pull up */
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C0_GPIO + 1, true, false);
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C0_SDA_GPIO, true, false); /* Pull up */
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C0_SCL_GPIO, true, false);
#endif
#if defined(CONFIG_RP2040_I2C1) && CONFIG_RP2040_I2C1_GPIO >= 0
rp2040_gpio_set_function(CONFIG_RP2040_I2C1_GPIO,
#ifdef CONFIG_RP2040_I2C1
rp2040_gpio_set_function(CONFIG_RP2040_I2C1_SDA_GPIO,
RP2040_GPIO_FUNC_I2C); /* SDA */
rp2040_gpio_set_function(CONFIG_RP2040_I2C1_GPIO + 1,
rp2040_gpio_set_function(CONFIG_RP2040_I2C1_SCL_GPIO,
RP2040_GPIO_FUNC_I2C); /* SCL */
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C1_GPIO, true, false); /* Pull up */
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C1_GPIO + 1, true, false);
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C1_SDA_GPIO, true, false); /* Pull up */
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C1_SCL_GPIO, true, false);
#endif
/* Set default SPI pin */
#if defined(CONFIG_RP2040_SPI0) && CONFIG_RP2040_SPI0_GPIO >= 0
rp2040_gpio_set_function(CONFIG_RP2040_SPI0_GPIO,
#ifdef CONFIG_RP2040_SPI0
rp2040_gpio_set_function(CONFIG_RP2040_SPI0_RX_GPIO,
RP2040_GPIO_FUNC_SPI); /* RX */
rp2040_gpio_set_function(CONFIG_RP2040_SPI0_GPIO + 2,
rp2040_gpio_set_function(CONFIG_RP2040_SPI0_SCK_GPIO,
RP2040_GPIO_FUNC_SPI); /* SCK */
rp2040_gpio_set_function(CONFIG_RP2040_SPI0_GPIO + 3,
rp2040_gpio_set_function(CONFIG_RP2040_SPI0_TX_GPIO,
RP2040_GPIO_FUNC_SPI); /* TX */
/* CSn is controlled by board-specific logic */
rp2040_gpio_init(CONFIG_RP2040_SPI0_GPIO + 1); /* CSn */
rp2040_gpio_setdir(CONFIG_RP2040_SPI0_GPIO + 1, true);
rp2040_gpio_put(CONFIG_RP2040_SPI0_GPIO + 1, true);
rp2040_gpio_init(CONFIG_RP2040_SPI0_CS_GPIO); /* CSn */
rp2040_gpio_setdir(CONFIG_RP2040_SPI0_CS_GPIO, true);
rp2040_gpio_put(CONFIG_RP2040_SPI0_CS_GPIO, true);
#endif
#if defined(CONFIG_RP2040_SPI1) && CONFIG_RP2040_SPI1_GPIO >= 0
rp2040_gpio_set_function(CONFIG_RP2040_SPI1_GPIO,
#ifdef CONFIG_RP2040_SPI1
rp2040_gpio_set_function(CONFIG_RP2040_SPI1_RX_GPIO,
RP2040_GPIO_FUNC_SPI); /* RX */
rp2040_gpio_set_function(CONFIG_RP2040_SPI1_GPIO + 2,
rp2040_gpio_set_function(CONFIG_RP2040_SPI1_SCK_GPIO,
RP2040_GPIO_FUNC_SPI); /* SCK */
rp2040_gpio_set_function(CONFIG_RP2040_SPI1_GPIO + 3,
rp2040_gpio_set_function(CONFIG_RP2040_SPI1_TX_GPIO,
RP2040_GPIO_FUNC_SPI); /* TX */
/* CSn is controlled by board-specific logic */
rp2040_gpio_init(CONFIG_RP2040_SPI1_GPIO + 1); /* CSn */
rp2040_gpio_setdir(CONFIG_RP2040_SPI1_GPIO + 1, true);
rp2040_gpio_put(CONFIG_RP2040_SPI1_GPIO + 1, true);
rp2040_gpio_init(CONFIG_RP2040_SPI1_CS_GPIO); /* CSn */
rp2040_gpio_setdir(CONFIG_RP2040_SPI1_CS_GPIO, true);
rp2040_gpio_put(CONFIG_RP2040_SPI1_CS_GPIO, true);
#endif
}

View File

@ -462,6 +462,7 @@ int rp2040_bringup(void)
#if defined(CONFIG_RP2040_BOARD_HAS_WS2812) && defined(CONFIG_WS2812)
rp2040_ws2812_setup("/dev/leds0",
CONFIG_RP2040_WS2812_GPIO_PIN,
CONFIG_RP2040_WS2812_PWR_GPIO,
CONFIG_WS2812_LED_COUNT,
HAS_WHITE);
#endif

View File

@ -74,7 +74,7 @@ void rp2040_spi0select(struct spi_dev_s *dev, uint32_t devid,
spiinfo("devid: %d CS: %s\n", (int)devid,
selected ? "assert" : "de-assert");
rp2040_gpio_put(CONFIG_RP2040_SPI0_GPIO + 1, !selected);
rp2040_gpio_put(CONFIG_RP2040_SPI0_CS_GPIO, !selected);
}
uint8_t rp2040_spi0status(struct spi_dev_s *dev, uint32_t devid)
@ -97,7 +97,7 @@ int rp2040_spi0cmddata(struct spi_dev_s *dev, uint32_t devid, bool cmd)
* data bits are data or a command.
*/
rp2040_gpio_put(CONFIG_RP2040_SPI0_GPIO, !cmd);
rp2040_gpio_put(CONFIG_RP2040_SPI0_RX_GPIO, !cmd);
return OK;
}
@ -115,7 +115,7 @@ void rp2040_spi1select(struct spi_dev_s *dev, uint32_t devid,
spiinfo("devid: %d CS: %s\n", (int)devid,
selected ? "assert" : "de-assert");
rp2040_gpio_put(CONFIG_RP2040_SPI1_GPIO + 1, !selected);
rp2040_gpio_put(CONFIG_RP2040_SPI1_CS_GPIO, !selected);
}
uint8_t rp2040_spi1status(struct spi_dev_s *dev, uint32_t devid)
@ -138,7 +138,7 @@ int rp2040_spi1cmddata(struct spi_dev_s *dev, uint32_t devid, bool cmd)
* data bits are data or a command.
*/
rp2040_gpio_put(CONFIG_RP2040_SPI1_GPIO, !cmd);
rp2040_gpio_put(CONFIG_RP2040_SPI1_RX_GPIO, !cmd);
return OK;
}

View File

@ -0,0 +1,30 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
if ARCH_BOARD_ADAFRUIT_QT_PY_RP2040
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 Q64 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.
endif

View File

@ -0,0 +1,98 @@
README
======
This directory contains the port of NuttX to the Adafruit QT Py RP2040.
See https://learn.adafruit.com/adafruit-qt-py-2040 for information
about Adafruit QT Py RP2040.
Currently only the following devices are supported.
Supported:
- UART (console port)
- GPIO 5 (UART1 RX) and GPIO 20 (UART1 TX) are used for the console.
- I2C
- SPI
- DMAC
- PWM
- ADC
- USB device
- MSC, CDC/ACM serial and these composite device are supported.
- CDC/ACM serial device can be used for the console.
- PIO (RP2040 Programmable I/O)
- Flash ROM Boot
- SRAM Boot
- If Pico SDK is available, nuttx.uf2 file which can be used in
BOOTSEL mode will be created.
Not supported:
- All other devices
Installation
============
1. Download Raspberry Pi Pico SDK
$ git clone -b 1.1.2 https://github.com/raspberrypi/pico-sdk.git
2. Set PICO_SDK_PATH environment variable
$ export PICO_SDK_PATH=<absolute_path_to_pico-sdk_directory>
3. Configure and build NuttX
$ git clone https://github.com/apache/incubator-nuttx.git nuttx
$ git clone https://github.com/apache/incubator-nuttx-apps.git apps
$ cd nuttx
$ make distclean
$ ./tools/configure.sh raspberrypi-pico:nsh
$ make V=1
4. Connect Adafruit KB2040 board to USB port while pressing BOOTSEL.
The board will be detected as USB Mass Storage Device.
Then copy "nuttx.uf2" into the device.
(Same manner as the standard Pico SDK applications installation.)
5. To access the console, GPIO 20 (TX) and 5 (RX) pins must be connected to a
device such as USB-serial converter.
`usbnsh` configuration provides the console access by USB CDC/ACM serial
devcice. The console is available by using a terminal software on the USB
host.
Defconfigs
==========
- nsh
Minimum configuration with NuttShell
- nshsram
Load NuttX binary to SRAM
- smp
Enable SMP mode. Both Core 0 and Core 1 are used by NuttX.
- usbnsh
USB CDC/ACM serial console with NuttShell
- composite
USB composite device (MSC + CDC/ACM) support
`conn` command enables the composite device.
License exceptions
==================
The following files are originated from the files in Pico SDK.
So, the files are licensed under 3-Clause BSD same as Pico SDK.
- arch/arm/src/rp2040/rp2040_clock.c
- arch/arm/src/rp2040/rp2040_pll.c
- arch/arm/src/rp2040/rp2040_xosc.c
- These are created by referring the Pico SDK clock initialization.
- arch/arm/src/rp2040/rp2040_pio.c
- arch/arm/src/rp2040/rp2040_pio.h
- arch/arm/src/rp2040/rp2040_pio_instructions.h
- These provide the similar APIs to Pico SDK's hardware_pio APIs.
- arch/arm/src/rp2040/hardware/*.h
- These are generated from rp2040.svd originally provided in Pico SDK.

View File

@ -0,0 +1,57 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_FS_PROCFS_EXCLUDE_ENVIRON is not set
# CONFIG_NSH_ARGCAT is not set
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
# CONFIG_NSH_DISABLE_DATE is not set
# CONFIG_NSH_DISABLE_LOSMART is not set
# CONFIG_RP2040_UART0 is not set
# CONFIG_STANDARD_SERIAL is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-qt-py-rp2040"
CONFIG_ARCH_BOARD_ADAFRUIT_QT_PY_RP2040=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_RAMVECTORS=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARDCTL_RESET=y
CONFIG_BOARD_LOOPSPERMSEC=10450
CONFIG_BUILTIN=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DEV_GPIO=y
CONFIG_DISABLE_POSIX_TIMERS=y
CONFIG_EXAMPLES_GPIO=y
CONFIG_EXAMPLES_HELLO=y
CONFIG_FS_PROCFS=y
CONFIG_FS_PROCFS_REGISTER=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_READLINE=y
CONFIG_RAM_SIZE=270336
CONFIG_RAM_START=0x20000000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_BOARD_HAS_WS2812=y
CONFIG_RP2040_UART1=y
CONFIG_RP2040_UART1_RX_GPIO=5
CONFIG_RP2040_WS2812_GPIO_PIN=12
CONFIG_RP2040_WS2812_PWR_GPIO=11
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_WAITPID=y
CONFIG_START_DAY=11
CONFIG_START_MONTH=12
CONFIG_START_YEAR=2021
CONFIG_SYSLOG_CONSOLE=y
CONFIG_SYSTEM_NSH=y
CONFIG_TESTING_GETPRIME=y
CONFIG_TESTING_OSTEST=y
CONFIG_UART1_SERIAL_CONSOLE=y
CONFIG_WS2812=y
CONFIG_WS2812_NON_SPI_DRIVER=y

View File

@ -0,0 +1,55 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_FS_PROCFS_EXCLUDE_ENVIRON is not set
# CONFIG_NSH_ARGCAT is not set
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
# CONFIG_NSH_DISABLE_DATE is not set
# CONFIG_NSH_DISABLE_LOSMART is not set
# CONFIG_RP2040_UART0 is not set
# CONFIG_STANDARD_SERIAL is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-qt-py-rp2040"
CONFIG_ARCH_BOARD_ADAFRUIT_QT_PY_RP2040=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_RAMVECTORS=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARDCTL_RESET=y
CONFIG_BOARD_LOOPSPERMSEC=10450
CONFIG_BUILTIN=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DISABLE_POSIX_TIMERS=y
CONFIG_EXAMPLES_HELLO=y
CONFIG_FS_PROCFS=y
CONFIG_FS_PROCFS_REGISTER=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_READLINE=y
CONFIG_RAM_SIZE=270336
CONFIG_RAM_START=0x20000000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_BOARD_HAS_WS2812=y
CONFIG_RP2040_UART1=y
CONFIG_RP2040_UART1_RX_GPIO=5
CONFIG_RP2040_WS2812_GPIO_PIN=12
CONFIG_RP2040_WS2812_PWR_GPIO=11
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_WAITPID=y
CONFIG_START_DAY=9
CONFIG_START_MONTH=2
CONFIG_START_YEAR=2021
CONFIG_SYSLOG_CONSOLE=y
CONFIG_SYSTEM_NSH=y
CONFIG_TESTING_GETPRIME=y
CONFIG_TESTING_OSTEST=y
CONFIG_UART1_SERIAL_CONSOLE=y
CONFIG_WS2812=y
CONFIG_WS2812_NON_SPI_DRIVER=y

View File

@ -0,0 +1,54 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_FS_PROCFS_EXCLUDE_ENVIRON is not set
# CONFIG_NSH_ARGCAT is not set
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
# CONFIG_NSH_DISABLE_DATE is not set
# CONFIG_NSH_DISABLE_LOSMART is not set
# CONFIG_RP2040_UART0 is not set
# CONFIG_STANDARD_SERIAL is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-qt-py-rp2040"
CONFIG_ARCH_BOARD_ADAFRUIT_QT_PY_RP2040=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARDCTL_RESET=y
CONFIG_BOARD_LOOPSPERMSEC=10450
CONFIG_BUILTIN=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DISABLE_POSIX_TIMERS=y
CONFIG_EXAMPLES_HELLO=y
CONFIG_FS_PROCFS=y
CONFIG_FS_PROCFS_REGISTER=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_READLINE=y
CONFIG_RAM_SIZE=270336
CONFIG_RAM_START=0x20000000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_BOARD_HAS_WS2812=y
CONFIG_RP2040_UART1=y
CONFIG_RP2040_UART1_RX_GPIO=5
CONFIG_RP2040_WS2812_GPIO_PIN=12
CONFIG_RP2040_WS2812_PWR_GPIO=11
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_WAITPID=y
CONFIG_START_DAY=9
CONFIG_START_MONTH=2
CONFIG_START_YEAR=2021
CONFIG_SYSLOG_CONSOLE=y
CONFIG_SYSTEM_NSH=y
CONFIG_TESTING_GETPRIME=y
CONFIG_TESTING_OSTEST=y
CONFIG_UART1_SERIAL_CONSOLE=y
CONFIG_WS2812=y
CONFIG_WS2812_NON_SPI_DRIVER=y

View File

@ -0,0 +1,61 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_FS_PROCFS_EXCLUDE_ENVIRON is not set
# CONFIG_NSH_ARGCAT is not set
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
# CONFIG_NSH_DISABLE_DATE is not set
# CONFIG_NSH_DISABLE_LOSMART is not set
# CONFIG_RP2040_UART0 is not set
# CONFIG_STANDARD_SERIAL is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-qt-py-rp2040"
CONFIG_ARCH_BOARD_ADAFRUIT_QT_PY_RP2040=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_ARCH_RAMVECTORS=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARDCTL_RESET=y
CONFIG_BOARD_LOOPSPERMSEC=10450
CONFIG_BUILTIN=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DISABLE_POSIX_TIMERS=y
CONFIG_EXAMPLES_HELLO=y
CONFIG_FS_PROCFS=y
CONFIG_FS_PROCFS_REGISTER=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_READLINE=y
CONFIG_RAM_SIZE=270336
CONFIG_RAM_START=0x20000000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_BOARD_HAS_WS2812=y
CONFIG_RP2040_UART1=y
CONFIG_RP2040_UART1_RX_GPIO=5
CONFIG_RP2040_WS2812_GPIO_PIN=12
CONFIG_RP2040_WS2812_PWR_GPIO=11
CONFIG_RR_INTERVAL=200
CONFIG_SMP=y
CONFIG_SMP_NCPUS=2
CONFIG_STACK_COLORATION=y
CONFIG_START_DAY=9
CONFIG_START_MONTH=2
CONFIG_START_YEAR=2021
CONFIG_SYSLOG_CONSOLE=y
CONFIG_SYSTEM_NSH=y
CONFIG_SYSTEM_SYSTEM=y
CONFIG_SYSTEM_TASKSET=y
CONFIG_TESTING_GETPRIME=y
CONFIG_TESTING_OSTEST=y
CONFIG_TESTING_SMP=y
CONFIG_UART1_SERIAL_CONSOLE=y
CONFIG_WS2812=y
CONFIG_WS2812_NON_SPI_DRIVER=y

View File

@ -0,0 +1,56 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_DEV_CONSOLE is not set
# CONFIG_FS_PROCFS_EXCLUDE_ENVIRON is not set
# CONFIG_NSH_ARGCAT is not set
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
# CONFIG_NSH_DISABLE_DATE is not set
# CONFIG_NSH_DISABLE_LOSMART is not set
# CONFIG_RP2040_UART0 is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="adafruit-qt-py-rp2040"
CONFIG_ARCH_BOARD_ADAFRUIT_QT_PY_RP2040=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
CONFIG_ARCH_RAMVECTORS=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARDCTL_RESET=y
CONFIG_BOARD_LOOPSPERMSEC=10450
CONFIG_BUILTIN=y
CONFIG_CDCACM=y
CONFIG_CDCACM_CONSOLE=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DISABLE_POSIX_TIMERS=y
CONFIG_EXAMPLES_HELLO=y
CONFIG_FS_PROCFS=y
CONFIG_FS_PROCFS_REGISTER=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_READLINE=y
CONFIG_NSH_USBCONSOLE=y
CONFIG_RAM_SIZE=270336
CONFIG_RAM_START=0x20000000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_BOARD_HAS_WS2812=y
CONFIG_RP2040_WS2812_GPIO_PIN=12
CONFIG_RP2040_WS2812_PWR_GPIO=11
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_WAITPID=y
CONFIG_START_DAY=9
CONFIG_START_MONTH=2
CONFIG_START_YEAR=2021
CONFIG_SYSTEM_NSH=y
CONFIG_TESTING_GETPRIME=y
CONFIG_TESTING_OSTEST=y
CONFIG_USBDEV=y
CONFIG_USBDEV_BUSPOWERED=y
CONFIG_WS2812=y
CONFIG_WS2812_NON_SPI_DRIVER=y

View File

@ -0,0 +1,117 @@
/****************************************************************************
* boards/arm/rp2040/adafruit-qt-py-rp2040/include/board.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __BOARDS_ARM_RP2040_ADAFRUIT_QT_PY_RP2040_INCLUDE_BOARD_H
#define __BOARDS_ARM_RP2040_ADAFRUIT_QT_PY_RP2040_INCLUDE_BOARD_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include "rp2040_i2cdev.h"
#include "rp2040_spidev.h"
#include "rp2040_i2sdev.h"
#include "rp2040_spisd.h"
#ifndef __ASSEMBLY__
# include <stdint.h>
#endif
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Clocking *****************************************************************/
#define MHZ 1000000
#define BOARD_XOSC_FREQ (12 * MHZ)
#define BOARD_PLL_SYS_FREQ (125 * MHZ)
#define BOARD_PLL_USB_FREQ (48 * MHZ)
#define BOARD_REF_FREQ (12 * MHZ)
#define BOARD_SYS_FREQ (125 * MHZ)
#define BOARD_PERI_FREQ (125 * MHZ)
#define BOARD_USB_FREQ (48 * MHZ)
#define BOARD_ADC_FREQ (48 * MHZ)
#define BOARD_RTC_FREQ 46875
#define BOARD_UART_BASEFREQ BOARD_PERI_FREQ
#define BOARD_TICK_CLOCK (1 * MHZ)
/* GPIO definitions *********************************************************/
#undef BOARD_GPIO_LED_PIN
#define BOARD_GPIO_WS2812_PWR_PIN 11
#define BOARD_NGPIOOUT 1
#define BOARD_NGPIOIN 1
#define BOARD_NGPIOINT 1
/****************************************************************************
* Public Types
****************************************************************************/
#ifndef __ASSEMBLY__
/****************************************************************************
* Public Data
****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: rp2040_boardearlyinitialize
*
* Description:
*
****************************************************************************/
void rp2040_boardearlyinitialize(void);
/****************************************************************************
* Name: rp2040_boardinitialize
*
* Description:
*
****************************************************************************/
void rp2040_boardinitialize(void);
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_ARM_RP2040_ADAFRUIT_QT_PY_RP2040_INCLUDE_BOARD_H */

View File

@ -0,0 +1,72 @@
/****************************************************************************
* boards/arm/rp2040/adafruit-qt-py-rp2040/include/rp2040_i2cdev.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __BOARDS_ARM_RP2040_ADAFRUIT_QT_PY_RB2040_INCLUDE_RP2040_I2CDEV_H
#define __BOARDS_ARM_RP2040_ADAFRUIT_QT_PY_RB2040_INCLUDE_RP2040_I2CDEV_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
/****************************************************************************
* Public Types
****************************************************************************/
#ifndef __ASSEMBLY__
/****************************************************************************
* Public Data
****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: board_i2cdev_initialize
*
* Description:
* Initialize i2c driver and register the /dev/i2c device.
*
****************************************************************************/
#ifdef CONFIG_RP2040_I2C_DRIVER
int board_i2cdev_initialize(int bus);
#endif
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_ARM_RP2040_ADAFRUIT_QT_PY_RB2040_INCLUDE_RP2040_I2CDEV_H */

View File

@ -0,0 +1,72 @@
/****************************************************************************
* boards/arm/rp2040/adafruit-qt-py-rp2040/include/rp2040_i2sdev.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __BOARDS_ARM_RP2040_ADAFRUIT_QT_PY_RB2040_INCLUDE_RP2040_I2SDEV_H
#define __BOARDS_ARM_RP2040_ADAFRUIT_QT_PY_RB2040_INCLUDE_RP2040_I2SDEV_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
/****************************************************************************
* Public Types
****************************************************************************/
#ifndef __ASSEMBLY__
/****************************************************************************
* Public Data
****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: board_i2sdev_initialize
*
* Description:
* Initialize i2s driver and register the /dev/audio/pcm0 device.
*
****************************************************************************/
#ifdef CONFIG_RP2040_I2S
int board_i2sdev_initialize(int bus);
#endif
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_ARM_RP2040_ADAFRUIT_QT_PY_RB2040_INCLUDE_RP2040_I2SDEV_H */

View File

@ -0,0 +1,69 @@
/****************************************************************************
* boards/arm/rp2040/adafruit-qt-py-rp2040/include/rp2040_spidev.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __BOARDS_ARM_RP2040_ADAFRUIT_QT_PY_RB2040_INCLUDE_RP2040_SPIDEV_H
#define __BOARDS_ARM_RP2040_ADAFRUIT_QT_PY_RB2040_INCLUDE_RP2040_SPIDEV_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
/****************************************************************************
* Public Types
****************************************************************************/
#ifndef __ASSEMBLY__
/****************************************************************************
* Public Data
****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: board_spidev_initialize
*
* Description:
* Initialize spi driver and register the /dev/spi device.
*
****************************************************************************/
int board_spidev_initialize(int bus);
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_ARM_RP2040_ADAFRUIT_QT_PY_RB2040_INCLUDE_RP2040_SPIDEV_H */

View File

@ -0,0 +1,83 @@
/****************************************************************************
* boards/arm/rp2040/adafruit-qt-py-rp2040/include/rp2040_spisd.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __BOARDS_ARM_RP2040_ADAFRUIT_QT_PY_RB2040_INCLUDE_RP2040_SPISD_H
#define __BOARDS_ARM_RP2040_ADAFRUIT_QT_PY_RB2040_INCLUDE_RP2040_SPISD_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
/****************************************************************************
* Public Types
****************************************************************************/
#ifndef __ASSEMBLY__
/****************************************************************************
* Public Data
****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: board_spisd_initialize
*
* Description:
* Initialize the SPI-based SD card.
*
****************************************************************************/
#ifdef CONFIG_RP2040_SPISD
int board_spisd_initialize(int minor, int bus);
#endif
/****************************************************************************
* Name: board_spisd_status
*
* Description:
* Get the status whether SD Card is present or not.
*
****************************************************************************/
#ifdef CONFIG_RP2040_SPISD
uint8_t board_spisd_status(struct spi_dev_s *dev, uint32_t devid);
#endif
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_ARM_RP2040_ADAFRUIT_QT_PY_RB2040_INCLUDE_RP2040_SPISD_H */

View File

@ -0,0 +1,45 @@
############################################################################
# boards/arm/rp2040/adafruit-qt-py-rp2040/scripts/Make.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
include $(TOPDIR)/.config
include $(TOPDIR)/tools/Config.mk
include $(TOPDIR)/tools/rp2040/Config.mk
include $(TOPDIR)/arch/arm/src/armv6-m/Toolchain.defs
ifeq ($(CONFIG_RP2040_FLASH_BOOT),y)
LDSCRIPT = adafruit-qt-py-rp2040-flash.ld
else
LDSCRIPT = adafruit-qt-py-rp2040-sram.ld
endif
ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
AFLAGS := $(CFLAGS) -D__ASSEMBLY__
NXFLATLDFLAGS1 = -r -d -warn-common
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
LDNXFLATFLAGS = -e main -s 2048

View File

@ -0,0 +1,112 @@
/****************************************************************************
* boards/arm/rp2040/adafruit-kb2040/scripts/adafruit-qt-py-rp2040-flash.ld
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
MEMORY
{
flash (rx) : ORIGIN = 0x10000000, LENGTH = 8192K
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 264K
}
OUTPUT_ARCH(arm)
EXTERN(_vectors)
ENTRY(_stext)
SECTIONS
{
.flash_begin : {
__flash_binary_start = .;
} > flash
.boot2 : {
__boot2_start__ = .;
KEEP (*(.boot2))
__boot2_end__ = .;
} > flash
.text : {
_stext = ABSOLUTE(.);
*(.vectors)
*(.text .text.*)
*(.fixup)
*(.gnu.warning)
*(.rodata .rodata.*)
*(.gnu.linkonce.t.*)
*(.glue_7)
*(.glue_7t)
*(.got)
*(.gcc_except_table)
*(.gnu.linkonce.r.*)
_etext = ABSOLUTE(.);
} > flash
.init_section : {
_sinit = ABSOLUTE(.);
*(.init_array .init_array.*)
_einit = ABSOLUTE(.);
} > flash
.ARM.extab : {
*(.ARM.extab*)
} > flash
__exidx_start = ABSOLUTE(.);
.ARM.exidx : {
*(.ARM.exidx*)
} > flash
__exidx_end = ABSOLUTE(.);
_eronly = ABSOLUTE(.);
.ram_vectors (COPY) : {
*(.ram_vectors)
} > sram
.data : {
_sdata = ABSOLUTE(.);
*(.data .data.*)
*(.gnu.linkonce.d.*)
CONSTRUCTORS
. = ALIGN(4);
_edata = ABSOLUTE(.);
} > sram AT > flash
.bss : {
_sbss = ABSOLUTE(.);
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(4);
_ebss = ABSOLUTE(.);
} > sram
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_info 0 : { *(.debug_info) }
.debug_line 0 : { *(.debug_line) }
.debug_pubnames 0 : { *(.debug_pubnames) }
.debug_aranges 0 : { *(.debug_aranges) }
}

View File

@ -0,0 +1,97 @@
/****************************************************************************
* boards/arm/rp2040/adafruit-kb2040/scripts/adafruit-qt-py-rp2040-sram.ld
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
MEMORY
{
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 264K
}
OUTPUT_ARCH(arm)
EXTERN(_vectors)
ENTRY(_stext)
SECTIONS
{
.text : {
_stext = ABSOLUTE(.);
rp2040_start.o(.text)
. = ALIGN(256);
*(.vectors)
*(.text .text.*)
*(.fixup)
*(.gnu.warning)
*(.rodata .rodata.*)
*(.gnu.linkonce.t.*)
*(.glue_7)
*(.glue_7t)
*(.got)
*(.gcc_except_table)
*(.gnu.linkonce.r.*)
_etext = ABSOLUTE(.);
} > sram
.init_section : {
_sinit = ABSOLUTE(.);
*(.init_array .init_array.*)
_einit = ABSOLUTE(.);
} > sram
.ARM.extab : {
*(.ARM.extab*)
} > sram
__exidx_start = ABSOLUTE(.);
.ARM.exidx : {
*(.ARM.exidx*)
} > sram
__exidx_end = ABSOLUTE(.);
.data : {
_sdata = ABSOLUTE(.);
*(.data .data.*)
*(.gnu.linkonce.d.*)
CONSTRUCTORS
. = ALIGN(4);
_edata = ABSOLUTE(.);
} > sram
.bss : {
_sbss = ABSOLUTE(.);
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(4);
_ebss = ABSOLUTE(.);
} > sram
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_info 0 : { *(.debug_info) }
.debug_line 0 : { *(.debug_line) }
.debug_pubnames 0 : { *(.debug_pubnames) }
.debug_aranges 0 : { *(.debug_aranges) }
}

View File

@ -0,0 +1,41 @@
############################################################################
# boards/arm/rp2040/adafruit-qt-py-rp2040/src/Make.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
include $(TOPDIR)/Make.defs
CSRCS = rp2040_boardinitialize.c
CSRCS += rp2040_appinit.c
CSRCS += rp2040_bringup.c
ifeq ($(CONFIG_BOARDCTL_RESET),y)
CSRCS += rp2040_reset.c
endif
ifeq ($(CONFIG_SPI),y)
CSRCS += rp2040_spi.c
endif
ifeq ($(CONFIG_DEV_GPIO),y)
CSRCS += rp2040_gpio.c
endif
DEPPATH += --dep-path board
VPATH += :board
CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board)

View File

@ -0,0 +1,76 @@
/****************************************************************************
* boards/arm/rp2040/adafruit-qt-py-rp2040/src/rp2040_appinit.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/board.h>
#include <sys/types.h>
#include "rp2040_pico.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_app_initialize
*
* Description:
* Perform application specific initialization. This function is never
* called directly from application code, but only indirectly via the
* (non-standard) boardctl() interface using the command BOARDIOC_INIT.
*
* Input Parameters:
* arg - The boardctl() argument is passed to the board_app_initialize()
* implementation without modification. The argument has no
* meaning to NuttX; the meaning of the argument is a contract
* between the board-specific initialization logic and the
* matching application logic. The value could be such things as a
* mode enumeration value, a set of DIP switch switch settings, a
* pointer to configuration data read from a file or serial FLASH,
* or whatever you would like to do with it. Every implementation
* should accept zero/NULL as a default configuration.
*
* Returned Value:
* Zero (OK) is returned on success; a negated errno value is returned on
* any failure to indicate the nature of the failure.
*
****************************************************************************/
int board_app_initialize(uintptr_t arg)
{
#ifdef CONFIG_BOARD_LATE_INITIALIZE
/* Board initialization already performed by board_late_initialize() */
return OK;
#else
/* Perform board-specific initialization */
return rp2040_bringup();
#endif
}

View File

@ -0,0 +1,160 @@
/****************************************************************************
* boards/arm/rp2040/adafruit-qt-py-rp2040/src/rp2040_boardinitialize.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <debug.h>
#include <nuttx/board.h>
#include <arch/board/board.h>
#include "arm_internal.h"
#include "rp2040_gpio.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: rp2040_boardearlyinitialize
*
* Description:
*
****************************************************************************/
void rp2040_boardearlyinitialize(void)
{
rp2040_gpio_initialize();
/* Disable IE on GPIO 26-29 */
clrbits_reg32(RP2040_PADS_BANK0_GPIO_IE, RP2040_PADS_BANK0_GPIO(26));
clrbits_reg32(RP2040_PADS_BANK0_GPIO_IE, RP2040_PADS_BANK0_GPIO(27));
clrbits_reg32(RP2040_PADS_BANK0_GPIO_IE, RP2040_PADS_BANK0_GPIO(28));
clrbits_reg32(RP2040_PADS_BANK0_GPIO_IE, RP2040_PADS_BANK0_GPIO(29));
/* Set default UART pin */
#ifdef CONFIG_RP2040_UART0
rp2040_gpio_set_function(CONFIG_RP2040_UART0_TX_GPIO,
RP2040_GPIO_FUNC_UART); /* TX */
rp2040_gpio_set_function(CONFIG_RP2040_UART0_RX_GPIO,
RP2040_GPIO_FUNC_UART); /* RX */
#ifdef CONFIG_SERIAL_OFLOWCONTROL
rp2040_gpio_set_function(CONFIG_RP2040_UART0_CTS_GPIO,
RP2040_GPIO_FUNC_UART); /* CTS */
#endif
#ifdef CONFIG_SERIAL_IFLOWCONTROL
rp2040_gpio_set_function(CONFIG_RP2040_UART0_RTS_GPIO,
RP2040_GPIO_FUNC_UART); /* RTS */
#endif
#endif
#ifdef CONFIG_RP2040_UART1
rp2040_gpio_set_function(CONFIG_RP2040_UART1_TX_GPIO,
RP2040_GPIO_FUNC_UART); /* TX */
rp2040_gpio_set_function(CONFIG_RP2040_UART1_RX_GPIO,
RP2040_GPIO_FUNC_UART); /* RX */
#ifdef CONFIG_SERIAL_OFLOWCONTROL
rp2040_gpio_set_function(CONFIG_RP2040_UART1_CTS_GPIO,
RP2040_GPIO_FUNC_UART); /* CTS */
#endif
#ifdef CONFIG_SERIAL_IFLOWCONTROL
rp2040_gpio_set_function(CONFIG_RP2040_UART1_RTS_GPIO,
RP2040_GPIO_FUNC_UART); /* RTS */
#endif
#endif
}
/****************************************************************************
* Name: rp2040_boardinitialize
*
* Description:
*
****************************************************************************/
void rp2040_boardinitialize(void)
{
/* Set default I2C pin */
#ifdef CONFIG_RP2040_I2C0
rp2040_gpio_set_function(CONFIG_RP2040_I2C0_SDA_GPIO,
RP2040_GPIO_FUNC_I2C); /* SDA */
rp2040_gpio_set_function(CONFIG_RP2040_I2C0_SCL_GPIO,
RP2040_GPIO_FUNC_I2C); /* SCL */
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C0_SDA_GPIO, true, false); /* Pull up */
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C0_SCL_GPIO, true, false);
#endif
#ifdef CONFIG_RP2040_I2C1
rp2040_gpio_set_function(CONFIG_RP2040_I2C1_SDA_GPIO,
RP2040_GPIO_FUNC_I2C); /* SDA */
rp2040_gpio_set_function(CONFIG_RP2040_I2C1_SCL_GPIO,
RP2040_GPIO_FUNC_I2C); /* SCL */
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C1_SDA_GPIO, true, false); /* Pull up */
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C1_SCL_GPIO, true, false);
#endif
/* Set default SPI pin */
#ifdef CONFIG_RP2040_SPI0
rp2040_gpio_set_function(CONFIG_RP2040_SPI0_RX_GPIO,
RP2040_GPIO_FUNC_SPI); /* RX */
rp2040_gpio_set_function(CONFIG_RP2040_SPI0_SCK_GPIO,
RP2040_GPIO_FUNC_SPI); /* SCK */
rp2040_gpio_set_function(CONFIG_RP2040_SPI0_TX_GPIO,
RP2040_GPIO_FUNC_SPI); /* TX */
/* CSn is controlled by board-specific logic */
rp2040_gpio_init(CONFIG_RP2040_SPI0_CS_GPIO); /* CSn */
rp2040_gpio_setdir(CONFIG_RP2040_SPI0_CS_GPIO, true);
rp2040_gpio_put(CONFIG_RP2040_SPI0_CS_GPIO, true);
#endif
#ifdef CONFIG_RP2040_SPI1
rp2040_gpio_set_function(CONFIG_RP2040_SPI1_RX_GPIO,
RP2040_GPIO_FUNC_SPI); /* RX */
rp2040_gpio_set_function(CONFIG_RP2040_SPI1_SCK_GPIO,
RP2040_GPIO_FUNC_SPI); /* SCK */
rp2040_gpio_set_function(CONFIG_RP2040_SPI1_TX_GPIO,
RP2040_GPIO_FUNC_SPI); /* TX */
/* CSn is controlled by board-specific logic */
rp2040_gpio_init(CONFIG_RP2040_SPI1_CS_GPIO); /* CSn */
rp2040_gpio_setdir(CONFIG_RP2040_SPI1_CS_GPIO, true);
rp2040_gpio_put(CONFIG_RP2040_SPI1_CS_GPIO, true);
#endif
}

View File

@ -0,0 +1,512 @@
/****************************************************************************
* boards/arm/rp2040/adafruit-qt-py-rp2040/src/rp2040_bringup.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <debug.h>
#include <stddef.h>
#include <nuttx/fs/fs.h>
#include <arch/board/board.h>
#include "rp2040_pico.h"
#ifdef CONFIG_LCD_BACKPACK
#include "rp2040_lcd_backpack.h"
#endif
#ifdef CONFIG_LCD
#include <nuttx/board.h>
#endif
#ifdef CONFIG_LCD_DEV
#include <nuttx/lcd/lcd_dev.h>
#endif
#ifdef CONFIG_VIDEO_FB
#include <nuttx/video/fb.h>
#endif
#ifdef CONFIG_SENSORS_INA219
#include <nuttx/sensors/ina219.h>
#include "rp2040_ina219.h"
#endif
#ifdef CONFIG_SENSORS_BMP180
#include <nuttx/sensors/bmp180.h>
#include "rp2040_bmp180.h"
#endif
#ifdef CONFIG_RP2040_PWM
#include "rp2040_pwm.h"
#include "rp2040_pwmdev.h"
#endif
#if defined(CONFIG_RP2040_BOARD_HAS_WS2812) && defined(CONFIG_WS2812)
#include "rp2040_ws2812.h"
#endif
#ifdef CONFIG_WS2812_HAS_WHITE
#define HAS_WHITE true
#else /* CONFIG_WS2812_HAS_WHITE */
#define HAS_WHITE false
#endif /* CONFIG_WS2812_HAS_WHITE */
#if defined(CONFIG_ADC) && defined(CONFIG_RP2040_ADC)
#include "rp2040_adc.h"
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: rp2040_bringup
****************************************************************************/
int rp2040_bringup(void)
{
int ret = 0;
#ifdef CONFIG_RP2040_I2C_DRIVER
#ifdef CONFIG_RP2040_I2C0
ret = board_i2cdev_initialize(0);
if (ret < 0)
{
_err("ERROR: Failed to initialize I2C0.\n");
}
#endif
#ifdef CONFIG_RP2040_I2C1
ret = board_i2cdev_initialize(1);
if (ret < 0)
{
_err("ERROR: Failed to initialize I2C1.\n");
}
#endif
#endif
#ifdef CONFIG_RP2040_SPI_DRIVER
#ifdef CONFIG_RP2040_SPI0
ret = board_spidev_initialize(0);
if (ret < 0)
{
_err("ERROR: Failed to initialize SPI0.\n");
}
#endif
#ifdef CONFIG_RP2040_SPI1
ret = board_spidev_initialize(1);
if (ret < 0)
{
_err("ERROR: Failed to initialize SPI1.\n");
}
#endif
#endif
#ifdef CONFIG_RP2040_PWM
# ifdef CONFIG_RP2040_PWM0
# if defined(CONFIG_PWM_NCHANNELS) && CONFIG_PWM_NCHANNELS == 2
ret = rp2040_pwmdev_initialize(0,
CONFIG_RP2040_PWM0A_GPIO,
CONFIG_RP2040_PWM0B_GPIO,
(0
# ifdef CONFIG_RP2040_PWM0A_INVERT
| RP2040_PWM_CSR_A_INV
# endif
# ifdef CONFIG_RP2040_PWM0B_INVERT
| RP2040_PWM_CSR_B_INV
# endif
# ifdef CONFIG_RP2040_PWM0_PHASE_CORRECT
| RP2040_PWM_CSR_PH_CORRECT
# endif
));
# else
ret = rp2040_pwmdev_initialize(0,
CONFIG_RP2040_PWM0A_GPIO,
(0
# ifdef CONFIG_RP2040_PWM0A_INVERT
| RP2040_PWM_CSR_A_INV
# endif
# ifdef CONFIG_RP2040_PWM0_PHASE_CORRECT
| RP2040_PWM_CSR_PH_CORRECT
# endif
));
# endif
if (ret < 0)
{
_err("ERROR: Failed to initialize PWM0.\n");
}
# endif
# ifdef CONFIG_RP2040_PWM1
# if defined(CONFIG_PWM_NCHANNELS) && CONFIG_PWM_NCHANNELS == 2
ret = rp2040_pwmdev_initialize(1,
CONFIG_RP2040_PWM1A_GPIO,
CONFIG_RP2040_PWM1B_GPIO,
(0
# ifdef CONFIG_RP2040_PWM1A_INVERT
| RP2040_PWM_CSR_A_INV
# endif
# ifdef CONFIG_RP2040_PWM1B_INVERT
| RP2040_PWM_CSR_B_INV
# endif
# ifdef CONFIG_RP2040_PWM1_PHASE_CORRECT
| RP2040_PWM_CSR_PH_CORRECT
# endif
));
# else
ret = rp2040_pwmdev_initialize(1,
CONFIG_RP2040_PWM1A_GPIO,
(0
# ifdef CONFIG_RP2040_PWM1A_INVERT
| RP2040_PWM_CSR_A_INV
# endif
# ifdef CONFIG_RP2040_PWM1_PHASE_CORRECT
| RP2040_PWM_CSR_PH_CORRECT
# endif
));
# endif
if (ret < 0)
{
_err("ERROR: Failed to initialize PWM1.\n");
}
# endif
# ifdef CONFIG_RP2040_PWM2
# if defined(CONFIG_PWM_NCHANNELS) && CONFIG_PWM_NCHANNELS == 2
ret = rp2040_pwmdev_initialize(2,
CONFIG_RP2040_PWM2A_GPIO,
CONFIG_RP2040_PWM2B_GPIO,
(0
# ifdef CONFIG_RP2040_PWM2A_INVERT
| RP2040_PWM_CSR_A_INV
# endif
# ifdef CONFIG_RP2040_PWM2B_INVERT
| RP2040_PWM_CSR_B_INV
# endif
# ifdef CONFIG_RP2040_PWM2_PHASE_CORRECT
| RP2040_PWM_CSR_PH_CORRECT
# endif
));
# else
ret = rp2040_pwmdev_initialize(2,
CONFIG_RP2040_PWM2A_GPIO,
(0
# ifdef CONFIG_RP2040_PWM2A_INVERT
| RP2040_PWM_CSR_A_INV
# endif
# ifdef CONFIG_RP2040_PWM2_PHASE_CORRECT
| RP2040_PWM_CSR_PH_CORRECT
# endif
));
# endif
if (ret < 0)
{
_err("ERROR: Failed to initialize PWM2.\n");
}
# endif
# ifdef CONFIG_RP2040_PWM3
# if defined(CONFIG_PWM_NCHANNELS) && CONFIG_PWM_NCHANNELS == 2
ret = rp2040_pwmdev_initialize(3,
CONFIG_RP2040_PWM3A_GPIO,
CONFIG_RP2040_PWM3B_GPIO,
(0
# ifdef CONFIG_RP2040_PWM3A_INVERT
| RP2040_PWM_CSR_A_INV
# endif
# ifdef CONFIG_RP2040_PWM3B_INVERT
| RP2040_PWM_CSR_B_INV
# endif
# ifdef CONFIG_RP2040_PWM3_PHASE_CORRECT
| RP2040_PWM_CSR_PH_CORRECT
# endif
));
# else
ret = rp2040_pwmdev_initialize(3,
CONFIG_RP2040_PWM3A_GPIO,
(0
# ifdef CONFIG_RP2040_PWM3A_INVERT
| RP2040_PWM_CSR_A_INV
# endif
# ifdef CONFIG_RP2040_PWM3_PHASE_CORRECT
| RP2040_PWM_CSR_PH_CORRECT
# endif
));
# endif
if (ret < 0)
{
_err("ERROR: Failed to initialize PWM3.\n");
}
# endif
# ifdef CONFIG_RP2040_PWM4
# if defined(CONFIG_PWM_NCHANNELS) && CONFIG_PWM_NCHANNELS == 2
ret = rp2040_pwmdev_initialize(4,
CONFIG_RP2040_PWM4A_GPIO,
CONFIG_RP2040_PWM4B_GPIO,
(0
# ifdef CONFIG_RP2040_PWM4A_INVERT
| RP2040_PWM_CSR_A_INV
# endif
# ifdef CONFIG_RP2040_PWM4B_INVERT
| RP2040_PWM_CSR_B_INV
# endif
# ifdef CONFIG_RP2040_PWM4_PHASE_CORRECT
| RP2040_PWM_CSR_PH_CORRECT
# endif
));
# else
ret = rp2040_pwmdev_initialize(4,
CONFIG_RP2040_PWM4A_GPIO,
(0
# ifdef CONFIG_RP2040_PWM4A_INVERT
| RP2040_PWM_CSR_A_INV
# endif
# ifdef CONFIG_RP2040_PWM4_PHASE_CORRECT
| RP2040_PWM_CSR_PH_CORRECT
# endif
));
# endif
if (ret < 0)
{
_err("ERROR: Failed to initialize PWM4.\n");
}
# endif
# ifdef CONFIG_RP2040_PWM5
# if defined(CONFIG_PWM_NCHANNELS) && CONFIG_PWM_NCHANNELS == 2
ret = rp2040_pwmdev_initialize(5,
CONFIG_RP2040_PWM5A_GPIO,
CONFIG_RP2040_PWM5B_GPIO,
(0
# ifdef CONFIG_RP2040_PWM5A_INVERT
| RP2040_PWM_CSR_A_INV
# endif
# ifdef CONFIG_RP2040_PWM5B_INVERT
| RP2040_PWM_CSR_B_INV
# endif
# ifdef CONFIG_RP2040_PWM5_PHASE_CORRECT
| RP2040_PWM_CSR_PH_CORRECT
# endif
));
# else
ret = rp2040_pwmdev_initialize(5,
CONFIG_RP2040_PWM5A_GPIO,
(0
# ifdef CONFIG_RP2040_PWM5A_INVERT
| RP2040_PWM_CSR_A_INV
# endif
# ifdef CONFIG_RP2040_PWM5_PHASE_CORRECT
| RP2040_PWM_CSR_PH_CORRECT
# endif
));
# endif
if (ret < 0)
{
_err("ERROR: Failed to initialize PWM5.\n");
}
# endif
# ifdef CONFIG_RP2040_PWM6
# if defined(CONFIG_PWM_NCHANNELS) && CONFIG_PWM_NCHANNELS == 2
ret = rp2040_pwmdev_initialize(6,
CONFIG_RP2040_PWM6A_GPIO,
CONFIG_RP2040_PWM6B_GPIO,
(0
# ifdef CONFIG_RP2040_PWM6A_INVERT
| RP2040_PWM_CSR_A_INV
# endif
# ifdef CONFIG_RP2040_PWM6B_INVERT
| RP2040_PWM_CSR_B_INV
# endif
# ifdef CONFIG_RP2040_PWM6_PHASE_CORRECT
| RP2040_PWM_CSR_PH_CORRECT
# endif
));
# else
ret = rp2040_pwmdev_initialize(6,
CONFIG_RP2040_PWM6A_GPIO,
(0
# ifdef CONFIG_RP2040_PWM6A_INVERT
| RP2040_PWM_CSR_A_INV
# endif
# ifdef CONFIG_RP2040_PWM6_PHASE_CORRECT
| RP2040_PWM_CSR_PH_CORRECT
# endif
));
# endif
if (ret < 0)
{
_err("ERROR: Failed to initialize PWM6.\n");
}
# endif
#endif
#ifdef CONFIG_RP2040_SPISD
/* Mount the SPI-based MMC/SD block driver */
ret = board_spisd_initialize(0, CONFIG_RP2040_SPISD_SPI_CH);
if (ret < 0)
{
_err("ERROR: Failed to initialize SPI device to MMC/SD: %d\n",
ret);
}
#endif
#ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system */
ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
if (ret < 0)
{
serr("ERROR: Failed to mount procfs at %s: %d\n", "/proc", ret);
}
#endif
#ifdef CONFIG_SENSORS_BMP180
/* Try to register BMP180 device in I2C0 */
ret = board_bmp180_initialize(0);
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize BMP180 driver: %d\n", ret);
}
#endif
#ifdef CONFIG_SENSORS_INA219
/* Configure and initialize the INA219 sensor in I2C0 */
ret = board_ina219_initialize(0);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: rp2040_ina219_initialize() failed: %d\n", ret);
}
#endif
#ifdef CONFIG_VIDEO_FB
ret = fb_register(0, 0);
if (ret < 0)
{
_err("ERROR: Failed to initialize Frame Buffer Driver.\n");
}
#elif defined(CONFIG_LCD)
ret = board_lcd_initialize();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to initialize LCD.\n");
}
#endif
#ifdef CONFIG_LCD_DEV
ret = lcddev_register(0);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: lcddev_register() failed: %d\n", ret);
}
#endif
#ifdef CONFIG_LCD_BACKPACK
/* slcd:0, i2c:0, rows=2, cols=16 */
ret = board_lcd_backpack_init(0, 0, 2, 16);
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize PCF8574 LCD, error %d\n", ret);
return ret;
}
#endif
#ifdef CONFIG_RP2040_I2S
ret = board_i2sdev_initialize(0);
if (ret < 0)
{
_err("ERROR: Failed to initialize I2S.\n");
}
#endif
#ifdef CONFIG_DEV_GPIO
ret = rp2040_dev_gpio_init();
if (ret < 0)
{
syslog(LOG_ERR, "Failed to initialize GPIO Driver: %d\n", ret);
return ret;
}
#endif
/* Initialize board neo-pixel */
#if defined(CONFIG_RP2040_BOARD_HAS_WS2812) && defined(CONFIG_WS2812)
rp2040_ws2812_setup("/dev/leds0",
CONFIG_RP2040_WS2812_GPIO_PIN,
CONFIG_RP2040_WS2812_PWR_GPIO,
CONFIG_WS2812_LED_COUNT,
HAS_WHITE);
#endif
#if defined(CONFIG_ADC) && defined(CONFIG_RP2040_ADC)
# ifdef CONFIG_RPC2040_ADC_CHANNEL0
# define ADC_0 true
# else
# define ADC_0 false
# endif
# ifdef CONFIG_RPC2040_ADC_CHANNEL1
# define ADC_1 true
# else
# define ADC_1 false
# endif
# ifdef CONFIG_RPC2040_ADC_CHANNEL2
# define ADC_2 true
# else
# define ADC_2 false
# endif
# ifdef CONFIG_RPC2040_ADC_CHANNEL3
# define ADC_3 true
# else
# define ADC_3 false
# endif
# ifdef CONFIG_RPC2040_ADC_TEMPERATURE
# define ADC_TEMP true
# else
# define ADC_TEMP false
# endif
ret = rp2040_adc_setup("/dev/adc0", ADC_0, ADC_1, ADC_2, ADC_3, ADC_TEMP);
if (ret != OK)
{
syslog(LOG_ERR, "Failed to initialize ADC Driver: %d\n", ret);
return ret;
}
#endif /* defined(CONFIG_ADC) && defined(CONFIG_RP2040_ADC) */
return ret;
}

View File

@ -0,0 +1,392 @@
/****************************************************************************
* boards/arm/rp2040/adafruit-qt-py-rp2040/src/rp2040_gpio.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <syslog.h>
#include <nuttx/irq.h>
#include <arch/irq.h>
#include <assert.h>
#include <debug.h>
#include <nuttx/ioexpander/gpio.h>
#include <arch/board/board.h>
#include "arm_internal.h"
#include "chip.h"
#include "rp2040_gpio.h"
#if defined(CONFIG_DEV_GPIO) && !defined(CONFIG_GPIO_LOWER_HALF)
/* Output pins. GPIO25 is onboard LED any other outputs could be used.
*/
#define GPIO_OUT1 25
/* Input pins.
*/
#define GPIO_IN1 6
/* Interrupt pins.
*/
#define GPIO_IRQPIN1 11
/****************************************************************************
* Private Types
****************************************************************************/
struct rp2040gpio_dev_s
{
struct gpio_dev_s gpio;
uint8_t id;
};
struct rp2040gpint_dev_s
{
struct rp2040gpio_dev_s rp2040gpio;
pin_interrupt_t callback;
};
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
#if BOARD_NGPIOOUT > 0
static int gpout_read(struct gpio_dev_s *dev, bool *value);
static int gpout_write(struct gpio_dev_s *dev, bool value);
#endif
#if BOARD_NGPIOIN > 0
static int gpin_read(struct gpio_dev_s *dev, bool *value);
#endif
#if BOARD_NGPIOINT > 0
static int gpint_read(struct gpio_dev_s *dev, bool *value);
static int gpint_attach(struct gpio_dev_s *dev,
pin_interrupt_t callback);
static int gpint_enable(struct gpio_dev_s *dev, bool enable);
#endif
/****************************************************************************
* Private Data
****************************************************************************/
#if BOARD_NGPIOOUT > 0
static const struct gpio_operations_s gpout_ops =
{
.go_read = gpout_read,
.go_write = gpout_write,
.go_attach = NULL,
.go_enable = NULL,
};
/* This array maps the GPIO pins used as OUTPUT */
static const uint32_t g_gpiooutputs[BOARD_NGPIOOUT] =
{
GPIO_OUT1
};
static struct rp2040gpio_dev_s g_gpout[BOARD_NGPIOOUT];
#endif
#if BOARD_NGPIOIN > 0
static const struct gpio_operations_s gpin_ops =
{
.go_read = gpin_read,
.go_write = NULL,
.go_attach = NULL,
.go_enable = NULL,
};
/* This array maps the GPIO pins used as INTERRUPT INPUTS */
static const uint32_t g_gpioinputs[BOARD_NGPIOIN] =
{
GPIO_IN1
};
static struct rp2040gpio_dev_s g_gpin[BOARD_NGPIOIN];
#endif
#if BOARD_NGPIOINT > 0
static const struct gpio_operations_s gpint_ops =
{
.go_read = gpint_read,
.go_write = NULL,
.go_attach = gpint_attach,
.go_enable = gpint_enable,
};
/* This array maps the GPIO pins used as INTERRUPT INPUTS */
static const uint32_t g_gpiointinputs[BOARD_NGPIOINT] =
{
GPIO_IRQPIN1,
};
static struct rp2040gpint_dev_s g_gpint[BOARD_NGPIOINT];
#endif
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: gpout_read
****************************************************************************/
#if BOARD_NGPIOOUT > 0
static int gpout_read(struct gpio_dev_s *dev, bool *value)
{
struct rp2040gpio_dev_s *rp2040gpio =
(struct rp2040gpio_dev_s *)dev;
DEBUGASSERT(rp2040gpio != NULL && value != NULL);
DEBUGASSERT(rp2040gpio->id < BOARD_NGPIOOUT);
gpioinfo("Reading...\n");
*value = rp2040_gpio_get(g_gpiooutputs[rp2040gpio->id]);
return OK;
}
/****************************************************************************
* Name: gpout_write
****************************************************************************/
static int gpout_write(struct gpio_dev_s *dev, bool value)
{
struct rp2040gpio_dev_s *rp2040gpio =
(struct rp2040gpio_dev_s *)dev;
DEBUGASSERT(rp2040gpio != NULL);
DEBUGASSERT(rp2040gpio->id < BOARD_NGPIOOUT);
gpioinfo("Writing %d\n", (int)value);
rp2040_gpio_put(g_gpiooutputs[rp2040gpio->id], value);
return OK;
}
#endif
/****************************************************************************
* Name: gpin_read
****************************************************************************/
#if BOARD_NGPIOIN > 0
static int gpin_read(struct gpio_dev_s *dev, bool *value)
{
struct rp2040gpio_dev_s *rp2040gpio =
(struct rp2040gpio_dev_s *)dev;
DEBUGASSERT(rp2040gpio != NULL && value != NULL);
DEBUGASSERT(rp2040gpio->id < BOARD_NGPIOIN);
gpioinfo("Reading... pin %d\n", (int)g_gpioinputs[rp2040gpio->id]);
*value = rp2040_gpio_get(g_gpioinputs[rp2040gpio->id]);
return OK;
}
#endif
/****************************************************************************
* Name: rp2040gpio_interrupt
****************************************************************************/
#if BOARD_NGPIOINT > 0
static int rp2040gpio_interrupt(int irq, void *context, void *arg)
{
struct rp2040gpint_dev_s *rp2040gpint =
(struct rp2040gpint_dev_s *)arg;
DEBUGASSERT(rp2040gpint != NULL && rp2040gpint->callback != NULL);
gpioinfo("Interrupt! callback=%p\n", rp2040gpint->callback);
rp2040gpint->callback(&rp2040gpint->rp2040gpio.gpio,
rp2040gpint->rp2040gpio.id);
return OK;
}
/****************************************************************************
* Name: gpint_read
****************************************************************************/
static int gpint_read(struct gpio_dev_s *dev, bool *value)
{
struct rp2040gpint_dev_s *rp2040gpint =
(struct rp2040gpint_dev_s *)dev;
DEBUGASSERT(rp2040gpint != NULL && value != NULL);
DEBUGASSERT(rp2040gpint->rp2040gpio.id < BOARD_NGPIOINT);
gpioinfo("Reading int pin...\n");
*value = rp2040_gpio_get(g_gpiointinputs[rp2040gpint->rp2040gpio.id]);
return OK;
}
/****************************************************************************
* Name: gpint_attach
****************************************************************************/
static int gpint_attach(struct gpio_dev_s *dev,
pin_interrupt_t callback)
{
struct rp2040gpint_dev_s *rp2040gpint =
(struct rp2040gpint_dev_s *)dev;
int irq = g_gpiointinputs[rp2040gpint->rp2040gpio.id];
int ret;
gpioinfo("Attaching the callback\n");
/* Make sure the interrupt is disabled */
rp2040_gpio_disable_irq(irq);
ret = rp2040_gpio_irq_attach(irq,
RP2040_GPIO_INTR_EDGE_LOW,
rp2040gpio_interrupt,
&g_gpint[rp2040gpint->rp2040gpio.id]);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: gpint_attach() failed: %d\n", ret);
return ret;
}
gpioinfo("Attach %p\n", callback);
rp2040gpint->callback = callback;
return OK;
}
/****************************************************************************
* Name: gpint_enable
****************************************************************************/
static int gpint_enable(struct gpio_dev_s *dev, bool enable)
{
struct rp2040gpint_dev_s *rp2040gpint =
(struct rp2040gpint_dev_s *)dev;
int irq = g_gpiointinputs[rp2040gpint->rp2040gpio.id];
if (enable)
{
if (rp2040gpint->callback != NULL)
{
gpioinfo("Enabling the interrupt\n");
/* Configure the interrupt for rising edge */
rp2040_gpio_enable_irq(irq);
}
}
else
{
gpioinfo("Disable the interrupt\n");
rp2040_gpio_disable_irq(irq);
}
return OK;
}
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: rp2040_dev_gpio_init
****************************************************************************/
int rp2040_dev_gpio_init(void)
{
int i;
int pincount = 0;
#if BOARD_NGPIOOUT > 0
for (i = 0; i < BOARD_NGPIOOUT; i++)
{
/* Setup and register the GPIO pin */
g_gpout[i].gpio.gp_pintype = GPIO_OUTPUT_PIN;
g_gpout[i].gpio.gp_ops = &gpout_ops;
g_gpout[i].id = i;
gpio_pin_register(&g_gpout[i].gpio, g_gpiooutputs[i]);
/* Configure the pins that will be used as output */
rp2040_gpio_init(g_gpiooutputs[i]);
rp2040_gpio_setdir(g_gpiooutputs[i], true);
rp2040_gpio_put(g_gpiooutputs[i], false);
pincount++;
}
#endif
pincount = 0;
#if BOARD_NGPIOIN > 0
for (i = 0; i < BOARD_NGPIOIN; i++)
{
/* Setup and register the GPIO pin */
g_gpin[i].gpio.gp_pintype = GPIO_INPUT_PIN;
g_gpin[i].gpio.gp_ops = &gpin_ops;
g_gpin[i].id = i;
gpio_pin_register(&g_gpin[i].gpio, g_gpioinputs[i]);
/* Configure the pins that will be used as INPUT */
rp2040_gpio_init(g_gpioinputs[i]);
pincount++;
}
#endif
pincount = 0;
#if BOARD_NGPIOINT > 0
for (i = 0; i < BOARD_NGPIOINT; i++)
{
/* Setup and register the GPIO pin */
g_gpint[i].rp2040gpio.gpio.gp_pintype = GPIO_INTERRUPT_PIN;
g_gpint[i].rp2040gpio.gpio.gp_ops = &gpint_ops;
g_gpint[i].rp2040gpio.id = i;
gpio_pin_register(&g_gpint[i].rp2040gpio.gpio, g_gpiointinputs[i]);
/* Configure the pins that will be used as interrupt input */
rp2040_gpio_init(g_gpiointinputs[i]);
/* pull-up = false : pull-down = true */
rp2040_gpio_set_pulls(g_gpiointinputs[i], false, true);
pincount++;
}
#endif
return OK;
}
#endif /* CONFIG_DEV_GPIO && !CONFIG_GPIO_LOWER_HALF */

View File

@ -0,0 +1,36 @@
/****************************************************************************
* boards/arm/rp2040/adafruit-qt-py-rp2040/src/rp2040_pico.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __BOARDS_ARM_RP2040_ADAFRUIT_KB2040_SRC_RP2040_PICO_H
#define __BOARDS_ARM_RP2040_ADAFRUIT_KB2040_SRC_RP2040_PICO_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
int rp2040_bringup(void);
#ifdef CONFIG_DEV_GPIO
int rp2040_dev_gpio_init(void);
#endif
#endif /* __BOARDS_ARM_RP2040_ADAFRUIT_KB2040_SRC_RP2040_PICO_H */

View File

@ -0,0 +1,61 @@
/****************************************************************************
* boards/arm/rp2040/adafruit-qt-py-rp2040/src/rp2040_reset.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/board.h>
#include <nuttx/arch.h>
#ifdef CONFIG_BOARDCTL_RESET
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_reset
*
* Description:
* Reset board. Support for this function is required by board-level
* logic if CONFIG_BOARDCTL_RESET is selected.
*
* Input Parameters:
* status - Status information provided with the reset event. This
* meaning of this status information is board-specific. If not
* used by a board, the value zero may be provided in calls to
* board_reset().
*
* Returned Value:
* If this function returns, then it was not possible to power-off the
* board due to some constraints. The return value int this case is a
* board-specific reason for the failure to shutdown.
*
****************************************************************************/
int board_reset(int status)
{
up_systemreset();
return 0;
}
#endif /* CONFIG_BOARDCTL_RESET */

View File

@ -0,0 +1,150 @@
/****************************************************************************
* boards/arm/rp2040/adafruit-qt-py-rp2040/src/rp2040_spi.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <stdbool.h>
#include <errno.h>
#include <debug.h>
#include <nuttx/spi/spi.h>
#include <arch/board/board.h>
#include "arm_internal.h"
#include "chip.h"
#include "rp2040_gpio.h"
#include "hardware/rp2040_spi.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: rp2040_spi0/1select and rp2040_spi0/1status
*
* Description:
* The external functions, rp2040_spi0/1select and rp2040_spi0/1status
* must be provided by board-specific logic.
* They are implementations of the select and status methods of the SPI
* interface defined by struct spi_ops_s (see include/nuttx/spi/spi.h).
* All other methods (including rp2040_spibus_initialize()) are provided by
* common RP2040 logic. To use this common SPI logic on your board:
*
* 1. Provide logic in rp2040_boardinitialize() to configure SPI chip
* select pins.
* 2. Provide rp2040_spi0/1select() and rp2040_spi0/1status()
* functions in your board-specific logic.
* These functions will perform chip selection and status operations
* using GPIOs in the way your board is configured.
* 3. Add a calls to rp2040_spibus_initialize() in your low level
* application initialization logic
* 4. The handle returned by rp2040_spibus_initialize() may then be used to
* bind the SPI driver to higher level logic (e.g., calling
* mmcsd_spislotinitialize(), for example, will bind the SPI driver to
* the SPI MMC/SD driver).
*
****************************************************************************/
#ifdef CONFIG_RP2040_SPI0
void rp2040_spi0select(struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid,
selected ? "assert" : "de-assert");
rp2040_gpio_put(CONFIG_RP2040_SPI0_CS_GPIO, !selected);
}
uint8_t rp2040_spi0status(struct spi_dev_s *dev, uint32_t devid)
{
uint8_t ret = 0;
# if defined(CONFIG_RP2040_SPISD) && (CONFIG_RP2040_SPISD_SPI_CH == 0)
ret = board_spisd_status(dev, devid);
# endif
return ret;
}
#ifdef CONFIG_SPI_CMDDATA
int rp2040_spi0cmddata(struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
#ifdef CONFIG_LCD_ST7789
if (devid == SPIDEV_DISPLAY(0))
{
/* This is the Data/Command control pad which determines whether the
* data bits are data or a command.
*/
rp2040_gpio_put(CONFIG_RP2040_SPI0_RX_GPIO, !cmd);
return OK;
}
#endif
return -ENODEV;
}
#endif
#endif
#ifdef CONFIG_RP2040_SPI1
void rp2040_spi1select(struct spi_dev_s *dev, uint32_t devid,
bool selected)
{
spiinfo("devid: %d CS: %s\n", (int)devid,
selected ? "assert" : "de-assert");
rp2040_gpio_put(CONFIG_RP2040_SPI1_CS_GPIO, !selected);
}
uint8_t rp2040_spi1status(struct spi_dev_s *dev, uint32_t devid)
{
uint8_t ret = 0;
# if defined(CONFIG_RP2040_SPISD) && (CONFIG_RP2040_SPISD_SPI_CH == 1)
ret = board_spisd_status(dev, devid);
# endif
return ret;
}
#ifdef CONFIG_SPI_CMDDATA
int rp2040_spi1cmddata(struct spi_dev_s *dev, uint32_t devid, bool cmd)
{
#if defined (CONFIG_LCD_ST7789) || (CONFIG_LCD_ST7735)
if (devid == SPIDEV_DISPLAY(0))
{
/* This is the Data/Command control pad which determines whether the
* data bits are data or a command.
*/
rp2040_gpio_put(CONFIG_RP2040_SPI1_RX_GPIO, !cmd);
return OK;
}
#endif
return -ENODEV;
}
#endif
#endif

View File

@ -3,52 +3,501 @@
# see the file kconfig-language.txt in the NuttX tools repository.
#
if ARCH_BOARD_RASPBERRYPI_PICO
#####################################################################
# UART Configuration
#####################################################################
config RP2040_ADC
bool "Enable ADC Support"
default n
---help---
If y, the RP2040 ADC code will be built. For ADC device driver
support you must also select "Analog-to-Digital Conversion"
under the "Device Driver/Analog Device Support" menu.
if RP2040_UART0
If the ADC device driver is not built, basic functions
to programatically access the ADC ports will be added.
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.
if RP2040_ADC && ADC
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.
config RPC2040_ADC_CHANNEL0
bool "Read ADC channel 0"
default n
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_I2C0_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_I2C0_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---
If y, then ADC0 will be read.
This is the GPIO pin used to send data to the
configured ws2812 pixels.
config RPC2040_ADC_CHANNEL1
bool "Read ADC channel 1"
default n
config RP2040_WS2812_PWR_GPIO
int "GPIO pin for ws2812 power (0-29, or -1 if not used)"
default -1
range -1 29
---help---
If y, then ADC1 will be read.
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.
config RPC2040_ADC_CHANNEL2
bool "Read ADC channel 2"
default n
---help---
If y, then ADC2 will be read.
config RPC2040_ADC_CHANNEL3
bool "Read ADC channel 3"
default n
---help---
If y, then ADC3 will be read.
config RPC2040_ADC_TEMPERATURE
bool "Read ADC chip temperature channel"
default n
---help---
If y, then the ADC chip temperature
will be read.
endif
endif
endif # RP2040_BOARD_HAS_WS2812

View File

@ -73,14 +73,14 @@ int board_spisd_initialize(int minor, int bus)
#ifdef CONFIG_RP2040_SPI0
if (bus == 0)
{
rp2040_gpio_set_pulls(CONFIG_RP2040_SPI0_GPIO, true, false);
rp2040_gpio_set_pulls(CONFIG_RP2040_SPI0_RX_GPIO, true, false);
}
#endif
#ifdef CONFIG_RP2040_SPI1
if (bus == 1)
{
rp2040_gpio_set_pulls(CONFIG_RP2040_SPI1_GPIO, true, false);
rp2040_gpio_set_pulls(CONFIG_RP2040_SPI1_RX_GPIO, true, false);
}
#endif

View File

@ -45,11 +45,11 @@
#define LCD_SPI_PORTNO 1
#if LCD_SPI_PORTNO
#define LCD_DC CONFIG_RP2040_SPI1_GPIO
#define LCD_DC CONFIG_RP2040_SPI1_RX_GPIO
#define LCD_RST 10
#define LCD_BL 11
#else
#define LCD_DC CONFIG_RP2040_SPI0_GPIO
#define LCD_DC CONFIG_RP2040_SPI0_RX_GPIO
#endif
/****************************************************************************

View File

@ -45,11 +45,11 @@
#define LCD_SPI_PORTNO CONFIG_RP2040_LCD_SPI_CH
#if LCD_SPI_PORTNO
#define LCD_DC CONFIG_RP2040_SPI1_GPIO
#define LCD_DC CONFIG_RP2040_SPI1_RX_GPIO
#define LCD_RST 12
#define LCD_BL 13
#else
#define LCD_DC CONFIG_RP2040_SPI0_GPIO
#define LCD_DC CONFIG_RP2040_SPI0_RX_GPIO
#endif
/****************************************************************************

View File

@ -13,11 +13,12 @@ config RP2040_FLASH_BOOT
If not, the binary is for SRAM boot.
config RP2040_FLASH_CHIP
string "flash chip name"
string "Second stage boot loader"
default "w25q080"
---help---
Name of NOR flash device connected to RP2040 SoC.
(Used to choose the secondary boot loader.)
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
@ -26,306 +27,4 @@ config RP2040_UF2_BINARY
---help---
Create nuttx.uf2 binary format used on RP2040 based arch.
config RP2040_UART0_GPIO
int "UART0 GPIO pin assign (0,12,16,28 or -1:no assign)"
default 0
range -1 29
depends on RP2040_UART0
config RP2040_UART1_GPIO
int "UART1 GPIO pin assign (4,8,20,24 or -1:no assign)"
default -1
range -1 29
depends on RP2040_UART1
config RP2040_I2C0_GPIO
int "I2C0 GPIO pin assign (0,4,8,12,16,20,24,28 or -1:no assign)"
default -1
range -1 29
depends on RP2040_I2C0
config RP2040_I2C1_GPIO
int "I2C1 GPIO pin assign (2,6,10,14,18,22,26 or -1:no assign)"
default -1
range -1 29
depends on RP2040_I2C1
if RP2040_PWM0
config RP2040_PWM0A_GPIO
int "PWM0 channel 1 GPIO pin assign (0 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, any other value disables the output.
config RP2040_PWM0A_INVERT
bool "PWM0 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM0B_GPIO
int "PWM0 channel 2 GPIO pin assign (1 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, any other value disables the output.
config RP2040_PWM0B_INVERT
bool "PWM0 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif
config RP2040_PWM0_PHASE_CORRECT
bool "PWM0 phase correct"
default n
endif
if RP2040_PWM1
config RP2040_PWM1A_GPIO
int "PWM1 channel 1 GPIO pin assign (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.
config RP2040_PWM1A_INVERT
bool "PWM1 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM1B_GPIO
int "PWM1 channel 2 GPIO pin assign (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.
config RP2040_PWM1B_INVERT
bool "PWM1 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif
config RP2040_PWM1_PHASE_CORRECT
bool "PWM1 phase correct"
default n
endif
if RP2040_PWM2
config RP2040_PWM2A_GPIO
int "PWM2 channel 1 GPIO pin assign (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.
config RP2040_PWM2A_INVERT
bool "PWM2 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM2B_GPIO
int "PWM2 channel 2 GPIO pin assign (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.
config RP2040_PWM2B_INVERT
bool "PWM2 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif
config RP2040_PWM2_PHASE_CORRECT
bool "PWM2 phase correct"
default n
endif
if RP2040_PWM3
config RP2040_PWM3A_GPIO
int "PWM3 channel 1 GPIO pin assign (6 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, any other value disables the output.
config RP2040_PWM3A_INVERT
bool "PWM3 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM3B_GPIO
int "PWM3 channel 2 GPIO pin assign (7 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, any other value disables the output.
config RP2040_PWM3B_INVERT
bool "PWM3 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif
config RP2040_PWM3_PHASE_CORRECT
bool "PWM3 phase correct"
default n
endif
if RP2040_PWM5
config RP2040_PWM5A_GPIO
int "PWM5 channel 1 GPIO pin assign (26 or -1:no assign)"
default 26
range -1 29
---help---
This sets the GPIO pin to use for the A channel it must be
either 26, any other value disables the output.
config RP2040_PWM5A_INVERT
bool "PWM5 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM5B_GPIO
int "PWM5 channel 2 GPIO pin assign (27 or -1:no assign)"
default 27
range -1 29
---help---
This sets the GPIO pin to use for the B channel it must be
either 27, any other value disables the output.
config RP2040_PWM5B_INVERT
bool "PWM5 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif
config RP2040_PWM5_PHASE_CORRECT
bool "PWM5 phase correct"
default n
endif
if RP2040_PWM6
config RP2040_PWM6A_GPIO
int "PWM6 channel 1 GPIO pin assign (28 or -1:no assign)"
default 28
range -1 29
---help---
This sets the GPIO pin to use for the A channel it must be
either 28, any other value disables the output.
config RP2040_PWM6A_INVERT
bool "PWM6 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM6B_GPIO
int "PWM6 channel 2 GPIO pin assign (29 or -1:no assign)"
default 29
range -1 29
---help---
This sets the GPIO pin to use for the B channel it must be
either 29, any other value disables the output.
config RP2040_PWM6B_INVERT
bool "PWM6 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif
config RP2040_PWM6_PHASE_CORRECT
bool "PWM6 phase correct"
default n
endif
if RP2040_PWM7
config RP2040_PWM7A_GPIO
int "PWM7 channel 1 GPIO pin assign (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.
config RP2040_PWM7A_INVERT
bool "PWM7 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM7B_GPIO
int "PWM7 channel 2 GPIO pin assign (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.
config RP2040_PWM7B_INVERT
bool "PWM7 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif
config RP2040_PWM7_PHASE_CORRECT
bool "PWM7 phase correct"
default n
endif
config RP2040_SPI0_GPIO
int "SPI0 GPIO pin assign (0,4,16,20 or -1:no assign)"
default -1
range -1 29
depends on RP2040_SPI0
config RP2040_SPI1_GPIO
int "SPI1 GPIO pin assign (8,12,24,28 or -1:no assign)"
default -1
range -1 29
depends on RP2040_SPI1
endif

View File

@ -17,7 +17,6 @@
# CONFIG_STANDARD_SERIAL is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="pimoroni-tiny2040"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_PIMORONI_TINY2040=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
@ -53,7 +52,10 @@ CONFIG_RAM_SIZE=270336
CONFIG_RAM_START=0x20000000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_SPI0=y
CONFIG_RP2040_SPI0_GPIO=4
CONFIG_RP2040_SPI0_CS_GPIO=5
CONFIG_RP2040_SPI0_RX_GPIO=4
CONFIG_RP2040_SPI0_SCK_GPIO=6
CONFIG_RP2040_SPI0_TX_GPIO=3
CONFIG_RP2040_SPI=y
CONFIG_RP2040_SPISD=y
CONFIG_RR_INTERVAL=200

View File

@ -14,7 +14,6 @@
# CONFIG_STANDARD_SERIAL is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="pimoroni-tiny2040"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_PIMORONI_TINY2040=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y

View File

@ -14,7 +14,6 @@
# CONFIG_STANDARD_SERIAL is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="pimoroni-tiny2040"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_PIMORONI_TINY2040=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y

View File

@ -15,7 +15,6 @@
# CONFIG_STANDARD_SERIAL is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="pimoroni-tiny2040"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_PIMORONI_TINY2040=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y

View File

@ -14,7 +14,6 @@
# CONFIG_STANDARD_SERIAL is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="pimoroni-tiny2040"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_PIMORONI_TINY2040=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y

View File

@ -17,7 +17,6 @@
# CONFIG_STANDARD_SERIAL is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="pimoroni-tiny2040"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_PIMORONI_TINY2040=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
@ -45,7 +44,10 @@ CONFIG_RAM_SIZE=270336
CONFIG_RAM_START=0x20000000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_SPI0=y
CONFIG_RP2040_SPI0_GPIO=4
CONFIG_RP2040_SPI0_CS_GPIO=5
CONFIG_RP2040_SPI0_RX_GPIO=4
CONFIG_RP2040_SPI0_SCK_GPIO=6
CONFIG_RP2040_SPI0_TX_GPIO=3
CONFIG_RP2040_SPI=y
CONFIG_RP2040_SPISD=y
CONFIG_RR_INTERVAL=200

View File

@ -17,7 +17,6 @@
# CONFIG_STANDARD_SERIAL is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="pimoroni-tiny2040"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_PIMORONI_TINY2040=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
@ -47,7 +46,10 @@ CONFIG_RAM_SIZE=270336
CONFIG_RAM_START=0x20000000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_SPI0=y
CONFIG_RP2040_SPI0_GPIO=4
CONFIG_RP2040_SPI0_CS_GPIO=5
CONFIG_RP2040_SPI0_RX_GPIO=4
CONFIG_RP2040_SPI0_SCK_GPIO=6
CONFIG_RP2040_SPI0_TX_GPIO=3
CONFIG_RP2040_SPI=y
CONFIG_RP2040_SPISD=y
CONFIG_RR_INTERVAL=200

View File

@ -15,7 +15,6 @@
# CONFIG_RP2040_UART0 is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="pimoroni-tiny2040"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_PIMORONI_TINY2040=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y

View File

@ -79,32 +79,32 @@ void rp2040_boardearlyinitialize(void)
/* Set default UART pin */
#if defined(CONFIG_RP2040_UART0) && CONFIG_RP2040_UART0_GPIO >= 0
rp2040_gpio_set_function(CONFIG_RP2040_UART0_GPIO,
#ifdef CONFIG_RP2040_UART0
rp2040_gpio_set_function(CONFIG_RP2040_UART0_TX_GPIO,
RP2040_GPIO_FUNC_UART); /* TX */
rp2040_gpio_set_function(CONFIG_RP2040_UART0_GPIO + 1,
rp2040_gpio_set_function(CONFIG_RP2040_UART0_RX_GPIO,
RP2040_GPIO_FUNC_UART); /* RX */
#ifdef CONFIG_SERIAL_OFLOWCONTROL
rp2040_gpio_set_function(CONFIG_RP2040_UART0_GPIO + 2,
rp2040_gpio_set_function(CONFIG_RP2040_UART0_CTS_GPIO,
RP2040_GPIO_FUNC_UART); /* CTS */
#endif
#ifdef CONFIG_SERIAL_IFLOWCONTROL
rp2040_gpio_set_function(CONFIG_RP2040_UART0_GPIO + 3,
rp2040_gpio_set_function(CONFIG_RP2040_UART0_RTS_GPIO,
RP2040_GPIO_FUNC_UART); /* RTS */
#endif
#endif
#if defined(CONFIG_RP2040_UART1) && CONFIG_RP2040_UART1_GPIO >= 0
rp2040_gpio_set_function(CONFIG_RP2040_UART1_GPIO,
#ifdef CONFIG_RP2040_UART1
rp2040_gpio_set_function(CONFIG_RP2040_UART1_TX_GPIO,
RP2040_GPIO_FUNC_UART); /* TX */
rp2040_gpio_set_function(CONFIG_RP2040_UART1_GPIO + 1,
rp2040_gpio_set_function(CONFIG_RP2040_UART1_RX_GPIO,
RP2040_GPIO_FUNC_UART); /* RX */
#ifdef CONFIG_SERIAL_OFLOWCONTROL
rp2040_gpio_set_function(CONFIG_RP2040_UART1_GPIO + 2,
rp2040_gpio_set_function(CONFIG_RP2040_UART1_CTS_GPIO,
RP2040_GPIO_FUNC_UART); /* CTS */
#endif
#ifdef CONFIG_SERIAL_IFLOWCONTROL
rp2040_gpio_set_function(CONFIG_RP2040_UART1_GPIO + 3,
rp2040_gpio_set_function(CONFIG_RP2040_UART1_RTS_GPIO,
RP2040_GPIO_FUNC_UART); /* RTS */
#endif
#endif
@ -121,55 +121,55 @@ void rp2040_boardinitialize(void)
{
/* Set default I2C pin */
#if defined(CONFIG_RP2040_I2C0) && CONFIG_RP2040_I2C0_GPIO >= 0
rp2040_gpio_set_function(CONFIG_RP2040_I2C0_GPIO,
#ifdef CONFIG_RP2040_I2C0
rp2040_gpio_set_function(CONFIG_RP2040_I2C0_SDA_GPIO,
RP2040_GPIO_FUNC_I2C); /* SDA */
rp2040_gpio_set_function(CONFIG_RP2040_I2C0_GPIO + 1,
rp2040_gpio_set_function(CONFIG_RP2040_I2C0_SCL_GPIO,
RP2040_GPIO_FUNC_I2C); /* SCL */
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C0_GPIO, true, false); /* Pull up */
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C0_GPIO + 1, true, false);
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C0_SDA_GPIO, true, false); /* Pull up */
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C0_SCL_GPIO, true, false);
#endif
#if defined(CONFIG_RP2040_I2C1) && CONFIG_RP2040_I2C1_GPIO >= 0
rp2040_gpio_set_function(CONFIG_RP2040_I2C1_GPIO,
#ifdef CONFIG_RP2040_I2C1
rp2040_gpio_set_function(CONFIG_RP2040_I2C1_SDA_GPIO,
RP2040_GPIO_FUNC_I2C); /* SDA */
rp2040_gpio_set_function(CONFIG_RP2040_I2C1_GPIO + 1,
rp2040_gpio_set_function(CONFIG_RP2040_I2C1_SCL_GPIO,
RP2040_GPIO_FUNC_I2C); /* SCL */
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C1_GPIO, true, false); /* Pull up */
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C1_GPIO + 1, true, false);
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C1_SDA_GPIO, true, false); /* Pull up */
rp2040_gpio_set_pulls(CONFIG_RP2040_I2C1_SCL_GPIO, true, false);
#endif
/* Set default SPI pin */
#if defined(CONFIG_RP2040_SPI0) && CONFIG_RP2040_SPI0_GPIO >= 0
rp2040_gpio_set_function(CONFIG_RP2040_SPI0_GPIO,
#ifdef CONFIG_RP2040_SPI0
rp2040_gpio_set_function(CONFIG_RP2040_SPI0_RX_GPIO,
RP2040_GPIO_FUNC_SPI); /* RX */
rp2040_gpio_set_function(CONFIG_RP2040_SPI0_GPIO + 2,
rp2040_gpio_set_function(CONFIG_RP2040_SPI0_SCK_GPIO,
RP2040_GPIO_FUNC_SPI); /* SCK */
rp2040_gpio_set_function(CONFIG_RP2040_SPI0_GPIO + 3,
rp2040_gpio_set_function(CONFIG_RP2040_SPI0_TX_GPIO,
RP2040_GPIO_FUNC_SPI); /* TX */
/* CSn is controlled by board-specific logic */
rp2040_gpio_init(CONFIG_RP2040_SPI0_GPIO + 1); /* CSn */
rp2040_gpio_setdir(CONFIG_RP2040_SPI0_GPIO + 1, true);
rp2040_gpio_put(CONFIG_RP2040_SPI0_GPIO + 1, true);
rp2040_gpio_init(CONFIG_RP2040_SPI0_CS_GPIO); /* CSn */
rp2040_gpio_setdir(CONFIG_RP2040_SPI0_CS_GPIO, true);
rp2040_gpio_put(CONFIG_RP2040_SPI0_CS_GPIO, true);
#endif
#if defined(CONFIG_RP2040_SPI1) && CONFIG_RP2040_SPI1_GPIO >= 0
rp2040_gpio_set_function(CONFIG_RP2040_SPI1_GPIO,
#ifdef CONFIG_RP2040_SPI1
rp2040_gpio_set_function(CONFIG_RP2040_SPI1_RX_GPIO,
RP2040_GPIO_FUNC_SPI); /* RX */
rp2040_gpio_set_function(CONFIG_RP2040_SPI1_GPIO + 2,
rp2040_gpio_set_function(CONFIG_RP2040_SPI1_SCK_GPIO,
RP2040_GPIO_FUNC_SPI); /* SCK */
rp2040_gpio_set_function(CONFIG_RP2040_SPI1_GPIO + 3,
rp2040_gpio_set_function(CONFIG_RP2040_SPI1_TX_GPIO,
RP2040_GPIO_FUNC_SPI); /* TX */
/* CSn is controlled by board-specific logic */
rp2040_gpio_init(CONFIG_RP2040_SPI1_GPIO + 1); /* CSn */
rp2040_gpio_setdir(CONFIG_RP2040_SPI1_GPIO + 1, true);
rp2040_gpio_put(CONFIG_RP2040_SPI1_GPIO + 1, true);
rp2040_gpio_init(CONFIG_RP2040_SPI1_CS_GPIO); /* CSn */
rp2040_gpio_setdir(CONFIG_RP2040_SPI1_CS_GPIO, true);
rp2040_gpio_put(CONFIG_RP2040_SPI1_CS_GPIO, true);
#endif
}

View File

@ -460,6 +460,7 @@ int rp2040_bringup(void)
#if defined(CONFIG_RP2040_BOARD_HAS_WS2812) && defined(CONFIG_WS2812)
rp2040_ws2812_setup("/dev/leds0",
CONFIG_RP2040_WS2812_GPIO_PIN,
CONFIG_RP2040_WS2812_PWR_GPIO,
CONFIG_WS2812_LED_COUNT,
HAS_WHITE);
#endif

View File

@ -74,7 +74,7 @@ void rp2040_spi0select(struct spi_dev_s *dev, uint32_t devid,
spiinfo("devid: %d CS: %s\n", (int)devid,
selected ? "assert" : "de-assert");
rp2040_gpio_put(CONFIG_RP2040_SPI0_GPIO + 1, !selected);
rp2040_gpio_put(CONFIG_RP2040_SPI0_CS_GPIO, !selected);
}
uint8_t rp2040_spi0status(struct spi_dev_s *dev, uint32_t devid)
@ -102,7 +102,7 @@ void rp2040_spi1select(struct spi_dev_s *dev, uint32_t devid,
spiinfo("devid: %d CS: %s\n", (int)devid,
selected ? "assert" : "de-assert");
rp2040_gpio_put(CONFIG_RP2040_SPI1_GPIO + 1, !selected);
rp2040_gpio_put(CONFIG_RP2040_SPI1_CS_GPIO, !selected);
}
uint8_t rp2040_spi1status(struct spi_dev_s *dev, uint32_t devid)

View File

@ -13,11 +13,12 @@ config RP2040_FLASH_BOOT
If not, the binary is for SRAM boot.
config RP2040_FLASH_CHIP
string "flash chip name"
string "Second stage boot loader"
default "w25q080"
---help---
Name of NOR flash device connected to RP2040 SoC.
(Used to choose the secondary boot loader.)
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
@ -26,346 +27,6 @@ config RP2040_UF2_BINARY
---help---
Create nuttx.uf2 binary format used on RP2040 based arch.
config RP2040_UART0_GPIO
int "UART0 GPIO pin assign (0,12,16,28 or -1:no assign)"
default 0
range -1 29
depends on RP2040_UART0
config RP2040_UART1_GPIO
int "UART1 GPIO pin assign (4,8,20,24 or -1:no assign)"
default -1
range -1 29
depends on RP2040_UART1
config RP2040_I2C0_GPIO
int "I2C0 GPIO pin assign (0,4,8,12,16,20,24,28 or -1:no assign)"
default -1
range -1 29
depends on RP2040_I2C0
config RP2040_I2C1_GPIO
int "I2C1 GPIO pin assign (2,6,10,14,18,22,26 or -1:no assign)"
default -1
range -1 29
depends on RP2040_I2C1
if RP2040_PWM0
config RP2040_PWM0A_GPIO
int "PWM0 channel 1 GPIO pin assign (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.
config RP2040_PWM0A_INVERT
bool "PWM0 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM0B_GPIO
int "PWM0 channel 2 GPIO pin assign (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.
config RP2040_PWM0B_INVERT
bool "PWM0 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif
config RP2040_PWM0_PHASE_CORRECT
bool "PWM0 phase correct"
default n
endif
if RP2040_PWM1
config RP2040_PWM1A_GPIO
int "PWM1 channel 1 GPIO pin assign (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.
config RP2040_PWM1A_INVERT
bool "PWM1 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM1B_GPIO
int "PWM1 channel 2 GPIO pin assign (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.
config RP2040_PWM1B_INVERT
bool "PWM1 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif
config RP2040_PWM1_PHASE_CORRECT
bool "PWM1 phase correct"
default n
endif
if RP2040_PWM2
config RP2040_PWM2A_GPIO
int "PWM2 channel 1 GPIO pin assign (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.
config RP2040_PWM2A_INVERT
bool "PWM2 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM2B_GPIO
int "PWM2 channel 2 GPIO pin assign (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.
config RP2040_PWM2B_INVERT
bool "PWM2 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif
config RP2040_PWM2_PHASE_CORRECT
bool "PWM2 phase correct"
default n
endif
if RP2040_PWM3
config RP2040_PWM3A_GPIO
int "PWM3 channel 1 GPIO pin assign (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.
config RP2040_PWM3A_INVERT
bool "PWM3 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM3B_GPIO
int "PWM3 channel 2 GPIO pin assign (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.
config RP2040_PWM3B_INVERT
bool "PWM3 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif
config RP2040_PWM3_PHASE_CORRECT
bool "PWM3 phase correct"
default n
endif
if RP2040_PWM4
config RP2040_PWM4A_GPIO
int "PWM4 channel 1 GPIO pin assign (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.
config RP2040_PWM4A_INVERT
bool "PWM4 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM4B_GPIO
int "PWM4 channel 2 GPIO pin assign (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.
config RP2040_PWM4B_INVERT
bool "PWM4 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif
config RP2040_PWM4_PHASE_CORRECT
bool "PWM4 phase correct"
default n
endif
if RP2040_PWM5
config RP2040_PWM5A_GPIO
int "PWM5 channel 1 GPIO pin assign (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.
config RP2040_PWM5A_INVERT
bool "PWM5 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM5B_GPIO
int "PWM5 channel 2 GPIO pin assign (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.
config RP2040_PWM5B_INVERT
bool "PWM5 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif
config RP2040_PWM5_PHASE_CORRECT
bool "PWM5 phase correct"
default n
endif
if RP2040_PWM6
config RP2040_PWM6A_GPIO
int "PWM6 channel 1 GPIO pin assign (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.
config RP2040_PWM6A_INVERT
bool "PWM6 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM6B_GPIO
int "PWM6 channel 2 GPIO pin assign (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.
config RP2040_PWM6B_INVERT
bool "PWM6 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif
config RP2040_PWM6_PHASE_CORRECT
bool "PWM6 phase correct"
default n
endif
if RP2040_PWM7
config RP2040_PWM7A_GPIO
int "PWM7 channel 1 GPIO pin assign (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.
config RP2040_PWM7A_INVERT
bool "PWM7 channel 1 invert"
default n
---help---
If invert is enabled, the PWM on the A pin will idle high
with the pulse going low.
if PWM_MULTICHAN && PWM_NCHANNELS > 1
config RP2040_PWM7B_GPIO
int "PWM7 channel 2 GPIO pin assign (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.
config RP2040_PWM7B_INVERT
bool "PWM7 channel 2 invert"
default n
---help---
If invert is enabled, the PWM on the B pin will idle high
with the pulse going low.
endif
config RP2040_PWM7_PHASE_CORRECT
bool "PWM7 phase correct"
default n
endif
config RP2040_SPI0_GPIO
int "SPI0 GPIO pin assign (0,4,16,20 or -1:no assign)"
default -1
range -1 29
depends on RP2040_SPI0
config RP2040_SPI1_GPIO
int "SPI1 GPIO pin assign (8,12,24,28 or -1:no assign)"
default -1
range -1 29
depends on RP2040_SPI1
config RP2040_LCD_SPI_CH
int "RP2040 LCD SPI channel number"
default 0

View File

@ -21,7 +21,6 @@
# CONFIG_STANDARD_SERIAL is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="raspberrypi-pico"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_RASPBERRYPI_PICO=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
@ -54,7 +53,6 @@ CONFIG_RAM_START=0x20000000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_I2S=y
CONFIG_RP2040_SPI0=y
CONFIG_RP2040_SPI0_GPIO=16
CONFIG_RP2040_SPI=y
CONFIG_RP2040_SPISD=y
CONFIG_RR_INTERVAL=200

View File

@ -17,7 +17,6 @@
# CONFIG_STANDARD_SERIAL is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="raspberrypi-pico"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_RASPBERRYPI_PICO=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
@ -53,7 +52,6 @@ CONFIG_RAM_SIZE=270336
CONFIG_RAM_START=0x20000000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_SPI0=y
CONFIG_RP2040_SPI0_GPIO=16
CONFIG_RP2040_SPI=y
CONFIG_RP2040_SPISD=y
CONFIG_RR_INTERVAL=200

View File

@ -20,7 +20,6 @@
# CONFIG_STANDARD_SERIAL is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="raspberrypi-pico"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_RASPBERRYPI_PICO=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
@ -81,7 +80,6 @@ CONFIG_RAM_SIZE=270336
CONFIG_RAM_START=0x20000000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_SPI0=y
CONFIG_RP2040_SPI0_GPIO=16
CONFIG_RP2040_SPI=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_WAITPID=y

View File

@ -14,7 +14,6 @@
# CONFIG_STANDARD_SERIAL is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="raspberrypi-pico"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_RASPBERRYPI_PICO=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
@ -59,9 +58,11 @@ CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_ENC28J60_INTR_GPIO=11
CONFIG_RP2040_ENC28J60_RESET_GPIO=10
CONFIG_RP2040_SPI0=y
CONFIG_RP2040_SPI0_GPIO=16
CONFIG_RP2040_SPI1=y
CONFIG_RP2040_SPI1_GPIO=12
CONFIG_RP2040_SPI1_CS_GPIO=13
CONFIG_RP2040_SPI1_RX_GPIO=12
CONFIG_RP2040_SPI1_SCK_GPIO=14
CONFIG_RP2040_SPI1_TX_GPIO=15
CONFIG_RP2040_SPI=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_HPWORK=y

View File

@ -14,7 +14,6 @@
# CONFIG_STANDARD_SERIAL is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="raspberrypi-pico"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_RASPBERRYPI_PICO=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y
@ -41,7 +40,6 @@ CONFIG_RAM_SIZE=270336
CONFIG_RAM_START=0x20000000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RP2040_I2C0=y
CONFIG_RP2040_I2C0_GPIO=4
CONFIG_RP2040_I2C=y
CONFIG_RP2040_I2C_DRIVER=y
CONFIG_RR_INTERVAL=200

View File

@ -14,7 +14,6 @@
# CONFIG_STANDARD_SERIAL is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="raspberrypi-pico"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_RASPBERRYPI_PICO=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y

View File

@ -15,7 +15,6 @@
# CONFIG_STANDARD_SERIAL is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="raspberrypi-pico"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_RASPBERRYPI_PICO=y
CONFIG_ARCH_CHIP="rp2040"
CONFIG_ARCH_CHIP_RP2040=y

Some files were not shown because too many files have changed in this diff Show More