From 0c3db448bb64c8877a4dfa62416027b24a639a8e Mon Sep 17 00:00:00 2001 From: curuvar <58759586+curuvar@users.noreply.github.com> Date: Wed, 29 Jun 2022 22:28:04 -0400 Subject: [PATCH] Added Adafruit Feather RP2040, Adafruit KB2040 and Added neopixel driver to support RP2040 --- .../components/drivers/character/ws2812.rst | 32 + Kconfig | 2 +- arch/arm/src/rp2040/Kconfig | 15 +- arch/arm/src/rp2040/Make.defs | 4 + arch/arm/src/rp2040/rp2040_dmac.c | 2 +- arch/arm/src/rp2040/rp2040_dmac.h | 2 +- arch/arm/src/rp2040/rp2040_ws2812.c | 635 ++++++++++++++++++ arch/arm/src/rp2040/rp2040_ws2812.h | 95 +++ arch/arm/src/rp2040/rp2040_ws2812.pio | 46 ++ boards/Kconfig | 22 + .../rp2040/adafruit-feather-rp2040/Kconfig | 342 ++++++++++ .../rp2040/adafruit-feather-rp2040/README.txt | 180 +++++ .../configs/audiopack/defconfig | 76 +++ .../configs/composite/defconfig | 79 +++ .../configs/displaypack/defconfig | 103 +++ .../configs/enc28j60/defconfig | 88 +++ .../configs/lcd1602/defconfig | 61 ++ .../configs/nsh/defconfig | 53 ++ .../configs/nshsram/defconfig | 53 ++ .../configs/smp/defconfig | 59 ++ .../configs/spisd/defconfig | 65 ++ .../configs/ssd1306/defconfig | 80 +++ .../configs/st7735/defconfig | 64 ++ .../configs/usbmsc/defconfig | 72 ++ .../configs/usbnsh/defconfig | 57 ++ .../configs/waveshare-lcd-1.14/defconfig | 100 +++ .../configs/waveshare-lcd-1.3/defconfig | 97 +++ .../adafruit-feather-rp2040/include/board.h | 116 ++++ .../include/rp2040_i2cdev.h | 72 ++ .../include/rp2040_i2sdev.h | 72 ++ .../include/rp2040_spidev.h | 69 ++ .../include/rp2040_spisd.h | 83 +++ .../adafruit-feather-rp2040/scripts/Make.defs | 45 ++ .../scripts/adafruit-feather-rp2040-flash.ld | 112 +++ .../scripts/adafruit-feather-rp2040-sram.ld | 97 +++ .../adafruit-feather-rp2040/src/Make.defs | 41 ++ .../src/rp2040_appinit.c | 76 +++ .../src/rp2040_boardinitialize.c | 166 +++++ .../src/rp2040_bringup.c | 466 +++++++++++++ .../adafruit-feather-rp2040/src/rp2040_gpio.c | 392 +++++++++++ .../adafruit-feather-rp2040/src/rp2040_pico.h | 36 + .../src/rp2040_reset.c | 61 ++ .../adafruit-feather-rp2040/src/rp2040_spi.c | 150 +++++ boards/arm/rp2040/adafruit-kb2040/Kconfig | 359 ++++++++++ boards/arm/rp2040/adafruit-kb2040/README.txt | 179 +++++ .../configs/audiopack/defconfig | 76 +++ .../configs/composite/defconfig | 79 +++ .../configs/displaypack/defconfig | 103 +++ .../configs/enc28j60/defconfig | 88 +++ .../adafruit-kb2040/configs/lcd1602/defconfig | 61 ++ .../adafruit-kb2040/configs/nsh/defconfig | 53 ++ .../adafruit-kb2040/configs/nshsram/defconfig | 53 ++ .../adafruit-kb2040/configs/smp/defconfig | 59 ++ .../adafruit-kb2040/configs/spisd/defconfig | 65 ++ .../adafruit-kb2040/configs/ssd1306/defconfig | 80 +++ .../adafruit-kb2040/configs/st7735/defconfig | 64 ++ .../adafruit-kb2040/configs/usbmsc/defconfig | 72 ++ .../adafruit-kb2040/configs/usbnsh/defconfig | 57 ++ .../configs/waveshare-lcd-1.14/defconfig | 100 +++ .../configs/waveshare-lcd-1.3/defconfig | 97 +++ .../rp2040/adafruit-kb2040/include/board.h | 116 ++++ .../adafruit-kb2040/include/rp2040_i2cdev.h | 72 ++ .../adafruit-kb2040/include/rp2040_i2sdev.h | 72 ++ .../adafruit-kb2040/include/rp2040_spidev.h | 69 ++ .../adafruit-kb2040/include/rp2040_spisd.h | 83 +++ .../rp2040/adafruit-kb2040/scripts/Make.defs | 45 ++ .../scripts/adafruit-kb2040-flash.ld | 112 +++ .../scripts/adafruit-kb2040-sram.ld | 97 +++ .../arm/rp2040/adafruit-kb2040/src/Make.defs | 41 ++ .../adafruit-kb2040/src/rp2040_appinit.c | 76 +++ .../src/rp2040_boardinitialize.c | 160 +++++ .../adafruit-kb2040/src/rp2040_bringup.c | 466 +++++++++++++ .../rp2040/adafruit-kb2040/src/rp2040_gpio.c | 392 +++++++++++ .../rp2040/adafruit-kb2040/src/rp2040_pico.h | 36 + .../rp2040/adafruit-kb2040/src/rp2040_reset.c | 61 ++ .../rp2040/adafruit-kb2040/src/rp2040_spi.c | 150 +++++ boards/arm/rp2040/common/src/rp2040_pwmdev.c | 2 +- .../configs/composite/defconfig | 1 + .../pimoroni-tiny2040/configs/gpio/defconfig | 1 + .../pimoroni-tiny2040/configs/nsh/defconfig | 1 + .../configs/nshsram/defconfig | 1 + .../pimoroni-tiny2040/configs/smp/defconfig | 1 + .../pimoroni-tiny2040/configs/spisd/defconfig | 1 + .../configs/usbmsc/defconfig | 1 + .../configs/usbnsh/defconfig | 1 + .../configs/audiopack/defconfig | 1 + .../configs/composite/defconfig | 1 + .../configs/displaypack/defconfig | 1 + .../configs/enc28j60/defconfig | 1 + .../configs/lcd1602/defconfig | 1 + .../raspberrypi-pico/configs/nsh/defconfig | 1 + .../configs/nshsram/defconfig | 1 + .../raspberrypi-pico/configs/smp/defconfig | 1 + .../raspberrypi-pico/configs/spisd/defconfig | 1 + .../configs/ssd1306/defconfig | 1 + .../raspberrypi-pico/configs/st7735/defconfig | 1 + .../raspberrypi-pico/configs/usbmsc/defconfig | 1 + .../raspberrypi-pico/configs/usbnsh/defconfig | 1 + .../configs/waveshare-lcd-1.14/defconfig | 1 + .../configs/waveshare-lcd-1.3/defconfig | 1 + drivers/leds/Kconfig | 49 +- drivers/leds/ws2812.c | 483 +++++++++++-- include/nuttx/leds/ws2812.h | 143 +++- 103 files changed, 8878 insertions(+), 53 deletions(-) create mode 100644 Documentation/components/drivers/character/ws2812.rst create mode 100644 arch/arm/src/rp2040/rp2040_ws2812.c create mode 100644 arch/arm/src/rp2040/rp2040_ws2812.h create mode 100644 arch/arm/src/rp2040/rp2040_ws2812.pio create mode 100644 boards/arm/rp2040/adafruit-feather-rp2040/Kconfig create mode 100644 boards/arm/rp2040/adafruit-feather-rp2040/README.txt create mode 100644 boards/arm/rp2040/adafruit-feather-rp2040/configs/audiopack/defconfig create mode 100644 boards/arm/rp2040/adafruit-feather-rp2040/configs/composite/defconfig create mode 100644 boards/arm/rp2040/adafruit-feather-rp2040/configs/displaypack/defconfig create mode 100644 boards/arm/rp2040/adafruit-feather-rp2040/configs/enc28j60/defconfig create mode 100644 boards/arm/rp2040/adafruit-feather-rp2040/configs/lcd1602/defconfig create mode 100644 boards/arm/rp2040/adafruit-feather-rp2040/configs/nsh/defconfig create mode 100644 boards/arm/rp2040/adafruit-feather-rp2040/configs/nshsram/defconfig create mode 100644 boards/arm/rp2040/adafruit-feather-rp2040/configs/smp/defconfig create mode 100644 boards/arm/rp2040/adafruit-feather-rp2040/configs/spisd/defconfig create mode 100644 boards/arm/rp2040/adafruit-feather-rp2040/configs/ssd1306/defconfig create mode 100644 boards/arm/rp2040/adafruit-feather-rp2040/configs/st7735/defconfig create mode 100644 boards/arm/rp2040/adafruit-feather-rp2040/configs/usbmsc/defconfig create mode 100644 boards/arm/rp2040/adafruit-feather-rp2040/configs/usbnsh/defconfig create mode 100644 boards/arm/rp2040/adafruit-feather-rp2040/configs/waveshare-lcd-1.14/defconfig create mode 100644 boards/arm/rp2040/adafruit-feather-rp2040/configs/waveshare-lcd-1.3/defconfig create mode 100644 boards/arm/rp2040/adafruit-feather-rp2040/include/board.h create mode 100644 boards/arm/rp2040/adafruit-feather-rp2040/include/rp2040_i2cdev.h create mode 100644 boards/arm/rp2040/adafruit-feather-rp2040/include/rp2040_i2sdev.h create mode 100644 boards/arm/rp2040/adafruit-feather-rp2040/include/rp2040_spidev.h create mode 100644 boards/arm/rp2040/adafruit-feather-rp2040/include/rp2040_spisd.h create mode 100644 boards/arm/rp2040/adafruit-feather-rp2040/scripts/Make.defs create mode 100644 boards/arm/rp2040/adafruit-feather-rp2040/scripts/adafruit-feather-rp2040-flash.ld create mode 100644 boards/arm/rp2040/adafruit-feather-rp2040/scripts/adafruit-feather-rp2040-sram.ld create mode 100644 boards/arm/rp2040/adafruit-feather-rp2040/src/Make.defs create mode 100644 boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_appinit.c create mode 100644 boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_boardinitialize.c create mode 100644 boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_bringup.c create mode 100644 boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_gpio.c create mode 100644 boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_pico.h create mode 100644 boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_reset.c create mode 100644 boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_spi.c create mode 100644 boards/arm/rp2040/adafruit-kb2040/Kconfig create mode 100644 boards/arm/rp2040/adafruit-kb2040/README.txt create mode 100644 boards/arm/rp2040/adafruit-kb2040/configs/audiopack/defconfig create mode 100644 boards/arm/rp2040/adafruit-kb2040/configs/composite/defconfig create mode 100644 boards/arm/rp2040/adafruit-kb2040/configs/displaypack/defconfig create mode 100644 boards/arm/rp2040/adafruit-kb2040/configs/enc28j60/defconfig create mode 100644 boards/arm/rp2040/adafruit-kb2040/configs/lcd1602/defconfig create mode 100644 boards/arm/rp2040/adafruit-kb2040/configs/nsh/defconfig create mode 100644 boards/arm/rp2040/adafruit-kb2040/configs/nshsram/defconfig create mode 100644 boards/arm/rp2040/adafruit-kb2040/configs/smp/defconfig create mode 100644 boards/arm/rp2040/adafruit-kb2040/configs/spisd/defconfig create mode 100644 boards/arm/rp2040/adafruit-kb2040/configs/ssd1306/defconfig create mode 100644 boards/arm/rp2040/adafruit-kb2040/configs/st7735/defconfig create mode 100644 boards/arm/rp2040/adafruit-kb2040/configs/usbmsc/defconfig create mode 100644 boards/arm/rp2040/adafruit-kb2040/configs/usbnsh/defconfig create mode 100644 boards/arm/rp2040/adafruit-kb2040/configs/waveshare-lcd-1.14/defconfig create mode 100644 boards/arm/rp2040/adafruit-kb2040/configs/waveshare-lcd-1.3/defconfig create mode 100644 boards/arm/rp2040/adafruit-kb2040/include/board.h create mode 100644 boards/arm/rp2040/adafruit-kb2040/include/rp2040_i2cdev.h create mode 100644 boards/arm/rp2040/adafruit-kb2040/include/rp2040_i2sdev.h create mode 100644 boards/arm/rp2040/adafruit-kb2040/include/rp2040_spidev.h create mode 100644 boards/arm/rp2040/adafruit-kb2040/include/rp2040_spisd.h create mode 100644 boards/arm/rp2040/adafruit-kb2040/scripts/Make.defs create mode 100644 boards/arm/rp2040/adafruit-kb2040/scripts/adafruit-kb2040-flash.ld create mode 100644 boards/arm/rp2040/adafruit-kb2040/scripts/adafruit-kb2040-sram.ld create mode 100644 boards/arm/rp2040/adafruit-kb2040/src/Make.defs create mode 100644 boards/arm/rp2040/adafruit-kb2040/src/rp2040_appinit.c create mode 100644 boards/arm/rp2040/adafruit-kb2040/src/rp2040_boardinitialize.c create mode 100644 boards/arm/rp2040/adafruit-kb2040/src/rp2040_bringup.c create mode 100644 boards/arm/rp2040/adafruit-kb2040/src/rp2040_gpio.c create mode 100644 boards/arm/rp2040/adafruit-kb2040/src/rp2040_pico.h create mode 100644 boards/arm/rp2040/adafruit-kb2040/src/rp2040_reset.c create mode 100644 boards/arm/rp2040/adafruit-kb2040/src/rp2040_spi.c diff --git a/Documentation/components/drivers/character/ws2812.rst b/Documentation/components/drivers/character/ws2812.rst new file mode 100644 index 0000000000..9914ab1377 --- /dev/null +++ b/Documentation/components/drivers/character/ws2812.rst @@ -0,0 +1,32 @@ +=========== +ws2812 Drivers +=========== + +This driver allows control of any smart pixels that use the ws2812 +protocol. It supports pixel chains that use normal RGB pixels or +newer RGBW pixels. + +The current driver does not support mixed RGB and RGBW pixels in a +single chain. + +The NuttX ws2812 driver is split into two parts: + +#. An "upper half", generic driver that provides the common + interface to application level code, and +#. A "lower half", platform-specific driver that implements the + low-level formatting and output. + +Files supporting ws2812 can be found in the following locations: + +- **Interface Definition**. The header file for the NuttX ws2812 + driver reside at ``include/nuttx/leds/ws2812.h``. This header + file includes both the application level interface to the ws2812 + driver as well as the interface between the "upper half" and + "lower half" drivers. The ws2812 module uses a standard character + driver framework. +- **"Upper Half" Driver**. The generic, "upper half" ws2812 driver + resides at ``drivers/leds/ws2812.c``. +- **"Lower Half" Drivers**. Platform-specific ws2812 drivers reside + in ``arch/``\ **\ ``/src/``\ ** + directory for the specific processor ** and for + the specific ** ws2812 peripheral devices. diff --git a/Kconfig b/Kconfig index 0e29f6a06b..b01ba30e32 100644 --- a/Kconfig +++ b/Kconfig @@ -1220,7 +1220,7 @@ endif # DEBUG_LCD config DEBUG_LEDS bool "Low-level LED Debug Features" default n - depends on ARCH_HAVE_LEDS + depends on ARCH_HAVE_LEDS || WS2812 ---help--- Enable LED driver debug features. diff --git a/arch/arm/src/rp2040/Kconfig b/arch/arm/src/rp2040/Kconfig index 79913bb041..ffee5fe488 100644 --- a/arch/arm/src/rp2040/Kconfig +++ b/arch/arm/src/rp2040/Kconfig @@ -141,7 +141,7 @@ config RP2040_I2C_DRIVER endif -config RP2040_PWM +menuconfig RP2040_PWM bool "PWM" select PWM ---help--- @@ -210,7 +210,7 @@ config PWM_MULTICHAN drives GPIO pin 13 or 29 with the B channel. config RP2040_PWM7 - bool "PWM7 (Pin 14 and 15)" + bool "PWM7" ---help--- Drives GPIO pin 14 with the A channel, and drives GPIO pin 15 with the B channel. @@ -281,3 +281,14 @@ config RP2040_SPISD_SPI_CH Select spi channel number to use spi sd card. endif # SPISD 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 diff --git a/arch/arm/src/rp2040/Make.defs b/arch/arm/src/rp2040/Make.defs index d9819d9a67..7bd096d8c6 100644 --- a/arch/arm/src/rp2040/Make.defs +++ b/arch/arm/src/rp2040/Make.defs @@ -66,6 +66,10 @@ ifeq ($(CONFIG_USBDEV),y) CHIP_CSRCS += rp2040_usbdev.c endif +ifeq ($(CONFIG_WS2812),y) +CHIP_CSRCS += rp2040_ws2812.c +endif + ifeq ($(CONFIG_RP2040_FLASH_BOOT),y) ifneq ($(PICO_SDK_PATH),) include chip/boot2/Make.defs diff --git a/arch/arm/src/rp2040/rp2040_dmac.c b/arch/arm/src/rp2040/rp2040_dmac.c index 2555508610..d43d3787dc 100644 --- a/arch/arm/src/rp2040/rp2040_dmac.c +++ b/arch/arm/src/rp2040/rp2040_dmac.c @@ -372,7 +372,7 @@ void rp2040_rxdmasetup(DMA_HANDLE handle, uintptr_t paddr, uintptr_t maddr, * Name: rp2040_txdmasetup * * Description: - * Configure an TX (memory-to-memory) DMA before starting the transfer. + * Configure an TX (memory-to-peripheral) DMA before starting the transfer. * * Input Parameters: * paddr - Peripheral address (destination) diff --git a/arch/arm/src/rp2040/rp2040_dmac.h b/arch/arm/src/rp2040/rp2040_dmac.h index 4081a8a7be..a56ce325a0 100644 --- a/arch/arm/src/rp2040/rp2040_dmac.h +++ b/arch/arm/src/rp2040/rp2040_dmac.h @@ -207,7 +207,7 @@ void rp2040_rxdmasetup(DMA_HANDLE handle, uintptr_t paddr, uintptr_t maddr, * Name: rp2040_txdmasetup * * Description: - * Configure an TX (memory-to-memory) DMA before starting the transfer. + * Configure an TX (memory-to-peripheral) DMA before starting the transfer. * * Input Parameters: * paddr - Peripheral address (destination) diff --git a/arch/arm/src/rp2040/rp2040_ws2812.c b/arch/arm/src/rp2040/rp2040_ws2812.c new file mode 100644 index 0000000000..b2ab9aed4e --- /dev/null +++ b/arch/arm/src/rp2040/rp2040_ws2812.c @@ -0,0 +1,635 @@ +/**************************************************************************** + * arch/arm/src/rp2040/rp2040_ws2812.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 + +#include +#include +#include +#include + +#include +#include + +#include + +#ifdef CONFIG_WS2812 + +/**************************************************************************** + * Private Type Definitions + ****************************************************************************/ + +struct instance +{ + uint32_t pio; /* The pio instance we are using. */ + uint32_t pio_location; /* the program location in the pio. */ + uint32_t pio_sm; /* The state machine we are using. */ + 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. */ +}; + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static const uint16_t ws2812_program_instructions[] = +{ + 0x6221, /* 0: out x, 1 side 0 [2] <-- wrap target */ + 0x1123, /* 1: jmp !x, 3 side 1 [1] */ + 0x1400, /* 2: jmp 0 side 1 [4] */ + 0xa442, /* 3: nop side 0 [4] --> wrap */ +}; + +static const struct rp2040_pio_program pio_program = +{ + .instructions = ws2812_program_instructions, + .length = 4, + .origin = -1, +}; + +#define ws2812_wrap_target 0 +#define ws2812_wrap 3 + +#define ws2812_T1 2 +#define ws2812_T2 5 +#define ws2812_T3 3 + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: dma_complete + * + * Description: + * Called on completion of the DMA transfer. + * + * Input Parameters: + * handle - handle to our DMA channel + * status - status of the transfer + * arg - Pointer to drivers private data structure. + * + ****************************************************************************/ + +void dma_complete(DMA_HANDLE handle, uint8_t status, void *arg) +{ + FAR struct ws2812_dev_s *dev_data = arg; + FAR struct instance *priv = (FAR struct instance *) + dev_data->private; + + rp2040_dmafree(handle); + + priv->last_dma = clock_systime_ticks(); + + nxsem_post(&dev_data->exclsem); +} + +/**************************************************************************** + * Name: update_pixels + * + * Description: + * This thread manages the actual update of pixels. + * + * Input Parameters: + * dev_data - Pointer to drivers device data structure. + * + ****************************************************************************/ + +static void update_pixels(FAR struct ws2812_dev_s *dev_data) +{ + FAR struct instance *priv = (FAR struct instance *) + dev_data->private; + clock_t time_delta; + DMA_HANDLE dma_handle = rp2040_dmachannel(); + dma_config_t dma_config = + { + .dreq = rp2040_pio_get_dreq(priv->pio, priv->pio_sm, true), + .size = RP2040_DMA_SIZE_WORD, + .noincr = false + }; + + rp2040_txdmasetup(dma_handle, + (uintptr_t) RP2040_PIO_TXF(priv->pio, priv->pio_sm), + (uintptr_t) priv->pixels, + 4 * dev_data->nleds, + dma_config); + + /* Make sure at least 50us elapsed since last DMA completed. */ + + time_delta = (clock_systime_ticks() - priv->last_dma) + * CONFIG_USEC_PER_TICK; + + if (time_delta < 50) + { + usleep(50 - time_delta); + } + + rp2040_dmastart(dma_handle, dma_complete, dev_data); + + /* NOTE: we don't post exclsem here, the dma_complete does that */ +} + +/**************************************************************************** + * Name: my_open + * + * Description: + * + * Input Parameters: + * dev_data - Pointer to a ws2812_dev_s + * + * Returned Value: + * A pointer to an internal structure used by rp2040_ws2812 + * + ****************************************************************************/ + +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; + rp2040_pio_sm_config config; + int divisor; + int ret; + + nxsem_wait(&dev_data->exclsem); + + if (dev_data->private != 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); + + 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 */ + + for (priv->pio = 0; priv->pio < RP2040_PIO_NUM; ++priv->pio) + { + /* Try to claim a state machine */ + + priv->pio_sm = rp2040_pio_claim_unused_sm(priv->pio, false); + + /* If we did not get one try the nest pio block, if any */ + + if (priv->pio_sm < 0) continue; + + /* See if we have space in this block to load our program */ + + if (rp2040_pio_can_add_program(priv->pio, &pio_program)) + { + /* Great! load the program and exit the pio choice loop */ + + priv->pio_location = rp2040_pio_add_program(priv->pio, + &pio_program); + + break; + } + + /* Oops -- no room at the inn! Release sm and try next pio */ + + rp2040_pio_sm_unclaim(priv->pio, priv->pio_sm); + } + + if (priv->pio >= RP2040_PIO_NUM) + { + kmm_free(priv->pixels); + + dev_data->private = NULL; + kmm_free(priv); + + ret = -ENOMEM; + goto post_and_return; + } + + /* ==== configure the pio state machine ==== */ + + /* Configure our pin as used by PIO for output */ + + rp2040_pio_gpio_init(priv->pio, dev_data->port); + + rp2040_pio_sm_set_consecutive_pindirs(priv->pio, + priv->pio_sm, + dev_data->port, + 1, + true); + + /* Initialize the config structure */ + + memset(&config, 1, sizeof(rp2040_pio_sm_config)); + + /* Set the clock divisor as appropriate for our system clock speed + * so the pio clock rus at nine time the requested bit clock rate + */ + + divisor = ((uint64_t)BOARD_SYS_FREQ << 8) + / (9 * (uint64_t)dev_data->clock); + + rp2040_sm_config_set_clkdiv_int_frac(&config, + divisor >> 8, + divisor & 0xff); + + /* Set the wrap points as required by the program */ + + rp2040_sm_config_set_wrap(&config, + priv->pio_location + ws2812_wrap_target, + priv->pio_location + ws2812_wrap); + + /* set to shift out 24 or 32 bits depending on has_white. */ + + rp2040_sm_config_set_out_shift(&config, + false, + true, + dev_data->has_white ? 32 : 24); + + /* Configure a single mandatory side-set pin */ + + rp2040_sm_config_set_sideset(&config, 1, false, false); + + /* Since we don't need an RX fifo, well make a bit TX fifo */ + + rp2040_sm_config_set_fifo_join(&config, + RP2040_PIO_FIFO_JOIN_TX); + + /* Configure a single mandatory side-set pin */ + + rp2040_sm_config_set_sideset(&config, 1, false, false); + + /* Configure our chosen GPIO pin (in "port") as side-set output */ + + rp2040_sm_config_set_sideset_pins(&config, dev_data->port); + + /* Load the configuration into the state machine. */ + + rp2040_pio_sm_init(priv->pio, + priv->pio_sm, + priv->pio_location, + &config); + + /* Enable the state machine */ + + rp2040_pio_sm_set_enabled(priv->pio, priv->pio_sm, true); + + ret = OK; + +post_and_return: + nxsem_post(&dev_data->exclsem); + + return ret; +} + +/**************************************************************************** + * Name: my_close + * + * Description: + * + * Input Parameters: + * dev_data - Pointer to a ws2812_dev_s + * + * Returned Value: + * OK on success + * + ****************************************************************************/ + +static int my_close(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 *) + dev_data->private; + + nxsem_wait(&dev_data->exclsem); + + ledinfo("rp2040_ws2812 close dev: 0x%08lX\n", (uint32_t) dev_data); + + priv->open_count -= 1; + + nxsem_post(&dev_data->exclsem); + + return OK; +} + +/**************************************************************************** + * Name: my_write + * Description: + * Updates the ws2812s with new data. + * + * Input Parameter: + * filep - Pointer system file data + * data - Data to send. + * len - Length of data in bytes. + * + * Returned Value: + * number of bytes written on success, ERROR if write fails. + * + ****************************************************************************/ + +static ssize_t my_write(FAR struct file *filep, + FAR const char *data, + size_t len) +{ + FAR struct inode *inode = filep->f_inode; + FAR struct ws2812_dev_s *dev_data = inode->i_private; + FAR struct instance *priv = (FAR struct instance *) + dev_data->private; + int position = filep->f_pos; + FAR uint8_t *xfer_p = priv->pixels + position; + int xfer_index = 0; + + if (data == NULL) + { + return 0; + } + + nxsem_wait(&dev_data->exclsem); + + ledinfo("rp2040_ws2812 write dev: 0x%08lX\n", (uint32_t) dev_data); + + if (len > 0) + { + /* Copy the data to the buffer swapping the + * red and green, since ws2812 use a GRB order + * instead of RGB + */ + + for (xfer_index = 0; xfer_index < len; xfer_index += 4) + { + /* Stop transfer at end of pixel buffer */ + + if (position >= (4 * dev_data->nleds)) + { + ledinfo("rp2040_ws2812 write off end: %d\n", position); + break; + } + + /* Copy swapping WWRRGGBB to GGRRBBWW */ + + #ifdef CONFIG_BIG_ENDIAN + xfer_p[3] = *data++; + xfer_p[1] = *data++; + xfer_p[0] = *data++; + xfer_p[2] = *data++; + #else /* CONFIG_BIG_ENDIAN */ + xfer_p[1] = *data++; + xfer_p[3] = *data++; + xfer_p[2] = *data++; + xfer_p[0] = *data++; + #endif /* CONFIG_BIG_ENDIAN */ + + xfer_p += 4; + position += 4; + } + + filep->f_pos = position; + } + + update_pixels(dev_data); + + /* NOTE: we don't post exclsem here, so update_pixels must make sure + * that happens. + */ + + return xfer_index; +} + +/**************************************************************************** + * Name: my_read + * Description: + * Reads data back from the pixel buffer. + * + * Input Parameter: + * filep - Pointer system file data + * data - Buffer for return data. + * len - Length of data in bytes. + * + * Returned Value: + * number of bytes read on success, ERROR if write fails. + * + ****************************************************************************/ + +static ssize_t my_read(FAR struct file *filep, + FAR char *data, + size_t len) +{ + FAR struct inode *inode = filep->f_inode; + FAR struct ws2812_dev_s *dev_data = inode->i_private; + FAR struct instance *priv = (FAR struct instance *) + dev_data->private; + int position = filep->f_pos; + FAR uint8_t *xfer_p = priv->pixels + position; + int xfer_index = 0; + + if (data == NULL || len == 0) + { + return 0; + } + + nxsem_wait(&dev_data->exclsem); + + /* Copy the data from the buffer swapping the + * red and green, since ws2812 use a GRB order + * instead of RGB + */ + + for (xfer_index = 0; xfer_index < len; xfer_index += 4) + { + /* Stop transfer at end of pixel buffer */ + + if (position >= (4 * dev_data->nleds)) + { + ledinfo("rp2040_ws2812 read off end: %d\n", position); + break; + } + + /* Copy swapping GGRRBBWW to WWRRGGBB */ + + #ifdef CONFIG_BIG_ENDIAN + *data++ = xfer_p[3]; + *data++ = xfer_p[1]; + *data++ = xfer_p[0]; + *data++ = xfer_p[2]; + #else /* CONFIG_BIG_ENDIAN */ + *data++ = xfer_p[1]; + *data++ = xfer_p[3]; + *data++ = xfer_p[2]; + *data++ = xfer_p[0]; + #endif /* CONFIG_BIG_ENDIAN */ + + xfer_p += 4; + position += 4; + } + + filep->f_pos = position; + + nxsem_wait(&dev_data->exclsem); + + return xfer_index; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: rp2040_ws2812_setup + * + * Description: + * Initialize and register the ws2812 driver. + * + * Input Parameters: + * Path to the ws2812 device (e.g. "/dev/leds0") + * Port number for the ws2812 chain + * The number of pixels in the chain + * Whether ws2812s have white LEDs + * + * Returned Value: + * An opaque pointer that can be passed to rp2040_ws2812_teardown on + * success or NULL (with errno set) on failure + ****************************************************************************/ + +FAR void * rp2040_ws2812_setup(FAR const char *path, + int port, + uint16_t pixel_count, + bool has_white) +{ + FAR struct ws2812_dev_s * dev_data; + int err; + + dev_data = kmm_zalloc(sizeof(struct ws2812_dev_s)); + + if (dev_data == NULL) + { + set_errno(ENOMEM); + return NULL; + } + + dev_data->open = my_open; + dev_data->close = my_close; + dev_data->write = my_write; + dev_data->read = my_read; + dev_data->port = port; + dev_data->nleds = pixel_count; + dev_data->clock = CONFIG_WS2812_FREQUENCY; + + nxsem_init(&dev_data->exclsem, 0, 1); + + ledinfo("register dev_data: 0x%08lX\n", (uint32_t) dev_data); + + err = ws2812_register(path, dev_data); + + if (err != OK) + { + set_errno(err); + return NULL; + } + + return (void *)dev_data; +} + +/**************************************************************************** + * Name: rp2040_ws2812_release + * + * Description: + * This function releases the internal memory structures created when + * a driver is opened. It will fail with an error -EBUSY the driver + * is opened. + * + * Input Parameters: + * driver - Opaque pointer returned by rp2040_ws2812_setup. + * + * Returned Value: + * OK on success or an ERROR on failure + * + ****************************************************************************/ + +int rp2040_ws2812_release(FAR void * driver) +{ + FAR struct ws2812_dev_s *dev_data = driver; + FAR struct instance *priv = (FAR struct instance *) + dev_data->private; + + int ret = OK; + + nxsem_wait(&dev_data->exclsem); + + if (priv->open_count == 0) + { + dev_data->private = NULL; + + rp2040_pio_sm_set_enabled(priv->pio, priv->pio_sm, false); + rp2040_pio_sm_unclaim(priv->pio, priv->pio_sm); + + nxsem_post(&dev_data->exclsem); + + kmm_free(priv->pixels); + kmm_free(priv); + } + else + { + ret = -EBUSY; + nxsem_post(&dev_data->exclsem); + } + + return ret; +} + +#endif /* CONFIG_WS2812 */ diff --git a/arch/arm/src/rp2040/rp2040_ws2812.h b/arch/arm/src/rp2040/rp2040_ws2812.h new file mode 100644 index 0000000000..533eb0dc18 --- /dev/null +++ b/arch/arm/src/rp2040/rp2040_ws2812.h @@ -0,0 +1,95 @@ +/**************************************************************************** + * arch/arm/src/rp2040/rp2040_ws2812.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 __ARCH_ARM_SRC_RP2040_RP2040_WS2812_H +#define __ARCH_ARM_SRC_RP2040_RP2040_WS2812_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include + +#ifndef __ASSEMBLY__ +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +#ifdef CONFIG_WS2812 + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: rp2040_ws2812_setup + * + * Description: + * Initialize and register the ws2812 driver. + * + * Input Parameters: + * Path to the ws2812 device (e.g. "/dev/leds0") + * Port number for the ws2812 chain + * The number of pixels in the chain + * Whether ws2812s have white LEDs + * + * Returned Value: + * An opaque pointer that can be passed to rp2040_ws2812_teardown on + * success or NULL (with errno set) on failure + ****************************************************************************/ + +FAR void * rp2040_ws2812_setup(FAR const char *path, + int port, + uint16_t pixel_count, + bool has_white); + +/**************************************************************************** + * Name: rp2040_ws2812_release + * + * Description: + * This function releases the internal memory structures created when + * a driver is opened. It will fail with an error -EBUSY the driver + * is open when it is called. + * + * Input Parameters: + * driver - Opaque pointer returned by rp2040_ws2812_setup. + * + * Returned Value: + * OK on success or an ERROR on failure + * + ****************************************************************************/ + +int rp2040_ws2812_release(FAR void * driver); + +#endif + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __ARCH_ARM_SRC_RP2040_RP2040_I2C_H */ diff --git a/arch/arm/src/rp2040/rp2040_ws2812.pio b/arch/arm/src/rp2040/rp2040_ws2812.pio new file mode 100644 index 0000000000..856ea51bc2 --- /dev/null +++ b/arch/arm/src/rp2040/rp2040_ws2812.pio @@ -0,0 +1,46 @@ +; arch/arm/src/rp2040/rp2040_ws2812.pio +; +; Adapted from code release under the BSD-3-Clause license +; supplied by Raspberry Pi (Trading) Ltd. +; +; Copyright (c) 2020 Raspberry Pi (Trading) Ltd. +; +; This code was compiled with pioasm and the results included +; in "arch/arm/src/rp2040/rp2040_ws2812.c". This file is +; supplied for documentation purposes only +; +; Each bit of the input word generaes one of two patterns for output: +; +; clock +-----+-----+-----+-----+-----+-----+-----+-----+-----+ +| | T1 | T2 | T3 | +; +; +-----------+ +; zero-bit | | | +; +-----------------------------------------+ +; +; +-----------------------------------+ +; one-bit | | | +; +-----------------+ +; +; Each clock tick should be ~ 139 nS (7.2 Mhz) +; +; A zero bit is 0.278 µs high and 1.123 µs low. +; A one bit is 0.973 µs high and 0.417 µs low. + +; +.program ws2812 +.side_set 1 + +.define public T1 2 +.define public T2 5 +.define public T3 3 + +.wrap_target +bitloop: + out x, 1 side 0 [T3 - 1] ; Side-set still takes place when instruction stalls + jmp !x do_zero side 1 [T1 - 1] ; Branch on the bit we shifted out. Positive pulse +do_one: + jmp bitloop side 1 [T2 - 1] ; Continue driving high, for a long pulse +do_zero: + nop side 0 [T2 - 1] ; Or drive low, for a short pulse +.wrap \ No newline at end of file diff --git a/boards/Kconfig b/boards/Kconfig index 89cd29d48b..c71cb1b3a1 100644 --- a/boards/Kconfig +++ b/boards/Kconfig @@ -1472,6 +1472,20 @@ config ARCH_BOARD_PIMORONI_TINY2040 Support is derived from Raspberry Pi Pico support. STATUS: Work has just began on this port. +config ARCH_BOARD_ADAFRUIT_FEATHER_RP2040 + bool "Adafruit Feather RP2040 board" + depends on ARCH_CHIP_RP2040 + ---help--- + This is a port to the Adafruit Feather RP2040 board. + Support is derived from Raspberry Pi Pico support. + +config ARCH_BOARD_ADAFRUIT_KB2040 + bool "Adafruit KB2040 board" + depends on ARCH_CHIP_RP2040 + ---help--- + This is a port to the Adafruit KB2040 board. + Support is derived from Raspberry Pi Pico support. + config ARCH_BOARD_RX65N bool "RX65N renesas board" depends on ARCH_CHIP_R5F565NEDDFC @@ -2602,6 +2616,8 @@ config ARCH_BOARD default "intel64-qemu" if ARCH_BOARD_INTEL64_QEMU default "raspberrypi-pico" if ARCH_BOARD_RASPBERRYPI_PICO 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 "rx65n" if ARCH_BOARD_RX65N default "rx65n-rsk1mb" if ARCH_BOARD_RX65N_RSK1MB default "rx65n-rsk2mb" if ARCH_BOARD_RX65N_RSK2MB @@ -2935,6 +2951,12 @@ endif if ARCH_BOARD_PIMORONI_TINY2040 source "boards/arm/rp2040/pimoroni-tiny2040/Kconfig" endif +if ARCH_BOARD_ADAFRUIT_FEATHER_RP2040 +source "boards/arm/rp2040/adafruit-feather-rp2040/Kconfig" +endif +if ARCH_BOARD_ADAFRUIT_KB2040 +source "boards/arm/rp2040/adafruit-kb2040/Kconfig" +endif if ARCH_BOARD_ARDUINO_DUE source "boards/arm/sam34/arduino-due/Kconfig" endif diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/Kconfig b/boards/arm/rp2040/adafruit-feather-rp2040/Kconfig new file mode 100644 index 0000000000..87b4d88e4a --- /dev/null +++ b/boards/arm/rp2040/adafruit-feather-rp2040/Kconfig @@ -0,0 +1,342 @@ +# +# 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_FEATHER_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 "flash chip name" + default "w25q080" + ---help--- + Name of NOR flash device connected to RP2040 SoC. + (Used to choose the secondary 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. + +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 + range 0 1 + depends on LCD + ---help--- + Select SPI channel number to use LCD display. + +config RP2040_ENC28J60_SPI_CH + int "ENC28J60 SPI channel number" + default 1 + range 0 1 + depends on ENC28J60 + ---help--- + Select SPI channel number to use ENC28J60 ethernet. + +config RP2040_ENC28J60_INTR_GPIO + int "ENC28J60 interrupt GPIO pin assign" + default -1 + range -1 29 + depends on ENC28J60 + +config RP2040_ENC28J60_RESET_GPIO + int "ENC28J60 reset GPIO pin assign (optional)" + default -1 + range -1 29 + depends on ENC28J60 + +endif diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/README.txt b/boards/arm/rp2040/adafruit-feather-rp2040/README.txt new file mode 100644 index 0000000000..0ff8384310 --- /dev/null +++ b/boards/arm/rp2040/adafruit-feather-rp2040/README.txt @@ -0,0 +1,180 @@ +README +====== + +This directory contains the port of NuttX to the Adafruit Feather RP2040. +See https://www.adafruit.com/product/4884 for information +about Adafruit Feather RP2040. + +Currently only the following devices are supported. + + Supported: + - UART (console port) + - GPIO 0 (UART0 TX) and GPIO 1 (UART0 RX) are used for the console. + - I2C + - SPI + - DMAC + - PWM + - 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. + - BMP180 sensor at I2C0 (don't forget to define I2C0 GPIOs at "I2C0 GPIO pin assign" in Board Selection menu) + - INA219 sensor / module (don't forget to define I2C0 GPIOs at "I2C0 GPIO pin assign" in Board Selection menu) + - Pico Display Pack (ST7789 LCD) + - RGB leds and buttons are not supported yet. + - Pico Audio Pack (PCM5100A I2S DAC) + - I2S interface is realized by PIO. + + 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= + +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 Feather RP2040 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 0 and 1 pins must be connected to the + 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. + +- ssd1306 + SSD1306 OLED display (I2C) test configuration + Connection: + SSD1306 Raspberry Pi Pico + GND ----- GND (Pin 3 or 38 or ...) + VCC ----- 3V3 OUT (Pin 36) + SDA ----- GP4 (I2C0 SDA) (Pin 6) + SCL ----- GP5 (I2C0 SCL) (Pin 7) + +- lcd1602 + LCD 1602 Segment LCD Disaply (I2C) + Connection: + PCF8574 BackPack Raspberry Pi Pico + GND ----- GND (Pin 3 or 38 or ...) + VCC ----- 5V Vbus (Pin 40) + SDA ----- GP4 (I2C0 SDA) (Pin 6) + SCL ----- GP5 (I2C0 SCL) (Pin 7) +- spisd + SD card support (SPI connection) + Connection: + SD card slot Raspberry Pi Pico + DAT2 (NC) + DAT3/CS ----- GP17 (SPI0 CSn) (Pin 22) + CMD /DI ----- GP19 (SPI0 TX) (Pin 25) + VDD ----- 3V3 OUT (Pin 36) + CLK/SCK ----- GP18 (SPI0 SCK) (Pin 24) + VSS ----- GND (Pin 3 or 38 or ...) + DAT0/DO ----- GP16 (SPI0 RX) (Pin 21) + DAT1 (NC) + * Card hot swapping is not supported. + +- st7735 + st7735 SPI LCD support + Connection: + st7735 Raspberry Pi Pico + GND ----- GND (Pin 3 or 38 or ...) + VCC ----- 5V Vbus (Pin 40) + SDA ----- GP15 (SPI1 TX) (Pin 20) + SCK ----- GP14 (SPI1 SCK) (Pin 19) + CS ----- GP13 (SPI1 CSn) (Pin 17) + AO(D/C) ----- GP12 (SPI1 RX) (Pin 16) + BL ----- GP11 (Pin 15) + RESET ----- GP10 (Pin 14) + +- enc28j60 + ENC28J60 SPI ethernet controller support + - IP address is configured by DHCP. + - DNS address is 8.8.8.8 (CONFIG_NETINIT_DNSIPADDR) + - NTP client is enabled. + Connection: + ENC28J60 Raspberry Pi Pico + GND ----- GND (Pin 3 or 38 or ...) + 3.3 ----- 3V3 OUT (Pin 36) + SI ----- GP15 (SPI1 TX) (Pin 20) + SCK ----- GP14 (SPI1 SCK) (Pin 19) + CS ----- GP13 (SPI1 CSn) (Pin 17) + SO ----- GP12 (SPI1 RX) (Pin 16) + INT ----- GP11 (Pin 15) + RESET ----- GP10 (Pin 14) + +- displaypack + Pico Display Pack support + See the following page for connection: + https://shop.pimoroni.com/products/pico-display-pack + +- audiopack + Pico Audio Pack support + See the following page for connection: + https://shop.pimoroni.com/products/pico-audio-pack + SD card interface is also enabled. + +- usbnsh + USB CDC/ACM serial console with NuttShell + +- usbmsc + USB MSC and CDC/ACM support + `msconn` and `sercon` commands enable the MSC and CDC/ACM devices. + The MSC support provides the interface to the SD card with SPI, + so the SD card slot connection like spisd configuration is required. + +- 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. diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/configs/audiopack/defconfig b/boards/arm/rp2040/adafruit-feather-rp2040/configs/audiopack/defconfig new file mode 100644 index 0000000000..a08e1f17c4 --- /dev/null +++ b/boards/arm/rp2040/adafruit-feather-rp2040/configs/audiopack/defconfig @@ -0,0 +1,76 @@ +# +# 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_AUDIO_FORMAT_MP3 is not set +# CONFIG_FS_PROCFS_EXCLUDE_ENVIRON is not set +# CONFIG_LIBC_LONG_LONG is not set +# CONFIG_MMCSD_HAVE_CARDDETECT is not set +# CONFIG_MMCSD_HAVE_WRITEPROTECT 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_NSH_DISABLE_MB is not set +# CONFIG_NSH_DISABLE_MH is not set +# CONFIG_NSH_DISABLE_MW is not set +# CONFIG_SPI_CALLBACK is not set +# CONFIG_STANDARD_SERIAL is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="adafruit-feather-rp2040" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ADAFRUIT_FEATHER_RP2040=y +CONFIG_ARCH_CHIP="rp2040" +CONFIG_ARCH_CHIP_RP2040=y +CONFIG_ARCH_RAMVECTORS=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_AUDIO=y +CONFIG_AUDIO_I2S=y +CONFIG_AUDIO_I2SCHAR=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_DRIVERS_AUDIO=y +CONFIG_EXAMPLES_HELLO=y +CONFIG_FAT_LCNAMES=y +CONFIG_FAT_LFN=y +CONFIG_FS_FAT=y +CONFIG_FS_PROCFS=y +CONFIG_FS_PROCFS_REGISTER=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_MMCSD=y +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_READLINE=y +CONFIG_NXPLAYER_DEFAULT_MEDIADIR="/mnt/sd0" +CONFIG_RAM_SIZE=270336 +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 +CONFIG_SCHED_HPWORK=y +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_SYSTEM_NXPLAYER=y +CONFIG_SYSTEM_SPITOOL=y +CONFIG_TESTING_GETPRIME=y +CONFIG_TESTING_OSTEST=y +CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_WS2812_NON_SPI_DRIVER=y +CONFIG_WS2812=y +CONFIG_RP2040_BOARD_HAS_WS2812=y +CONFIG_RP2040_WS2812_GPIO_PIN=16 diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/configs/composite/defconfig b/boards/arm/rp2040/adafruit-feather-rp2040/configs/composite/defconfig new file mode 100644 index 0000000000..244f84aeba --- /dev/null +++ b/boards/arm/rp2040/adafruit-feather-rp2040/configs/composite/defconfig @@ -0,0 +1,79 @@ +# +# 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_LIBC_LONG_LONG is not set +# CONFIG_MMCSD_HAVE_CARDDETECT is not set +# CONFIG_MMCSD_HAVE_WRITEPROTECT 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_SPI_CALLBACK is not set +# CONFIG_STANDARD_SERIAL is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="adafruit-feather-rp2040" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ADAFRUIT_FEATHER_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_COMPOSITE=y +CONFIG_COMPOSITE_IAD=y +CONFIG_COMPOSITE_MSFT_OS_DESCRIPTORS=y +CONFIG_COMPOSITE_PRODUCTID=0x2022 +CONFIG_COMPOSITE_SERIALSTR="12345" +CONFIG_COMPOSITE_VENDORID=0x03eb +CONFIG_DEBUG_FULLOPT=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_DISABLE_POSIX_TIMERS=y +CONFIG_EXAMPLES_HELLO=y +CONFIG_EXAMPLES_USBSERIAL=y +CONFIG_FAT_LCNAMES=y +CONFIG_FAT_LFN=y +CONFIG_FS_FAT=y +CONFIG_FS_PROCFS=y +CONFIG_FS_PROCFS_REGISTER=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_MMCSD=y +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_SPI0=y +CONFIG_RP2040_SPI0_GPIO=16 +CONFIG_RP2040_SPI=y +CONFIG_RP2040_SPISD=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_WAITPID=y +CONFIG_START_DAY=9 +CONFIG_START_MONTH=2 +CONFIG_START_YEAR=2021 +CONFIG_SYSTEM_COMPOSITE=y +CONFIG_SYSTEM_NSH=y +CONFIG_SYSTEM_SPITOOL=y +CONFIG_TESTING_GETPRIME=y +CONFIG_TESTING_OSTEST=y +CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_USBDEV=y +CONFIG_USBDEV_BUSPOWERED=y +CONFIG_USBDEV_COMPOSITE=y +CONFIG_USBMSC=y +CONFIG_USBMSC_COMPOSITE=y +CONFIG_USBMSC_NOT_STALL_BULKEP=y +CONFIG_WS2812_NON_SPI_DRIVER=y +CONFIG_WS2812=y +CONFIG_RP2040_BOARD_HAS_WS2812=y +CONFIG_RP2040_WS2812_GPIO_PIN=16 diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/configs/displaypack/defconfig b/boards/arm/rp2040/adafruit-feather-rp2040/configs/displaypack/defconfig new file mode 100644 index 0000000000..db39caa6a7 --- /dev/null +++ b/boards/arm/rp2040/adafruit-feather-rp2040/configs/displaypack/defconfig @@ -0,0 +1,103 @@ +# +# 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_EXAMPLES_NXLINES_DEFAULT_COLORS is not set +# CONFIG_FS_PROCFS_EXCLUDE_ENVIRON is not set +# CONFIG_LIBC_LONG_LONG 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_NXFONTS_DISABLE_16BPP is not set +# CONFIG_NX_DISABLE_16BPP is not set +# CONFIG_NX_PACKEDMSFIRST is not set +# CONFIG_NX_WRITEONLY is not set +# CONFIG_STANDARD_SERIAL is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="adafruit-feather-rp2040" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ADAFRUIT_FEATHER_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_ASSERTIONS=y +CONFIG_DEBUG_FEATURES=y +CONFIG_DEBUG_FULLOPT=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_DISABLE_POSIX_TIMERS=y +CONFIG_DRIVERS_VIDEO=y +CONFIG_EXAMPLES_FB=y +CONFIG_EXAMPLES_HELLO=y +CONFIG_EXAMPLES_NX=y +CONFIG_EXAMPLES_NXDEMO=y +CONFIG_EXAMPLES_NXDEMO_BPP=16 +CONFIG_EXAMPLES_NXHELLO=y +CONFIG_EXAMPLES_NXHELLO_BPP=16 +CONFIG_EXAMPLES_NXLINES=y +CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320 +CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0 +CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4 +CONFIG_EXAMPLES_NXLINES_BPP=16 +CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb +CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0 +CONFIG_EXAMPLES_NX_BPP=16 +CONFIG_FS_PROCFS=y +CONFIG_FS_PROCFS_REGISTER=y +CONFIG_I2C=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_LCD=y +CONFIG_LCD_DEV=y +CONFIG_LCD_FRAMEBUFFER=y +CONFIG_LCD_MAXCONTRAST=255 +CONFIG_LCD_NOGETRUN=y +CONFIG_LCD_ST7789=y +CONFIG_LCD_ST7789_FREQUENCY=64000000 +CONFIG_LCD_ST7789_XOFFSET=53 +CONFIG_LCD_ST7789_XRES=135 +CONFIG_LCD_ST7789_YOFFSET=40 +CONFIG_LCD_ST7789_YRES=240 +CONFIG_MQ_MAXMSGSIZE=64 +CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6 +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_READLINE=y +CONFIG_NSH_USBCONSOLE=y +CONFIG_NX=y +CONFIG_NXFONTS_PACKEDMSFIRST=y +CONFIG_NXFONT_SANS40X49B=y +CONFIG_NX_BLOCKING=y +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 +CONFIG_SPI_CMDDATA=y +CONFIG_START_DAY=9 +CONFIG_START_MONTH=2 +CONFIG_START_YEAR=2021 +CONFIG_SYSTEM_I2CTOOL=y +CONFIG_SYSTEM_NSH=y +CONFIG_SYSTEM_SPITOOL=y +CONFIG_TESTING_GETPRIME=y +CONFIG_TESTING_OSTEST=y +CONFIG_USBDEV=y +CONFIG_USBDEV_BUSPOWERED=y +CONFIG_VIDEO_FB=y +CONFIG_WS2812_NON_SPI_DRIVER=y +CONFIG_WS2812=y +CONFIG_RP2040_BOARD_HAS_WS2812=y +CONFIG_RP2040_WS2812_GPIO_PIN=16 diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/configs/enc28j60/defconfig b/boards/arm/rp2040/adafruit-feather-rp2040/configs/enc28j60/defconfig new file mode 100644 index 0000000000..a1c499677a --- /dev/null +++ b/boards/arm/rp2040/adafruit-feather-rp2040/configs/enc28j60/defconfig @@ -0,0 +1,88 @@ +# +# 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_LIBC_LONG_LONG 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_STANDARD_SERIAL is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="adafruit-feather-rp2040" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ADAFRUIT_FEATHER_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_ZERO=y +CONFIG_DISABLE_POSIX_TIMERS=y +CONFIG_ENC28J60=y +CONFIG_EXAMPLES_HELLO=y +CONFIG_FS_PROCFS=y +CONFIG_FS_PROCFS_REGISTER=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_NET=y +CONFIG_NETDB_DNSCLIENT=y +CONFIG_NETDB_DNSSERVER_NOADDR=y +CONFIG_NETDEVICES=y +CONFIG_NETDEV_PHY_IOCTL=y +CONFIG_NETINIT_DHCPC=y +CONFIG_NETINIT_DNS=y +CONFIG_NETINIT_DNSIPADDR=0x08080808 +CONFIG_NETINIT_NOMAC=y +CONFIG_NET_BROADCAST=y +CONFIG_NET_ICMP=y +CONFIG_NET_ICMP_SOCKET=y +CONFIG_NET_LOOPBACK=y +CONFIG_NET_ROUTE=y +CONFIG_NET_TCP=y +CONFIG_NET_UDP=y +CONFIG_NET_UDP_CHECKSUMS=y +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_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_SPI=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_HPWORK=y +CONFIG_SCHED_LPWORK=y +CONFIG_START_DAY=9 +CONFIG_START_MONTH=2 +CONFIG_START_YEAR=2021 +CONFIG_SYSLOG_CONSOLE=y +CONFIG_SYSTEM_DHCPC_RENEW=y +CONFIG_SYSTEM_NETDB=y +CONFIG_SYSTEM_NSH=y +CONFIG_SYSTEM_NTPC=y +CONFIG_SYSTEM_PING=y +CONFIG_SYSTEM_SPITOOL=y +CONFIG_SYSTEM_SYSTEM=y +CONFIG_SYSTEM_TELNET_CLIENT=y +CONFIG_TESTING_GETPRIME=y +CONFIG_TESTING_OSTEST=y +CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_WQUEUE_NOTIFIER=y +CONFIG_WS2812_NON_SPI_DRIVER=y +CONFIG_WS2812=y +CONFIG_RP2040_BOARD_HAS_WS2812=y +CONFIG_RP2040_WS2812_GPIO_PIN=16 diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/configs/lcd1602/defconfig b/boards/arm/rp2040/adafruit-feather-rp2040/configs/lcd1602/defconfig new file mode 100644 index 0000000000..435ca6d5c8 --- /dev/null +++ b/boards/arm/rp2040/adafruit-feather-rp2040/configs/lcd1602/defconfig @@ -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_LIBC_LONG_LONG 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_STANDARD_SERIAL is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="adafruit-feather-rp2040" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ADAFRUIT_FEATHER_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_EXAMPLES_SLCD=y +CONFIG_FS_PROCFS=y +CONFIG_FS_PROCFS_REGISTER=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_LCD_BACKPACK=y +CONFIG_LCD_LCD1602=y +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_I2C0=y +CONFIG_RP2040_I2C0_GPIO=4 +CONFIG_RP2040_I2C=y +CONFIG_RP2040_I2C_DRIVER=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_WAITPID=y +CONFIG_SLCD=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_UART0_SERIAL_CONSOLE=y +CONFIG_WS2812_NON_SPI_DRIVER=y +CONFIG_WS2812=y +CONFIG_RP2040_BOARD_HAS_WS2812=y +CONFIG_RP2040_WS2812_GPIO_PIN=16 diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/configs/nsh/defconfig b/boards/arm/rp2040/adafruit-feather-rp2040/configs/nsh/defconfig new file mode 100644 index 0000000000..7549a7c342 --- /dev/null +++ b/boards/arm/rp2040/adafruit-feather-rp2040/configs/nsh/defconfig @@ -0,0 +1,53 @@ +# +# 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_LIBC_LONG_LONG 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_STANDARD_SERIAL is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="adafruit-feather-rp2040" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ADAFRUIT_FEATHER_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_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_UART0_SERIAL_CONSOLE=y +CONFIG_WS2812_NON_SPI_DRIVER=y +CONFIG_WS2812=y +CONFIG_RP2040_BOARD_HAS_WS2812=y +CONFIG_RP2040_WS2812_GPIO_PIN=16 diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/configs/nshsram/defconfig b/boards/arm/rp2040/adafruit-feather-rp2040/configs/nshsram/defconfig new file mode 100644 index 0000000000..7446d4b17d --- /dev/null +++ b/boards/arm/rp2040/adafruit-feather-rp2040/configs/nshsram/defconfig @@ -0,0 +1,53 @@ +# +# 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_LIBC_LONG_LONG 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_FLASH_BOOT is not set +# CONFIG_STANDARD_SERIAL is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="adafruit-feather-rp2040" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ADAFRUIT_FEATHER_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_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_UART0_SERIAL_CONSOLE=y +CONFIG_WS2812_NON_SPI_DRIVER=y +CONFIG_WS2812=y +CONFIG_RP2040_BOARD_HAS_WS2812=y +CONFIG_RP2040_WS2812_GPIO_PIN=16 diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/configs/smp/defconfig b/boards/arm/rp2040/adafruit-feather-rp2040/configs/smp/defconfig new file mode 100644 index 0000000000..c2252ae775 --- /dev/null +++ b/boards/arm/rp2040/adafruit-feather-rp2040/configs/smp/defconfig @@ -0,0 +1,59 @@ +# +# 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_LIBC_LONG_LONG 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_STANDARD_SERIAL is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="adafruit-feather-rp2040" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ADAFRUIT_FEATHER_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_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_UART0_SERIAL_CONSOLE=y +CONFIG_WS2812_NON_SPI_DRIVER=y +CONFIG_WS2812=y +CONFIG_RP2040_BOARD_HAS_WS2812=y +CONFIG_RP2040_WS2812_GPIO_PIN=16 diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/configs/spisd/defconfig b/boards/arm/rp2040/adafruit-feather-rp2040/configs/spisd/defconfig new file mode 100644 index 0000000000..2653253f7d --- /dev/null +++ b/boards/arm/rp2040/adafruit-feather-rp2040/configs/spisd/defconfig @@ -0,0 +1,65 @@ +# +# 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_LIBC_LONG_LONG is not set +# CONFIG_MMCSD_HAVE_CARDDETECT is not set +# CONFIG_MMCSD_HAVE_WRITEPROTECT 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_SPI_CALLBACK is not set +# CONFIG_STANDARD_SERIAL is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="adafruit-feather-rp2040" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ADAFRUIT_FEATHER_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_FAT_LCNAMES=y +CONFIG_FAT_LFN=y +CONFIG_FS_FAT=y +CONFIG_FS_PROCFS=y +CONFIG_FS_PROCFS_REGISTER=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_MMCSD=y +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_SPI0=y +CONFIG_RP2040_SPI0_GPIO=16 +CONFIG_RP2040_SPI=y +CONFIG_RP2040_SPISD=y +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_SYSTEM_SPITOOL=y +CONFIG_TESTING_GETPRIME=y +CONFIG_TESTING_OSTEST=y +CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_WS2812_NON_SPI_DRIVER=y +CONFIG_WS2812=y +CONFIG_RP2040_BOARD_HAS_WS2812=y +CONFIG_RP2040_WS2812_GPIO_PIN=16 diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/configs/ssd1306/defconfig b/boards/arm/rp2040/adafruit-feather-rp2040/configs/ssd1306/defconfig new file mode 100644 index 0000000000..6b9865cba3 --- /dev/null +++ b/boards/arm/rp2040/adafruit-feather-rp2040/configs/ssd1306/defconfig @@ -0,0 +1,80 @@ +# +# 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_EXAMPLES_NXLINES_DEFAULT_COLORS is not set +# CONFIG_FS_PROCFS_EXCLUDE_ENVIRON is not set +# CONFIG_LIBC_LONG_LONG 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_NX_DISABLE_1BPP is not set +# CONFIG_NX_PACKEDMSFIRST is not set +# CONFIG_STANDARD_SERIAL is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="adafruit-feather-rp2040" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ADAFRUIT_FEATHER_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_DISABLE_POSIX_TIMERS=y +CONFIG_EXAMPLES_HELLO=y +CONFIG_EXAMPLES_NX=y +CONFIG_EXAMPLES_NXDEMO=y +CONFIG_EXAMPLES_NXHELLO=y +CONFIG_EXAMPLES_NXHELLO_BPP=1 +CONFIG_EXAMPLES_NXLINES=y +CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=1 +CONFIG_EXAMPLES_NXLINES_BPP=1 +CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xff +CONFIG_EXAMPLES_NXLINES_LINEWIDTH=1 +CONFIG_EXAMPLES_NX_BPP=1 +CONFIG_FS_PROCFS=y +CONFIG_FS_PROCFS_REGISTER=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_LCD=y +CONFIG_LCD_DEV=y +CONFIG_LCD_FRAMEBUFFER=y +CONFIG_LCD_MAXCONTRAST=255 +CONFIG_LCD_SH1106_OLED_132=y +CONFIG_LCD_SSD1306_I2C=y +CONFIG_MQ_MAXMSGSIZE=64 +CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6 +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_READLINE=y +CONFIG_NX=y +CONFIG_NXFONTS_PACKEDMSFIRST=y +CONFIG_NXFONT_SANS20X26=y +CONFIG_NX_BLOCKING=y +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 +CONFIG_SCHED_WAITPID=y +CONFIG_START_DAY=9 +CONFIG_START_MONTH=2 +CONFIG_START_YEAR=2021 +CONFIG_SYSLOG_CONSOLE=y +CONFIG_SYSTEM_I2CTOOL=y +CONFIG_SYSTEM_NSH=y +CONFIG_TESTING_GETPRIME=y +CONFIG_TESTING_OSTEST=y +CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_WS2812_NON_SPI_DRIVER=y +CONFIG_WS2812=y +CONFIG_RP2040_BOARD_HAS_WS2812=y +CONFIG_RP2040_WS2812_GPIO_PIN=16 diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/configs/st7735/defconfig b/boards/arm/rp2040/adafruit-feather-rp2040/configs/st7735/defconfig new file mode 100644 index 0000000000..2825e248b0 --- /dev/null +++ b/boards/arm/rp2040/adafruit-feather-rp2040/configs/st7735/defconfig @@ -0,0 +1,64 @@ +# +# 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_LIBC_LONG_LONG 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_STANDARD_SERIAL is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="adafruit-feather-rp2040" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ADAFRUIT_FEATHER_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_DRIVERS_VIDEO=y +CONFIG_EXAMPLES_FB=y +CONFIG_EXAMPLES_HELLO=y +CONFIG_FS_PROCFS=y +CONFIG_FS_PROCFS_REGISTER=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_LCD=y +CONFIG_LCD_FRAMEBUFFER=y +CONFIG_LCD_PORTRAIT=y +CONFIG_LCD_ST7735=y +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_SPI1=y +CONFIG_RP2040_SPI1_GPIO=12 +CONFIG_RP2040_SPI=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_WAITPID=y +CONFIG_SPI_CMDDATA=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_UART0_SERIAL_CONSOLE=y +CONFIG_VIDEO_FB=y +CONFIG_WS2812_NON_SPI_DRIVER=y +CONFIG_WS2812=y +CONFIG_RP2040_BOARD_HAS_WS2812=y +CONFIG_RP2040_WS2812_GPIO_PIN=16 diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/configs/usbmsc/defconfig b/boards/arm/rp2040/adafruit-feather-rp2040/configs/usbmsc/defconfig new file mode 100644 index 0000000000..7080bdcae4 --- /dev/null +++ b/boards/arm/rp2040/adafruit-feather-rp2040/configs/usbmsc/defconfig @@ -0,0 +1,72 @@ +# +# 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_LIBC_LONG_LONG is not set +# CONFIG_MMCSD_HAVE_CARDDETECT is not set +# CONFIG_MMCSD_HAVE_WRITEPROTECT 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_SPI_CALLBACK is not set +# CONFIG_STANDARD_SERIAL is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="adafruit-feather-rp2040" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ADAFRUIT_FEATHER_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_DEBUG_FULLOPT=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_DISABLE_POSIX_TIMERS=y +CONFIG_EXAMPLES_HELLO=y +CONFIG_EXAMPLES_USBSERIAL=y +CONFIG_FAT_LCNAMES=y +CONFIG_FAT_LFN=y +CONFIG_FS_FAT=y +CONFIG_FS_PROCFS=y +CONFIG_FS_PROCFS_REGISTER=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_MMCSD=y +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_SPI0=y +CONFIG_RP2040_SPI0_GPIO=16 +CONFIG_RP2040_SPI=y +CONFIG_RP2040_SPISD=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_WAITPID=y +CONFIG_START_DAY=9 +CONFIG_START_MONTH=2 +CONFIG_START_YEAR=2021 +CONFIG_SYSTEM_CDCACM=y +CONFIG_SYSTEM_NSH=y +CONFIG_SYSTEM_SPITOOL=y +CONFIG_SYSTEM_USBMSC=y +CONFIG_TESTING_GETPRIME=y +CONFIG_TESTING_OSTEST=y +CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_USBDEV=y +CONFIG_USBDEV_BUSPOWERED=y +CONFIG_USBMSC=y +CONFIG_USBMSC_NOT_STALL_BULKEP=y +CONFIG_WS2812_NON_SPI_DRIVER=y +CONFIG_WS2812=y +CONFIG_RP2040_BOARD_HAS_WS2812=y +CONFIG_RP2040_WS2812_GPIO_PIN=16 diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/configs/usbnsh/defconfig b/boards/arm/rp2040/adafruit-feather-rp2040/configs/usbnsh/defconfig new file mode 100644 index 0000000000..93edaebc57 --- /dev/null +++ b/boards/arm/rp2040/adafruit-feather-rp2040/configs/usbnsh/defconfig @@ -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_DEV_CONSOLE is not set +# CONFIG_FS_PROCFS_EXCLUDE_ENVIRON is not set +# CONFIG_LIBC_LONG_LONG 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-feather-rp2040" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ADAFRUIT_FEATHER_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_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_NON_SPI_DRIVER=y +CONFIG_WS2812=y +CONFIG_RP2040_BOARD_HAS_WS2812=y +CONFIG_RP2040_WS2812_GPIO_PIN=16 diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/configs/waveshare-lcd-1.14/defconfig b/boards/arm/rp2040/adafruit-feather-rp2040/configs/waveshare-lcd-1.14/defconfig new file mode 100644 index 0000000000..a78d44f331 --- /dev/null +++ b/boards/arm/rp2040/adafruit-feather-rp2040/configs/waveshare-lcd-1.14/defconfig @@ -0,0 +1,100 @@ +# +# 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_EXAMPLES_NXLINES_DEFAULT_COLORS is not set +# CONFIG_FS_PROCFS_EXCLUDE_ENVIRON is not set +# CONFIG_LIBC_LONG_LONG 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_NXFONTS_DISABLE_16BPP is not set +# CONFIG_NX_DISABLE_16BPP is not set +# CONFIG_NX_PACKEDMSFIRST is not set +# CONFIG_NX_WRITEONLY is not set +# CONFIG_STANDARD_SERIAL is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="adafruit-feather-rp2040" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ADAFRUIT_FEATHER_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_ASSERTIONS=y +CONFIG_DEBUG_FEATURES=y +CONFIG_DEBUG_FULLOPT=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_DISABLE_POSIX_TIMERS=y +CONFIG_DRIVERS_VIDEO=y +CONFIG_EXAMPLES_FB=y +CONFIG_EXAMPLES_HELLO=y +CONFIG_EXAMPLES_NX=y +CONFIG_EXAMPLES_NXDEMO=y +CONFIG_EXAMPLES_NXDEMO_BPP=16 +CONFIG_EXAMPLES_NXHELLO=y +CONFIG_EXAMPLES_NXHELLO_BPP=16 +CONFIG_EXAMPLES_NXLINES=y +CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320 +CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0 +CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4 +CONFIG_EXAMPLES_NXLINES_BPP=16 +CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb +CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0 +CONFIG_EXAMPLES_NX_BPP=16 +CONFIG_FS_PROCFS=y +CONFIG_FS_PROCFS_REGISTER=y +CONFIG_I2C=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_LCD=y +CONFIG_LCD_DEV=y +CONFIG_LCD_FRAMEBUFFER=y +CONFIG_LCD_MAXCONTRAST=255 +CONFIG_LCD_NOGETRUN=y +CONFIG_LCD_ST7789=y +CONFIG_LCD_ST7789_FREQUENCY=64000000 +CONFIG_LCD_ST7789_XOFFSET=53 +CONFIG_LCD_ST7789_XRES=135 +CONFIG_LCD_ST7789_YOFFSET=40 +CONFIG_LCD_ST7789_YRES=240 +CONFIG_MQ_MAXMSGSIZE=64 +CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6 +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_READLINE=y +CONFIG_NX=y +CONFIG_NXFONTS_PACKEDMSFIRST=y +CONFIG_NXFONT_SANS40X49B=y +CONFIG_NX_BLOCKING=y +CONFIG_RAM_SIZE=270336 +CONFIG_RAM_START=0x20000000 +CONFIG_READLINE_CMD_HISTORY=y +CONFIG_RP2040_LCD_SPI_CH=1 +CONFIG_RP2040_SPI1=y +CONFIG_RP2040_SPI1_GPIO=8 +CONFIG_RP2040_SPI=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_WAITPID=y +CONFIG_SPI_CMDDATA=y +CONFIG_START_DAY=9 +CONFIG_START_MONTH=2 +CONFIG_START_YEAR=2021 +CONFIG_SYSLOG_CONSOLE=y +CONFIG_SYSTEM_I2CTOOL=y +CONFIG_SYSTEM_NSH=y +CONFIG_SYSTEM_SPITOOL=y +CONFIG_TESTING_GETPRIME=y +CONFIG_TESTING_OSTEST=y +CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_VIDEO_FB=y +CONFIG_WS2812_NON_SPI_DRIVER=y +CONFIG_WS2812=y +CONFIG_RP2040_BOARD_HAS_WS2812=y +CONFIG_RP2040_WS2812_GPIO_PIN=16 diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/configs/waveshare-lcd-1.3/defconfig b/boards/arm/rp2040/adafruit-feather-rp2040/configs/waveshare-lcd-1.3/defconfig new file mode 100644 index 0000000000..7f2d78de20 --- /dev/null +++ b/boards/arm/rp2040/adafruit-feather-rp2040/configs/waveshare-lcd-1.3/defconfig @@ -0,0 +1,97 @@ +# +# 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_EXAMPLES_NXLINES_DEFAULT_COLORS is not set +# CONFIG_FS_PROCFS_EXCLUDE_ENVIRON is not set +# CONFIG_LIBC_LONG_LONG 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_NXFONTS_DISABLE_16BPP is not set +# CONFIG_NX_DISABLE_16BPP is not set +# CONFIG_NX_PACKEDMSFIRST is not set +# CONFIG_NX_WRITEONLY is not set +# CONFIG_STANDARD_SERIAL is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="adafruit-feather-rp2040" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ADAFRUIT_FEATHER_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_ASSERTIONS=y +CONFIG_DEBUG_FEATURES=y +CONFIG_DEBUG_FULLOPT=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_DISABLE_POSIX_TIMERS=y +CONFIG_DRIVERS_VIDEO=y +CONFIG_EXAMPLES_FB=y +CONFIG_EXAMPLES_HELLO=y +CONFIG_EXAMPLES_NX=y +CONFIG_EXAMPLES_NXDEMO=y +CONFIG_EXAMPLES_NXDEMO_BPP=16 +CONFIG_EXAMPLES_NXHELLO=y +CONFIG_EXAMPLES_NXHELLO_BPP=16 +CONFIG_EXAMPLES_NXLINES=y +CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320 +CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0 +CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4 +CONFIG_EXAMPLES_NXLINES_BPP=16 +CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb +CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0 +CONFIG_EXAMPLES_NX_BPP=16 +CONFIG_FS_PROCFS=y +CONFIG_FS_PROCFS_REGISTER=y +CONFIG_I2C=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_LCD=y +CONFIG_LCD_DEV=y +CONFIG_LCD_FRAMEBUFFER=y +CONFIG_LCD_MAXCONTRAST=255 +CONFIG_LCD_NOGETRUN=y +CONFIG_LCD_ST7789=y +CONFIG_LCD_ST7789_FREQUENCY=64000000 +CONFIG_LCD_ST7789_YRES=240 +CONFIG_MQ_MAXMSGSIZE=64 +CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6 +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_READLINE=y +CONFIG_NX=y +CONFIG_NXFONTS_PACKEDMSFIRST=y +CONFIG_NXFONT_SANS40X49B=y +CONFIG_NX_BLOCKING=y +CONFIG_RAM_SIZE=270336 +CONFIG_RAM_START=0x20000000 +CONFIG_READLINE_CMD_HISTORY=y +CONFIG_RP2040_LCD_SPI_CH=1 +CONFIG_RP2040_SPI1=y +CONFIG_RP2040_SPI1_GPIO=8 +CONFIG_RP2040_SPI=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_WAITPID=y +CONFIG_SPI_CMDDATA=y +CONFIG_START_DAY=9 +CONFIG_START_MONTH=2 +CONFIG_START_YEAR=2021 +CONFIG_SYSLOG_CONSOLE=y +CONFIG_SYSTEM_I2CTOOL=y +CONFIG_SYSTEM_NSH=y +CONFIG_SYSTEM_SPITOOL=y +CONFIG_TESTING_GETPRIME=y +CONFIG_TESTING_OSTEST=y +CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_VIDEO_FB=y +CONFIG_WS2812_NON_SPI_DRIVER=y +CONFIG_WS2812=y +CONFIG_RP2040_BOARD_HAS_WS2812=y +CONFIG_RP2040_WS2812_GPIO_PIN=16 diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/include/board.h b/boards/arm/rp2040/adafruit-feather-rp2040/include/board.h new file mode 100644 index 0000000000..021f547ac9 --- /dev/null +++ b/boards/arm/rp2040/adafruit-feather-rp2040/include/board.h @@ -0,0 +1,116 @@ +/**************************************************************************** + * boards/arm/rp2040/adafruit-feather-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_FEATHER_INCLUDE_BOARD_H +#define __BOARDS_ARM_RP2040_ADAFRUIT_FEATHER_INCLUDE_BOARD_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include "rp2040_i2cdev.h" +#include "rp2040_spidev.h" +#include "rp2040_i2sdev.h" + +#include "rp2040_spisd.h" + +#ifndef __ASSEMBLY__ +# include +#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 *********************************************************/ + +#define BOARD_GPIO_LED_PIN 13 +#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_FEATHER_INCLUDE_BOARD_H */ diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/include/rp2040_i2cdev.h b/boards/arm/rp2040/adafruit-feather-rp2040/include/rp2040_i2cdev.h new file mode 100644 index 0000000000..90a4d238a9 --- /dev/null +++ b/boards/arm/rp2040/adafruit-feather-rp2040/include/rp2040_i2cdev.h @@ -0,0 +1,72 @@ +/**************************************************************************** + * boards/arm/rp2040/adafruit-feather-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_FEATHER_INCLUDE_RP2040_I2CDEV_H +#define __BOARDS_ARM_RP2040_ADAFRUIT_FEATHER_INCLUDE_RP2040_I2CDEV_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +/**************************************************************************** + * 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_FEATHER_INCLUDE_RP2040_I2CDEV_H */ diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/include/rp2040_i2sdev.h b/boards/arm/rp2040/adafruit-feather-rp2040/include/rp2040_i2sdev.h new file mode 100644 index 0000000000..45477a2e3e --- /dev/null +++ b/boards/arm/rp2040/adafruit-feather-rp2040/include/rp2040_i2sdev.h @@ -0,0 +1,72 @@ +/**************************************************************************** + * boards/arm/rp2040/adafruit-feather-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_FEATHER_INCLUDE_RP2040_I2SDEV_H +#define __BOARDS_ARM_RP2040_ADAFRUIT_FEATHER_INCLUDE_RP2040_I2SDEV_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +/**************************************************************************** + * 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_FEATHER_INCLUDE_RP2040_I2SDEV_H */ diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/include/rp2040_spidev.h b/boards/arm/rp2040/adafruit-feather-rp2040/include/rp2040_spidev.h new file mode 100644 index 0000000000..3f0cd0e416 --- /dev/null +++ b/boards/arm/rp2040/adafruit-feather-rp2040/include/rp2040_spidev.h @@ -0,0 +1,69 @@ +/**************************************************************************** + * boards/arm/rp2040/adafruit-feather-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_FEATHER_INCLUDE_RP2040_SPIDEV_H +#define __BOARDS_ARM_RP2040_ADAFRUIT_FEATHER_INCLUDE_RP2040_SPIDEV_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * 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_FEATHER_INCLUDE_RP2040_SPIDEV_H */ diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/include/rp2040_spisd.h b/boards/arm/rp2040/adafruit-feather-rp2040/include/rp2040_spisd.h new file mode 100644 index 0000000000..61a81c3625 --- /dev/null +++ b/boards/arm/rp2040/adafruit-feather-rp2040/include/rp2040_spisd.h @@ -0,0 +1,83 @@ +/**************************************************************************** + * boards/arm/rp2040/adafruit-feather-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_FEATHER_INCLUDE_RP2040_SPISD_H +#define __BOARDS_ARM_RP2040_ADAFRUIT_FEATHER_INCLUDE_RP2040_SPISD_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * 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_FEATHER_INCLUDE_RP2040_SPISD_H */ diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/scripts/Make.defs b/boards/arm/rp2040/adafruit-feather-rp2040/scripts/Make.defs new file mode 100644 index 0000000000..c26923d2c4 --- /dev/null +++ b/boards/arm/rp2040/adafruit-feather-rp2040/scripts/Make.defs @@ -0,0 +1,45 @@ +############################################################################ +# boards/arm/rp2040/adafruit-feather-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-feather-rp2040-flash.ld +else + LDSCRIPT = adafruit-feather-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 diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/scripts/adafruit-feather-rp2040-flash.ld b/boards/arm/rp2040/adafruit-feather-rp2040/scripts/adafruit-feather-rp2040-flash.ld new file mode 100644 index 0000000000..997c14e84d --- /dev/null +++ b/boards/arm/rp2040/adafruit-feather-rp2040/scripts/adafruit-feather-rp2040-flash.ld @@ -0,0 +1,112 @@ +/**************************************************************************** + * boards/arm/rp2040/adafruit-feather-rp2040/scripts/adafruit-feather-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 = 2048K + 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) } +} diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/scripts/adafruit-feather-rp2040-sram.ld b/boards/arm/rp2040/adafruit-feather-rp2040/scripts/adafruit-feather-rp2040-sram.ld new file mode 100644 index 0000000000..ba1b19945c --- /dev/null +++ b/boards/arm/rp2040/adafruit-feather-rp2040/scripts/adafruit-feather-rp2040-sram.ld @@ -0,0 +1,97 @@ +/**************************************************************************** + * boards/arm/rp2040/adafruit-feather-rp2040/scripts/adafruit-feather-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) } +} diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/src/Make.defs b/boards/arm/rp2040/adafruit-feather-rp2040/src/Make.defs new file mode 100644 index 0000000000..791a6121d3 --- /dev/null +++ b/boards/arm/rp2040/adafruit-feather-rp2040/src/Make.defs @@ -0,0 +1,41 @@ +############################################################################ +# boards/arm/rp2040/adafruit-feather-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) diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_appinit.c b/boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_appinit.c new file mode 100644 index 0000000000..061b006e9d --- /dev/null +++ b/boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_appinit.c @@ -0,0 +1,76 @@ +/**************************************************************************** + * boards/arm/rp2040/adafruit-feather-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 +#include + +#include + +#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 +} diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_boardinitialize.c b/boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_boardinitialize.c new file mode 100644 index 0000000000..d408fadf0e --- /dev/null +++ b/boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_boardinitialize.c @@ -0,0 +1,166 @@ +/**************************************************************************** + * boards/arm/rp2040/adafruit-feather-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 + +#include + +#include +#include + +#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 board LED pin */ + + rp2040_gpio_init(BOARD_GPIO_LED_PIN); + rp2040_gpio_setdir(BOARD_GPIO_LED_PIN, true); + rp2040_gpio_put(BOARD_GPIO_LED_PIN, true); + + /* Set default UART pin */ + +#if defined(CONFIG_RP2040_UART0) && CONFIG_RP2040_UART0_GPIO >= 0 + rp2040_gpio_set_function(CONFIG_RP2040_UART0_GPIO, + RP2040_GPIO_FUNC_UART); /* TX */ + rp2040_gpio_set_function(CONFIG_RP2040_UART0_GPIO + 1, + RP2040_GPIO_FUNC_UART); /* RX */ +#ifdef CONFIG_SERIAL_OFLOWCONTROL + rp2040_gpio_set_function(CONFIG_RP2040_UART0_GPIO + 2, + RP2040_GPIO_FUNC_UART); /* CTS */ +#endif +#ifdef CONFIG_SERIAL_IFLOWCONTROL + rp2040_gpio_set_function(CONFIG_RP2040_UART0_GPIO + 3, + 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, + RP2040_GPIO_FUNC_UART); /* TX */ + rp2040_gpio_set_function(CONFIG_RP2040_UART1_GPIO + 1, + RP2040_GPIO_FUNC_UART); /* RX */ +#ifdef CONFIG_SERIAL_OFLOWCONTROL + rp2040_gpio_set_function(CONFIG_RP2040_UART1_GPIO + 2, + RP2040_GPIO_FUNC_UART); /* CTS */ +#endif +#ifdef CONFIG_SERIAL_IFLOWCONTROL + rp2040_gpio_set_function(CONFIG_RP2040_UART1_GPIO + 3, + RP2040_GPIO_FUNC_UART); /* RTS */ +#endif +#endif +} + +/**************************************************************************** + * Name: rp2040_boardinitialize + * + * Description: + * + ****************************************************************************/ + +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, + RP2040_GPIO_FUNC_I2C); /* SDA */ + rp2040_gpio_set_function(CONFIG_RP2040_I2C0_GPIO + 1, + 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); +#endif + +#if defined(CONFIG_RP2040_I2C1) && CONFIG_RP2040_I2C1_GPIO >= 0 + rp2040_gpio_set_function(CONFIG_RP2040_I2C1_GPIO, + RP2040_GPIO_FUNC_I2C); /* SDA */ + rp2040_gpio_set_function(CONFIG_RP2040_I2C1_GPIO + 1, + 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); +#endif + + /* Set default SPI pin */ + +#if defined(CONFIG_RP2040_SPI0) && CONFIG_RP2040_SPI0_GPIO >= 0 + rp2040_gpio_set_function(CONFIG_RP2040_SPI0_GPIO, + RP2040_GPIO_FUNC_SPI); /* RX */ + rp2040_gpio_set_function(CONFIG_RP2040_SPI0_GPIO + 2, + RP2040_GPIO_FUNC_SPI); /* SCK */ + rp2040_gpio_set_function(CONFIG_RP2040_SPI0_GPIO + 3, + 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); +#endif + +#if defined(CONFIG_RP2040_SPI1) && CONFIG_RP2040_SPI1_GPIO >= 0 + rp2040_gpio_set_function(CONFIG_RP2040_SPI1_GPIO, + RP2040_GPIO_FUNC_SPI); /* RX */ + rp2040_gpio_set_function(CONFIG_RP2040_SPI1_GPIO + 2, + RP2040_GPIO_FUNC_SPI); /* SCK */ + rp2040_gpio_set_function(CONFIG_RP2040_SPI1_GPIO + 3, + 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); +#endif +} diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_bringup.c b/boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_bringup.c new file mode 100644 index 0000000000..f564f478fd --- /dev/null +++ b/boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_bringup.c @@ -0,0 +1,466 @@ +/**************************************************************************** + * boards/arm/rp2040/adafruit-feather-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 + +#include +#include + +#include + +#include + +#include "rp2040_pico.h" + +#ifdef CONFIG_LCD_BACKPACK +#include "rp2040_lcd_backpack.h" +#endif + +#ifdef CONFIG_LCD +#include +#endif + +#ifdef CONFIG_LCD_DEV +#include +#endif + +#ifdef CONFIG_VIDEO_FB +#include +#endif + +#ifdef CONFIG_SENSORS_INA219 +#include +#include "rp2040_ina219.h" +#endif + +#ifdef CONFIG_SENSORS_BMP180 +#include +#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 */ + +/**************************************************************************** + * 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_WS2812_LED_COUNT, + HAS_WHITE); +#endif + + return ret; +} diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_gpio.c b/boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_gpio.c new file mode 100644 index 0000000000..d517f9f191 --- /dev/null +++ b/boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_gpio.c @@ -0,0 +1,392 @@ +/**************************************************************************** + * boards/arm/rp2040/adafruit-feather-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 + +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include "arm_internal.h" +#include "chip.h" +#include "rp2040_gpio.h" + +#if defined(CONFIG_DEV_GPIO) && !defined(CONFIG_GPIO_LOWER_HALF) + +/* Output pins. GPIO13 is onboard LED any other outputs could be used. + */ + +#define GPIO_OUT1 13 + +/* 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 */ diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_pico.h b/boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_pico.h new file mode 100644 index 0000000000..50d2310875 --- /dev/null +++ b/boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_pico.h @@ -0,0 +1,36 @@ +/**************************************************************************** + * boards/arm/rp2040/adafruit-feather-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_FEATHER_RP2040_PICO_H +#define __BOARDS_ARM_RP2040_ADAFRUIT_FEATHER_RP2040_PICO_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +int rp2040_bringup(void); + +#ifdef CONFIG_DEV_GPIO +int rp2040_dev_gpio_init(void); +#endif + +#endif /* __BOARDS_ARM_RP2040_ADAFRUIT_FEATHER_RP2040_PICO_H */ diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_reset.c b/boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_reset.c new file mode 100644 index 0000000000..ec31a0eac8 --- /dev/null +++ b/boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_reset.c @@ -0,0 +1,61 @@ +/**************************************************************************** + * boards/arm/rp2040/adafruit-feather-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 +#include +#include + +#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 */ diff --git a/boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_spi.c b/boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_spi.c new file mode 100644 index 0000000000..f6b23acbcd --- /dev/null +++ b/boards/arm/rp2040/adafruit-feather-rp2040/src/rp2040_spi.c @@ -0,0 +1,150 @@ +/**************************************************************************** + * boards/arm/rp2040/adafruit-feather-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 + +#include +#include +#include +#include + +#include +#include + +#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_GPIO + 1, !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_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_GPIO + 1, !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_GPIO, !cmd); + + return OK; + } +#endif + + return -ENODEV; +} +#endif +#endif diff --git a/boards/arm/rp2040/adafruit-kb2040/Kconfig b/boards/arm/rp2040/adafruit-kb2040/Kconfig new file mode 100644 index 0000000000..38fd50ff06 --- /dev/null +++ b/boards/arm/rp2040/adafruit-kb2040/Kconfig @@ -0,0 +1,359 @@ +# +# 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_KB2040 + +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 "flash chip name" + default "w25q080" + ---help--- + Name of NOR flash device connected to RP2040 SoC. + (Used to choose the secondary 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. + +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 + range 0 1 + depends on LCD + ---help--- + Select SPI channel number to use LCD display. + +config RP2040_ENC28J60_SPI_CH + int "ENC28J60 SPI channel number" + default 1 + range 0 1 + depends on ENC28J60 + ---help--- + Select SPI channel number to use ENC28J60 ethernet. + +config RP2040_ENC28J60_INTR_GPIO + int "ENC28J60 interrupt GPIO pin assign" + default -1 + range -1 29 + depends on ENC28J60 + +config RP2040_ENC28J60_RESET_GPIO + int "ENC28J60 reset GPIO pin assign (optional)" + default -1 + range -1 29 + depends on ENC28J60 + +endif diff --git a/boards/arm/rp2040/adafruit-kb2040/README.txt b/boards/arm/rp2040/adafruit-kb2040/README.txt new file mode 100644 index 0000000000..3bce577003 --- /dev/null +++ b/boards/arm/rp2040/adafruit-kb2040/README.txt @@ -0,0 +1,179 @@ +README +====== + +This directory contains the port of NuttX to the Adafruit KB2040. +See https://www.adafruit.com/product/5302 for information about Adafruit KB2040. + +Currently only the following devices are supported. + + Supported: + - UART (console port) + - GPIO 0 (UART0 TX) and GPIO 1 (UART0 RX) are used for the console. + - I2C + - SPI + - DMAC + - PWM + - 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. + - BMP180 sensor at I2C0 (don't forget to define I2C0 GPIOs at "I2C0 GPIO pin assign" in Board Selection menu) + - INA219 sensor / module (don't forget to define I2C0 GPIOs at "I2C0 GPIO pin assign" in Board Selection menu) + - Pico Display Pack (ST7789 LCD) + - RGB leds and buttons are not supported yet. + - Pico Audio Pack (PCM5100A I2S DAC) + - I2S interface is realized by PIO. + + 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= + +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 0 and 1 pins must be connected to the + 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. + +- ssd1306 + SSD1306 OLED display (I2C) test configuration + Connection: + SSD1306 Raspberry Pi Pico + GND ----- GND (Pin 3 or 38 or ...) + VCC ----- 3V3 OUT (Pin 36) + SDA ----- GP4 (I2C0 SDA) (Pin 6) + SCL ----- GP5 (I2C0 SCL) (Pin 7) + +- lcd1602 + LCD 1602 Segment LCD Disaply (I2C) + Connection: + PCF8574 BackPack Raspberry Pi Pico + GND ----- GND (Pin 3 or 38 or ...) + VCC ----- 5V Vbus (Pin 40) + SDA ----- GP4 (I2C0 SDA) (Pin 6) + SCL ----- GP5 (I2C0 SCL) (Pin 7) +- spisd + SD card support (SPI connection) + Connection: + SD card slot Raspberry Pi Pico + DAT2 (NC) + DAT3/CS ----- GP17 (SPI0 CSn) (Pin 22) + CMD /DI ----- GP19 (SPI0 TX) (Pin 25) + VDD ----- 3V3 OUT (Pin 36) + CLK/SCK ----- GP18 (SPI0 SCK) (Pin 24) + VSS ----- GND (Pin 3 or 38 or ...) + DAT0/DO ----- GP16 (SPI0 RX) (Pin 21) + DAT1 (NC) + * Card hot swapping is not supported. + +- st7735 + st7735 SPI LCD support + Connection: + st7735 Raspberry Pi Pico + GND ----- GND (Pin 3 or 38 or ...) + VCC ----- 5V Vbus (Pin 40) + SDA ----- GP15 (SPI1 TX) (Pin 20) + SCK ----- GP14 (SPI1 SCK) (Pin 19) + CS ----- GP13 (SPI1 CSn) (Pin 17) + AO(D/C) ----- GP12 (SPI1 RX) (Pin 16) + BL ----- GP11 (Pin 15) + RESET ----- GP10 (Pin 14) + +- enc28j60 + ENC28J60 SPI ethernet controller support + - IP address is configured by DHCP. + - DNS address is 8.8.8.8 (CONFIG_NETINIT_DNSIPADDR) + - NTP client is enabled. + Connection: + ENC28J60 Raspberry Pi Pico + GND ----- GND (Pin 3 or 38 or ...) + 3.3 ----- 3V3 OUT (Pin 36) + SI ----- GP15 (SPI1 TX) (Pin 20) + SCK ----- GP14 (SPI1 SCK) (Pin 19) + CS ----- GP13 (SPI1 CSn) (Pin 17) + SO ----- GP12 (SPI1 RX) (Pin 16) + INT ----- GP11 (Pin 15) + RESET ----- GP10 (Pin 14) + +- displaypack + Pico Display Pack support + See the following page for connection: + https://shop.pimoroni.com/products/pico-display-pack + +- audiopack + Pico Audio Pack support + See the following page for connection: + https://shop.pimoroni.com/products/pico-audio-pack + SD card interface is also enabled. + +- usbnsh + USB CDC/ACM serial console with NuttShell + +- usbmsc + USB MSC and CDC/ACM support + `msconn` and `sercon` commands enable the MSC and CDC/ACM devices. + The MSC support provides the interface to the SD card with SPI, + so the SD card slot connection like spisd configuration is required. + +- 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. diff --git a/boards/arm/rp2040/adafruit-kb2040/configs/audiopack/defconfig b/boards/arm/rp2040/adafruit-kb2040/configs/audiopack/defconfig new file mode 100644 index 0000000000..7e2ebb7f2a --- /dev/null +++ b/boards/arm/rp2040/adafruit-kb2040/configs/audiopack/defconfig @@ -0,0 +1,76 @@ +# +# 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_AUDIO_FORMAT_MP3 is not set +# CONFIG_FS_PROCFS_EXCLUDE_ENVIRON is not set +# CONFIG_LIBC_LONG_LONG is not set +# CONFIG_MMCSD_HAVE_CARDDETECT is not set +# CONFIG_MMCSD_HAVE_WRITEPROTECT 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_NSH_DISABLE_MB is not set +# CONFIG_NSH_DISABLE_MH is not set +# CONFIG_NSH_DISABLE_MW is not set +# CONFIG_SPI_CALLBACK is not set +# CONFIG_STANDARD_SERIAL is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="adafruit-kb2040" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ADAFRUIT_KB2040=y +CONFIG_ARCH_CHIP="rp2040" +CONFIG_ARCH_CHIP_RP2040=y +CONFIG_ARCH_RAMVECTORS=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_AUDIO=y +CONFIG_AUDIO_I2S=y +CONFIG_AUDIO_I2SCHAR=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_DRIVERS_AUDIO=y +CONFIG_EXAMPLES_HELLO=y +CONFIG_FAT_LCNAMES=y +CONFIG_FAT_LFN=y +CONFIG_FS_FAT=y +CONFIG_FS_PROCFS=y +CONFIG_FS_PROCFS_REGISTER=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_MMCSD=y +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_READLINE=y +CONFIG_NXPLAYER_DEFAULT_MEDIADIR="/mnt/sd0" +CONFIG_RAM_SIZE=270336 +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 +CONFIG_SCHED_HPWORK=y +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_SYSTEM_NXPLAYER=y +CONFIG_SYSTEM_SPITOOL=y +CONFIG_TESTING_GETPRIME=y +CONFIG_TESTING_OSTEST=y +CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_WS2812_NON_SPI_DRIVER=y +CONFIG_WS2812=y +CONFIG_RP2040_BOARD_HAS_WS2812=y +CONFIG_RP2040_WS2812_GPIO_PIN=17 diff --git a/boards/arm/rp2040/adafruit-kb2040/configs/composite/defconfig b/boards/arm/rp2040/adafruit-kb2040/configs/composite/defconfig new file mode 100644 index 0000000000..a56a342c53 --- /dev/null +++ b/boards/arm/rp2040/adafruit-kb2040/configs/composite/defconfig @@ -0,0 +1,79 @@ +# +# 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_LIBC_LONG_LONG is not set +# CONFIG_MMCSD_HAVE_CARDDETECT is not set +# CONFIG_MMCSD_HAVE_WRITEPROTECT 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_SPI_CALLBACK is not set +# CONFIG_STANDARD_SERIAL is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="adafruit-kb2040" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ADAFRUIT_KB2040=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_COMPOSITE=y +CONFIG_COMPOSITE_IAD=y +CONFIG_COMPOSITE_MSFT_OS_DESCRIPTORS=y +CONFIG_COMPOSITE_PRODUCTID=0x2022 +CONFIG_COMPOSITE_SERIALSTR="12345" +CONFIG_COMPOSITE_VENDORID=0x03eb +CONFIG_DEBUG_FULLOPT=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_DISABLE_POSIX_TIMERS=y +CONFIG_EXAMPLES_HELLO=y +CONFIG_EXAMPLES_USBSERIAL=y +CONFIG_FAT_LCNAMES=y +CONFIG_FAT_LFN=y +CONFIG_FS_FAT=y +CONFIG_FS_PROCFS=y +CONFIG_FS_PROCFS_REGISTER=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_MMCSD=y +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_SPI0=y +CONFIG_RP2040_SPI0_GPIO=16 +CONFIG_RP2040_SPI=y +CONFIG_RP2040_SPISD=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_WAITPID=y +CONFIG_START_DAY=9 +CONFIG_START_MONTH=2 +CONFIG_START_YEAR=2021 +CONFIG_SYSTEM_COMPOSITE=y +CONFIG_SYSTEM_NSH=y +CONFIG_SYSTEM_SPITOOL=y +CONFIG_TESTING_GETPRIME=y +CONFIG_TESTING_OSTEST=y +CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_USBDEV=y +CONFIG_USBDEV_BUSPOWERED=y +CONFIG_USBDEV_COMPOSITE=y +CONFIG_USBMSC=y +CONFIG_USBMSC_COMPOSITE=y +CONFIG_USBMSC_NOT_STALL_BULKEP=y +CONFIG_WS2812_NON_SPI_DRIVER=y +CONFIG_WS2812=y +CONFIG_RP2040_BOARD_HAS_WS2812=y +CONFIG_RP2040_WS2812_GPIO_PIN=17 diff --git a/boards/arm/rp2040/adafruit-kb2040/configs/displaypack/defconfig b/boards/arm/rp2040/adafruit-kb2040/configs/displaypack/defconfig new file mode 100644 index 0000000000..67cbaeb460 --- /dev/null +++ b/boards/arm/rp2040/adafruit-kb2040/configs/displaypack/defconfig @@ -0,0 +1,103 @@ +# +# 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_EXAMPLES_NXLINES_DEFAULT_COLORS is not set +# CONFIG_FS_PROCFS_EXCLUDE_ENVIRON is not set +# CONFIG_LIBC_LONG_LONG 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_NXFONTS_DISABLE_16BPP is not set +# CONFIG_NX_DISABLE_16BPP is not set +# CONFIG_NX_PACKEDMSFIRST is not set +# CONFIG_NX_WRITEONLY is not set +# CONFIG_STANDARD_SERIAL is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="adafruit-kb2040" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ADAFRUIT_KB2040=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_ASSERTIONS=y +CONFIG_DEBUG_FEATURES=y +CONFIG_DEBUG_FULLOPT=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_DISABLE_POSIX_TIMERS=y +CONFIG_DRIVERS_VIDEO=y +CONFIG_EXAMPLES_FB=y +CONFIG_EXAMPLES_HELLO=y +CONFIG_EXAMPLES_NX=y +CONFIG_EXAMPLES_NXDEMO=y +CONFIG_EXAMPLES_NXDEMO_BPP=16 +CONFIG_EXAMPLES_NXHELLO=y +CONFIG_EXAMPLES_NXHELLO_BPP=16 +CONFIG_EXAMPLES_NXLINES=y +CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320 +CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0 +CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4 +CONFIG_EXAMPLES_NXLINES_BPP=16 +CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb +CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0 +CONFIG_EXAMPLES_NX_BPP=16 +CONFIG_FS_PROCFS=y +CONFIG_FS_PROCFS_REGISTER=y +CONFIG_I2C=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_LCD=y +CONFIG_LCD_DEV=y +CONFIG_LCD_FRAMEBUFFER=y +CONFIG_LCD_MAXCONTRAST=255 +CONFIG_LCD_NOGETRUN=y +CONFIG_LCD_ST7789=y +CONFIG_LCD_ST7789_FREQUENCY=64000000 +CONFIG_LCD_ST7789_XOFFSET=53 +CONFIG_LCD_ST7789_XRES=135 +CONFIG_LCD_ST7789_YOFFSET=40 +CONFIG_LCD_ST7789_YRES=240 +CONFIG_MQ_MAXMSGSIZE=64 +CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6 +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_READLINE=y +CONFIG_NSH_USBCONSOLE=y +CONFIG_NX=y +CONFIG_NXFONTS_PACKEDMSFIRST=y +CONFIG_NXFONT_SANS40X49B=y +CONFIG_NX_BLOCKING=y +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 +CONFIG_SPI_CMDDATA=y +CONFIG_START_DAY=9 +CONFIG_START_MONTH=2 +CONFIG_START_YEAR=2021 +CONFIG_SYSTEM_I2CTOOL=y +CONFIG_SYSTEM_NSH=y +CONFIG_SYSTEM_SPITOOL=y +CONFIG_TESTING_GETPRIME=y +CONFIG_TESTING_OSTEST=y +CONFIG_USBDEV=y +CONFIG_USBDEV_BUSPOWERED=y +CONFIG_VIDEO_FB=y +CONFIG_WS2812_NON_SPI_DRIVER=y +CONFIG_WS2812=y +CONFIG_RP2040_BOARD_HAS_WS2812=y +CONFIG_RP2040_WS2812_GPIO_PIN=17 diff --git a/boards/arm/rp2040/adafruit-kb2040/configs/enc28j60/defconfig b/boards/arm/rp2040/adafruit-kb2040/configs/enc28j60/defconfig new file mode 100644 index 0000000000..22f2575f01 --- /dev/null +++ b/boards/arm/rp2040/adafruit-kb2040/configs/enc28j60/defconfig @@ -0,0 +1,88 @@ +# +# 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_LIBC_LONG_LONG 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_STANDARD_SERIAL is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="adafruit-kb2040" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ADAFRUIT_KB2040=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_ZERO=y +CONFIG_DISABLE_POSIX_TIMERS=y +CONFIG_ENC28J60=y +CONFIG_EXAMPLES_HELLO=y +CONFIG_FS_PROCFS=y +CONFIG_FS_PROCFS_REGISTER=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_NET=y +CONFIG_NETDB_DNSCLIENT=y +CONFIG_NETDB_DNSSERVER_NOADDR=y +CONFIG_NETDEVICES=y +CONFIG_NETDEV_PHY_IOCTL=y +CONFIG_NETINIT_DHCPC=y +CONFIG_NETINIT_DNS=y +CONFIG_NETINIT_DNSIPADDR=0x08080808 +CONFIG_NETINIT_NOMAC=y +CONFIG_NET_BROADCAST=y +CONFIG_NET_ICMP=y +CONFIG_NET_ICMP_SOCKET=y +CONFIG_NET_LOOPBACK=y +CONFIG_NET_ROUTE=y +CONFIG_NET_TCP=y +CONFIG_NET_UDP=y +CONFIG_NET_UDP_CHECKSUMS=y +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_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_SPI=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_HPWORK=y +CONFIG_SCHED_LPWORK=y +CONFIG_START_DAY=9 +CONFIG_START_MONTH=2 +CONFIG_START_YEAR=2021 +CONFIG_SYSLOG_CONSOLE=y +CONFIG_SYSTEM_DHCPC_RENEW=y +CONFIG_SYSTEM_NETDB=y +CONFIG_SYSTEM_NSH=y +CONFIG_SYSTEM_NTPC=y +CONFIG_SYSTEM_PING=y +CONFIG_SYSTEM_SPITOOL=y +CONFIG_SYSTEM_SYSTEM=y +CONFIG_SYSTEM_TELNET_CLIENT=y +CONFIG_TESTING_GETPRIME=y +CONFIG_TESTING_OSTEST=y +CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_WQUEUE_NOTIFIER=y +CONFIG_WS2812_NON_SPI_DRIVER=y +CONFIG_WS2812=y +CONFIG_RP2040_BOARD_HAS_WS2812=y +CONFIG_RP2040_WS2812_GPIO_PIN=17 diff --git a/boards/arm/rp2040/adafruit-kb2040/configs/lcd1602/defconfig b/boards/arm/rp2040/adafruit-kb2040/configs/lcd1602/defconfig new file mode 100644 index 0000000000..b202a107ab --- /dev/null +++ b/boards/arm/rp2040/adafruit-kb2040/configs/lcd1602/defconfig @@ -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_LIBC_LONG_LONG 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_STANDARD_SERIAL is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="adafruit-kb2040" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ADAFRUIT_KB2040=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_EXAMPLES_SLCD=y +CONFIG_FS_PROCFS=y +CONFIG_FS_PROCFS_REGISTER=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_LCD_BACKPACK=y +CONFIG_LCD_LCD1602=y +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_I2C0=y +CONFIG_RP2040_I2C0_GPIO=4 +CONFIG_RP2040_I2C=y +CONFIG_RP2040_I2C_DRIVER=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_WAITPID=y +CONFIG_SLCD=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_UART0_SERIAL_CONSOLE=y +CONFIG_WS2812_NON_SPI_DRIVER=y +CONFIG_WS2812=y +CONFIG_RP2040_BOARD_HAS_WS2812=y +CONFIG_RP2040_WS2812_GPIO_PIN=17 diff --git a/boards/arm/rp2040/adafruit-kb2040/configs/nsh/defconfig b/boards/arm/rp2040/adafruit-kb2040/configs/nsh/defconfig new file mode 100644 index 0000000000..bf2ff0445b --- /dev/null +++ b/boards/arm/rp2040/adafruit-kb2040/configs/nsh/defconfig @@ -0,0 +1,53 @@ +# +# 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_LIBC_LONG_LONG 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_STANDARD_SERIAL is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="adafruit-kb2040" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ADAFRUIT_KB2040=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_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_UART0_SERIAL_CONSOLE=y +CONFIG_WS2812_NON_SPI_DRIVER=y +CONFIG_WS2812=y +CONFIG_RP2040_BOARD_HAS_WS2812=y +CONFIG_RP2040_WS2812_GPIO_PIN=17 diff --git a/boards/arm/rp2040/adafruit-kb2040/configs/nshsram/defconfig b/boards/arm/rp2040/adafruit-kb2040/configs/nshsram/defconfig new file mode 100644 index 0000000000..3d9492d7c6 --- /dev/null +++ b/boards/arm/rp2040/adafruit-kb2040/configs/nshsram/defconfig @@ -0,0 +1,53 @@ +# +# 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_LIBC_LONG_LONG 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_FLASH_BOOT is not set +# CONFIG_STANDARD_SERIAL is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="adafruit-kb2040" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ADAFRUIT_KB2040=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_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_UART0_SERIAL_CONSOLE=y +CONFIG_WS2812_NON_SPI_DRIVER=y +CONFIG_WS2812=y +CONFIG_RP2040_BOARD_HAS_WS2812=y +CONFIG_RP2040_WS2812_GPIO_PIN=17 diff --git a/boards/arm/rp2040/adafruit-kb2040/configs/smp/defconfig b/boards/arm/rp2040/adafruit-kb2040/configs/smp/defconfig new file mode 100644 index 0000000000..9d4f4f077c --- /dev/null +++ b/boards/arm/rp2040/adafruit-kb2040/configs/smp/defconfig @@ -0,0 +1,59 @@ +# +# 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_LIBC_LONG_LONG 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_STANDARD_SERIAL is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="adafruit-kb2040" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ADAFRUIT_KB2040=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_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_UART0_SERIAL_CONSOLE=y +CONFIG_WS2812_NON_SPI_DRIVER=y +CONFIG_WS2812=y +CONFIG_RP2040_BOARD_HAS_WS2812=y +CONFIG_RP2040_WS2812_GPIO_PIN=17 diff --git a/boards/arm/rp2040/adafruit-kb2040/configs/spisd/defconfig b/boards/arm/rp2040/adafruit-kb2040/configs/spisd/defconfig new file mode 100644 index 0000000000..c03329a56e --- /dev/null +++ b/boards/arm/rp2040/adafruit-kb2040/configs/spisd/defconfig @@ -0,0 +1,65 @@ +# +# 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_LIBC_LONG_LONG is not set +# CONFIG_MMCSD_HAVE_CARDDETECT is not set +# CONFIG_MMCSD_HAVE_WRITEPROTECT 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_SPI_CALLBACK is not set +# CONFIG_STANDARD_SERIAL is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="adafruit-kb2040" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ADAFRUIT_KB2040=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_FAT_LCNAMES=y +CONFIG_FAT_LFN=y +CONFIG_FS_FAT=y +CONFIG_FS_PROCFS=y +CONFIG_FS_PROCFS_REGISTER=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_MMCSD=y +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_SPI0=y +CONFIG_RP2040_SPI0_GPIO=16 +CONFIG_RP2040_SPI=y +CONFIG_RP2040_SPISD=y +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_SYSTEM_SPITOOL=y +CONFIG_TESTING_GETPRIME=y +CONFIG_TESTING_OSTEST=y +CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_WS2812_NON_SPI_DRIVER=y +CONFIG_WS2812=y +CONFIG_RP2040_BOARD_HAS_WS2812=y +CONFIG_RP2040_WS2812_GPIO_PIN=17 diff --git a/boards/arm/rp2040/adafruit-kb2040/configs/ssd1306/defconfig b/boards/arm/rp2040/adafruit-kb2040/configs/ssd1306/defconfig new file mode 100644 index 0000000000..601a632a79 --- /dev/null +++ b/boards/arm/rp2040/adafruit-kb2040/configs/ssd1306/defconfig @@ -0,0 +1,80 @@ +# +# 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_EXAMPLES_NXLINES_DEFAULT_COLORS is not set +# CONFIG_FS_PROCFS_EXCLUDE_ENVIRON is not set +# CONFIG_LIBC_LONG_LONG 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_NX_DISABLE_1BPP is not set +# CONFIG_NX_PACKEDMSFIRST is not set +# CONFIG_STANDARD_SERIAL is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="adafruit-kb2040" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ADAFRUIT_KB2040=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_DISABLE_POSIX_TIMERS=y +CONFIG_EXAMPLES_HELLO=y +CONFIG_EXAMPLES_NX=y +CONFIG_EXAMPLES_NXDEMO=y +CONFIG_EXAMPLES_NXHELLO=y +CONFIG_EXAMPLES_NXHELLO_BPP=1 +CONFIG_EXAMPLES_NXLINES=y +CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=1 +CONFIG_EXAMPLES_NXLINES_BPP=1 +CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xff +CONFIG_EXAMPLES_NXLINES_LINEWIDTH=1 +CONFIG_EXAMPLES_NX_BPP=1 +CONFIG_FS_PROCFS=y +CONFIG_FS_PROCFS_REGISTER=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_LCD=y +CONFIG_LCD_DEV=y +CONFIG_LCD_FRAMEBUFFER=y +CONFIG_LCD_MAXCONTRAST=255 +CONFIG_LCD_SH1106_OLED_132=y +CONFIG_LCD_SSD1306_I2C=y +CONFIG_MQ_MAXMSGSIZE=64 +CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6 +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_READLINE=y +CONFIG_NX=y +CONFIG_NXFONTS_PACKEDMSFIRST=y +CONFIG_NXFONT_SANS20X26=y +CONFIG_NX_BLOCKING=y +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 +CONFIG_SCHED_WAITPID=y +CONFIG_START_DAY=9 +CONFIG_START_MONTH=2 +CONFIG_START_YEAR=2021 +CONFIG_SYSLOG_CONSOLE=y +CONFIG_SYSTEM_I2CTOOL=y +CONFIG_SYSTEM_NSH=y +CONFIG_TESTING_GETPRIME=y +CONFIG_TESTING_OSTEST=y +CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_WS2812_NON_SPI_DRIVER=y +CONFIG_WS2812=y +CONFIG_RP2040_BOARD_HAS_WS2812=y +CONFIG_RP2040_WS2812_GPIO_PIN=17 diff --git a/boards/arm/rp2040/adafruit-kb2040/configs/st7735/defconfig b/boards/arm/rp2040/adafruit-kb2040/configs/st7735/defconfig new file mode 100644 index 0000000000..056db9d930 --- /dev/null +++ b/boards/arm/rp2040/adafruit-kb2040/configs/st7735/defconfig @@ -0,0 +1,64 @@ +# +# 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_LIBC_LONG_LONG 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_STANDARD_SERIAL is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="adafruit-kb2040" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ADAFRUIT_KB2040=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_DRIVERS_VIDEO=y +CONFIG_EXAMPLES_FB=y +CONFIG_EXAMPLES_HELLO=y +CONFIG_FS_PROCFS=y +CONFIG_FS_PROCFS_REGISTER=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_LCD=y +CONFIG_LCD_FRAMEBUFFER=y +CONFIG_LCD_PORTRAIT=y +CONFIG_LCD_ST7735=y +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_SPI1=y +CONFIG_RP2040_SPI1_GPIO=12 +CONFIG_RP2040_SPI=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_WAITPID=y +CONFIG_SPI_CMDDATA=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_UART0_SERIAL_CONSOLE=y +CONFIG_VIDEO_FB=y +CONFIG_WS2812_NON_SPI_DRIVER=y +CONFIG_WS2812=y +CONFIG_RP2040_BOARD_HAS_WS2812=y +CONFIG_RP2040_WS2812_GPIO_PIN=17 diff --git a/boards/arm/rp2040/adafruit-kb2040/configs/usbmsc/defconfig b/boards/arm/rp2040/adafruit-kb2040/configs/usbmsc/defconfig new file mode 100644 index 0000000000..380402f485 --- /dev/null +++ b/boards/arm/rp2040/adafruit-kb2040/configs/usbmsc/defconfig @@ -0,0 +1,72 @@ +# +# 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_LIBC_LONG_LONG is not set +# CONFIG_MMCSD_HAVE_CARDDETECT is not set +# CONFIG_MMCSD_HAVE_WRITEPROTECT 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_SPI_CALLBACK is not set +# CONFIG_STANDARD_SERIAL is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="adafruit-kb2040" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ADAFRUIT_KB2040=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_DEBUG_FULLOPT=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_DISABLE_POSIX_TIMERS=y +CONFIG_EXAMPLES_HELLO=y +CONFIG_EXAMPLES_USBSERIAL=y +CONFIG_FAT_LCNAMES=y +CONFIG_FAT_LFN=y +CONFIG_FS_FAT=y +CONFIG_FS_PROCFS=y +CONFIG_FS_PROCFS_REGISTER=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_MMCSD=y +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_SPI0=y +CONFIG_RP2040_SPI0_GPIO=16 +CONFIG_RP2040_SPI=y +CONFIG_RP2040_SPISD=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_WAITPID=y +CONFIG_START_DAY=9 +CONFIG_START_MONTH=2 +CONFIG_START_YEAR=2021 +CONFIG_SYSTEM_CDCACM=y +CONFIG_SYSTEM_NSH=y +CONFIG_SYSTEM_SPITOOL=y +CONFIG_SYSTEM_USBMSC=y +CONFIG_TESTING_GETPRIME=y +CONFIG_TESTING_OSTEST=y +CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_USBDEV=y +CONFIG_USBDEV_BUSPOWERED=y +CONFIG_USBMSC=y +CONFIG_USBMSC_NOT_STALL_BULKEP=y +CONFIG_WS2812_NON_SPI_DRIVER=y +CONFIG_WS2812=y +CONFIG_RP2040_BOARD_HAS_WS2812=y +CONFIG_RP2040_WS2812_GPIO_PIN=17 diff --git a/boards/arm/rp2040/adafruit-kb2040/configs/usbnsh/defconfig b/boards/arm/rp2040/adafruit-kb2040/configs/usbnsh/defconfig new file mode 100644 index 0000000000..ff7fd3c300 --- /dev/null +++ b/boards/arm/rp2040/adafruit-kb2040/configs/usbnsh/defconfig @@ -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_DEV_CONSOLE is not set +# CONFIG_FS_PROCFS_EXCLUDE_ENVIRON is not set +# CONFIG_LIBC_LONG_LONG 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-kb2040" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ADAFRUIT_KB2040=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_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_NON_SPI_DRIVER=y +CONFIG_WS2812=y +CONFIG_RP2040_BOARD_HAS_WS2812=y +CONFIG_RP2040_WS2812_GPIO_PIN=17 diff --git a/boards/arm/rp2040/adafruit-kb2040/configs/waveshare-lcd-1.14/defconfig b/boards/arm/rp2040/adafruit-kb2040/configs/waveshare-lcd-1.14/defconfig new file mode 100644 index 0000000000..2a7b8e7248 --- /dev/null +++ b/boards/arm/rp2040/adafruit-kb2040/configs/waveshare-lcd-1.14/defconfig @@ -0,0 +1,100 @@ +# +# 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_EXAMPLES_NXLINES_DEFAULT_COLORS is not set +# CONFIG_FS_PROCFS_EXCLUDE_ENVIRON is not set +# CONFIG_LIBC_LONG_LONG 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_NXFONTS_DISABLE_16BPP is not set +# CONFIG_NX_DISABLE_16BPP is not set +# CONFIG_NX_PACKEDMSFIRST is not set +# CONFIG_NX_WRITEONLY is not set +# CONFIG_STANDARD_SERIAL is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="adafruit-kb2040" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ADAFRUIT_KB2040=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_ASSERTIONS=y +CONFIG_DEBUG_FEATURES=y +CONFIG_DEBUG_FULLOPT=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_DISABLE_POSIX_TIMERS=y +CONFIG_DRIVERS_VIDEO=y +CONFIG_EXAMPLES_FB=y +CONFIG_EXAMPLES_HELLO=y +CONFIG_EXAMPLES_NX=y +CONFIG_EXAMPLES_NXDEMO=y +CONFIG_EXAMPLES_NXDEMO_BPP=16 +CONFIG_EXAMPLES_NXHELLO=y +CONFIG_EXAMPLES_NXHELLO_BPP=16 +CONFIG_EXAMPLES_NXLINES=y +CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320 +CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0 +CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4 +CONFIG_EXAMPLES_NXLINES_BPP=16 +CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb +CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0 +CONFIG_EXAMPLES_NX_BPP=16 +CONFIG_FS_PROCFS=y +CONFIG_FS_PROCFS_REGISTER=y +CONFIG_I2C=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_LCD=y +CONFIG_LCD_DEV=y +CONFIG_LCD_FRAMEBUFFER=y +CONFIG_LCD_MAXCONTRAST=255 +CONFIG_LCD_NOGETRUN=y +CONFIG_LCD_ST7789=y +CONFIG_LCD_ST7789_FREQUENCY=64000000 +CONFIG_LCD_ST7789_XOFFSET=53 +CONFIG_LCD_ST7789_XRES=135 +CONFIG_LCD_ST7789_YOFFSET=40 +CONFIG_LCD_ST7789_YRES=240 +CONFIG_MQ_MAXMSGSIZE=64 +CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6 +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_READLINE=y +CONFIG_NX=y +CONFIG_NXFONTS_PACKEDMSFIRST=y +CONFIG_NXFONT_SANS40X49B=y +CONFIG_NX_BLOCKING=y +CONFIG_RAM_SIZE=270336 +CONFIG_RAM_START=0x20000000 +CONFIG_READLINE_CMD_HISTORY=y +CONFIG_RP2040_LCD_SPI_CH=1 +CONFIG_RP2040_SPI1=y +CONFIG_RP2040_SPI1_GPIO=8 +CONFIG_RP2040_SPI=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_WAITPID=y +CONFIG_SPI_CMDDATA=y +CONFIG_START_DAY=9 +CONFIG_START_MONTH=2 +CONFIG_START_YEAR=2021 +CONFIG_SYSLOG_CONSOLE=y +CONFIG_SYSTEM_I2CTOOL=y +CONFIG_SYSTEM_NSH=y +CONFIG_SYSTEM_SPITOOL=y +CONFIG_TESTING_GETPRIME=y +CONFIG_TESTING_OSTEST=y +CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_VIDEO_FB=y +CONFIG_WS2812_NON_SPI_DRIVER=y +CONFIG_WS2812=y +CONFIG_RP2040_BOARD_HAS_WS2812=y +CONFIG_RP2040_WS2812_GPIO_PIN=17 diff --git a/boards/arm/rp2040/adafruit-kb2040/configs/waveshare-lcd-1.3/defconfig b/boards/arm/rp2040/adafruit-kb2040/configs/waveshare-lcd-1.3/defconfig new file mode 100644 index 0000000000..bfffde1ad1 --- /dev/null +++ b/boards/arm/rp2040/adafruit-kb2040/configs/waveshare-lcd-1.3/defconfig @@ -0,0 +1,97 @@ +# +# 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_EXAMPLES_NXLINES_DEFAULT_COLORS is not set +# CONFIG_FS_PROCFS_EXCLUDE_ENVIRON is not set +# CONFIG_LIBC_LONG_LONG 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_NXFONTS_DISABLE_16BPP is not set +# CONFIG_NX_DISABLE_16BPP is not set +# CONFIG_NX_PACKEDMSFIRST is not set +# CONFIG_NX_WRITEONLY is not set +# CONFIG_STANDARD_SERIAL is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="adafruit-kb2040" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ADAFRUIT_KB2040=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_ASSERTIONS=y +CONFIG_DEBUG_FEATURES=y +CONFIG_DEBUG_FULLOPT=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_DISABLE_POSIX_TIMERS=y +CONFIG_DRIVERS_VIDEO=y +CONFIG_EXAMPLES_FB=y +CONFIG_EXAMPLES_HELLO=y +CONFIG_EXAMPLES_NX=y +CONFIG_EXAMPLES_NXDEMO=y +CONFIG_EXAMPLES_NXDEMO_BPP=16 +CONFIG_EXAMPLES_NXHELLO=y +CONFIG_EXAMPLES_NXHELLO_BPP=16 +CONFIG_EXAMPLES_NXLINES=y +CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320 +CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0 +CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4 +CONFIG_EXAMPLES_NXLINES_BPP=16 +CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb +CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0 +CONFIG_EXAMPLES_NX_BPP=16 +CONFIG_FS_PROCFS=y +CONFIG_FS_PROCFS_REGISTER=y +CONFIG_I2C=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_LCD=y +CONFIG_LCD_DEV=y +CONFIG_LCD_FRAMEBUFFER=y +CONFIG_LCD_MAXCONTRAST=255 +CONFIG_LCD_NOGETRUN=y +CONFIG_LCD_ST7789=y +CONFIG_LCD_ST7789_FREQUENCY=64000000 +CONFIG_LCD_ST7789_YRES=240 +CONFIG_MQ_MAXMSGSIZE=64 +CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6 +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_READLINE=y +CONFIG_NX=y +CONFIG_NXFONTS_PACKEDMSFIRST=y +CONFIG_NXFONT_SANS40X49B=y +CONFIG_NX_BLOCKING=y +CONFIG_RAM_SIZE=270336 +CONFIG_RAM_START=0x20000000 +CONFIG_READLINE_CMD_HISTORY=y +CONFIG_RP2040_LCD_SPI_CH=1 +CONFIG_RP2040_SPI1=y +CONFIG_RP2040_SPI1_GPIO=8 +CONFIG_RP2040_SPI=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_WAITPID=y +CONFIG_SPI_CMDDATA=y +CONFIG_START_DAY=9 +CONFIG_START_MONTH=2 +CONFIG_START_YEAR=2021 +CONFIG_SYSLOG_CONSOLE=y +CONFIG_SYSTEM_I2CTOOL=y +CONFIG_SYSTEM_NSH=y +CONFIG_SYSTEM_SPITOOL=y +CONFIG_TESTING_GETPRIME=y +CONFIG_TESTING_OSTEST=y +CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_VIDEO_FB=y +CONFIG_WS2812_NON_SPI_DRIVER=y +CONFIG_WS2812=y +CONFIG_RP2040_BOARD_HAS_WS2812=y +CONFIG_RP2040_WS2812_GPIO_PIN=17 diff --git a/boards/arm/rp2040/adafruit-kb2040/include/board.h b/boards/arm/rp2040/adafruit-kb2040/include/board.h new file mode 100644 index 0000000000..8caa301931 --- /dev/null +++ b/boards/arm/rp2040/adafruit-kb2040/include/board.h @@ -0,0 +1,116 @@ +/**************************************************************************** + * boards/arm/rp2040/adafruit-kb2040/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_KB2040_INCLUDE_BOARD_H +#define __BOARDS_ARM_RP2040_ADAFRUIT_KB2040_INCLUDE_BOARD_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include "rp2040_i2cdev.h" +#include "rp2040_spidev.h" +#include "rp2040_i2sdev.h" + +#include "rp2040_spisd.h" + +#ifndef __ASSEMBLY__ +# include +#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_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_KB2040_INCLUDE_BOARD_H */ diff --git a/boards/arm/rp2040/adafruit-kb2040/include/rp2040_i2cdev.h b/boards/arm/rp2040/adafruit-kb2040/include/rp2040_i2cdev.h new file mode 100644 index 0000000000..b0de2289ef --- /dev/null +++ b/boards/arm/rp2040/adafruit-kb2040/include/rp2040_i2cdev.h @@ -0,0 +1,72 @@ +/**************************************************************************** + * boards/arm/rp2040/adafruit-kb2040/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_KB2040_INCLUDE_RP2040_I2CDEV_H +#define __BOARDS_ARM_RP2040_ADAFRUIT_KB2040_INCLUDE_RP2040_I2CDEV_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +/**************************************************************************** + * 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_KB2040_INCLUDE_RP2040_I2CDEV_H */ diff --git a/boards/arm/rp2040/adafruit-kb2040/include/rp2040_i2sdev.h b/boards/arm/rp2040/adafruit-kb2040/include/rp2040_i2sdev.h new file mode 100644 index 0000000000..a2e38eb54c --- /dev/null +++ b/boards/arm/rp2040/adafruit-kb2040/include/rp2040_i2sdev.h @@ -0,0 +1,72 @@ +/**************************************************************************** + * boards/arm/rp2040/adafruit-kb2040/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_KB2040_INCLUDE_RP2040_I2SDEV_H +#define __BOARDS_ARM_RP2040_ADAFRUIT_KB2040_INCLUDE_RP2040_I2SDEV_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +/**************************************************************************** + * 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_KB2040_INCLUDE_RP2040_I2SDEV_H */ diff --git a/boards/arm/rp2040/adafruit-kb2040/include/rp2040_spidev.h b/boards/arm/rp2040/adafruit-kb2040/include/rp2040_spidev.h new file mode 100644 index 0000000000..71b9b98d8d --- /dev/null +++ b/boards/arm/rp2040/adafruit-kb2040/include/rp2040_spidev.h @@ -0,0 +1,69 @@ +/**************************************************************************** + * boards/arm/rp2040/adafruit-kb2040/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_KB2040_INCLUDE_RP2040_SPIDEV_H +#define __BOARDS_ARM_RP2040_ADAFRUIT_KB2040_INCLUDE_RP2040_SPIDEV_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * 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_KB2040_INCLUDE_RP2040_SPIDEV_H */ diff --git a/boards/arm/rp2040/adafruit-kb2040/include/rp2040_spisd.h b/boards/arm/rp2040/adafruit-kb2040/include/rp2040_spisd.h new file mode 100644 index 0000000000..93b7d604b1 --- /dev/null +++ b/boards/arm/rp2040/adafruit-kb2040/include/rp2040_spisd.h @@ -0,0 +1,83 @@ +/**************************************************************************** + * boards/arm/rp2040/adafruit-kb2040/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_KB2040_INCLUDE_RP2040_SPISD_H +#define __BOARDS_ARM_RP2040_ADAFRUIT_KB2040_INCLUDE_RP2040_SPISD_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * 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_KB2040_INCLUDE_RP2040_SPISD_H */ diff --git a/boards/arm/rp2040/adafruit-kb2040/scripts/Make.defs b/boards/arm/rp2040/adafruit-kb2040/scripts/Make.defs new file mode 100644 index 0000000000..ac0d91da6f --- /dev/null +++ b/boards/arm/rp2040/adafruit-kb2040/scripts/Make.defs @@ -0,0 +1,45 @@ +############################################################################ +# boards/arm/rp2040/adafruit-kb2040/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-kb2040-flash.ld +else + LDSCRIPT = adafruit-kb2040-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 diff --git a/boards/arm/rp2040/adafruit-kb2040/scripts/adafruit-kb2040-flash.ld b/boards/arm/rp2040/adafruit-kb2040/scripts/adafruit-kb2040-flash.ld new file mode 100644 index 0000000000..4d7719c423 --- /dev/null +++ b/boards/arm/rp2040/adafruit-kb2040/scripts/adafruit-kb2040-flash.ld @@ -0,0 +1,112 @@ +/**************************************************************************** + * boards/arm/rp2040/adafruit-kb2040/scripts/adafruit-kb2040-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 = 2048K + 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) } +} diff --git a/boards/arm/rp2040/adafruit-kb2040/scripts/adafruit-kb2040-sram.ld b/boards/arm/rp2040/adafruit-kb2040/scripts/adafruit-kb2040-sram.ld new file mode 100644 index 0000000000..b350bfb5f1 --- /dev/null +++ b/boards/arm/rp2040/adafruit-kb2040/scripts/adafruit-kb2040-sram.ld @@ -0,0 +1,97 @@ +/**************************************************************************** + * boards/arm/rp2040/adafruit-kb2040/scripts/adafruit-kb2040-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) } +} diff --git a/boards/arm/rp2040/adafruit-kb2040/src/Make.defs b/boards/arm/rp2040/adafruit-kb2040/src/Make.defs new file mode 100644 index 0000000000..32bfae6857 --- /dev/null +++ b/boards/arm/rp2040/adafruit-kb2040/src/Make.defs @@ -0,0 +1,41 @@ +############################################################################ +# boards/arm/rp2040/adafruit-kb2040/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) diff --git a/boards/arm/rp2040/adafruit-kb2040/src/rp2040_appinit.c b/boards/arm/rp2040/adafruit-kb2040/src/rp2040_appinit.c new file mode 100644 index 0000000000..92e96ec43f --- /dev/null +++ b/boards/arm/rp2040/adafruit-kb2040/src/rp2040_appinit.c @@ -0,0 +1,76 @@ +/**************************************************************************** + * boards/arm/rp2040/adafruit-kb2040/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 +#include + +#include + +#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 +} diff --git a/boards/arm/rp2040/adafruit-kb2040/src/rp2040_boardinitialize.c b/boards/arm/rp2040/adafruit-kb2040/src/rp2040_boardinitialize.c new file mode 100644 index 0000000000..09d4b315bb --- /dev/null +++ b/boards/arm/rp2040/adafruit-kb2040/src/rp2040_boardinitialize.c @@ -0,0 +1,160 @@ +/**************************************************************************** + * boards/arm/rp2040/adafruit-kb2040/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 + +#include + +#include +#include + +#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 */ + +#if defined(CONFIG_RP2040_UART0) && CONFIG_RP2040_UART0_GPIO >= 0 + rp2040_gpio_set_function(CONFIG_RP2040_UART0_GPIO, + RP2040_GPIO_FUNC_UART); /* TX */ + rp2040_gpio_set_function(CONFIG_RP2040_UART0_GPIO + 1, + RP2040_GPIO_FUNC_UART); /* RX */ +#ifdef CONFIG_SERIAL_OFLOWCONTROL + rp2040_gpio_set_function(CONFIG_RP2040_UART0_GPIO + 2, + RP2040_GPIO_FUNC_UART); /* CTS */ +#endif +#ifdef CONFIG_SERIAL_IFLOWCONTROL + rp2040_gpio_set_function(CONFIG_RP2040_UART0_GPIO + 3, + 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, + RP2040_GPIO_FUNC_UART); /* TX */ + rp2040_gpio_set_function(CONFIG_RP2040_UART1_GPIO + 1, + RP2040_GPIO_FUNC_UART); /* RX */ +#ifdef CONFIG_SERIAL_OFLOWCONTROL + rp2040_gpio_set_function(CONFIG_RP2040_UART1_GPIO + 2, + RP2040_GPIO_FUNC_UART); /* CTS */ +#endif +#ifdef CONFIG_SERIAL_IFLOWCONTROL + rp2040_gpio_set_function(CONFIG_RP2040_UART1_GPIO + 3, + RP2040_GPIO_FUNC_UART); /* RTS */ +#endif +#endif +} + +/**************************************************************************** + * Name: rp2040_boardinitialize + * + * Description: + * + ****************************************************************************/ + +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, + RP2040_GPIO_FUNC_I2C); /* SDA */ + rp2040_gpio_set_function(CONFIG_RP2040_I2C0_GPIO + 1, + 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); +#endif + +#if defined(CONFIG_RP2040_I2C1) && CONFIG_RP2040_I2C1_GPIO >= 0 + rp2040_gpio_set_function(CONFIG_RP2040_I2C1_GPIO, + RP2040_GPIO_FUNC_I2C); /* SDA */ + rp2040_gpio_set_function(CONFIG_RP2040_I2C1_GPIO + 1, + 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); +#endif + + /* Set default SPI pin */ + +#if defined(CONFIG_RP2040_SPI0) && CONFIG_RP2040_SPI0_GPIO >= 0 + rp2040_gpio_set_function(CONFIG_RP2040_SPI0_GPIO, + RP2040_GPIO_FUNC_SPI); /* RX */ + rp2040_gpio_set_function(CONFIG_RP2040_SPI0_GPIO + 2, + RP2040_GPIO_FUNC_SPI); /* SCK */ + rp2040_gpio_set_function(CONFIG_RP2040_SPI0_GPIO + 3, + 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); +#endif + +#if defined(CONFIG_RP2040_SPI1) && CONFIG_RP2040_SPI1_GPIO >= 0 + rp2040_gpio_set_function(CONFIG_RP2040_SPI1_GPIO, + RP2040_GPIO_FUNC_SPI); /* RX */ + rp2040_gpio_set_function(CONFIG_RP2040_SPI1_GPIO + 2, + RP2040_GPIO_FUNC_SPI); /* SCK */ + rp2040_gpio_set_function(CONFIG_RP2040_SPI1_GPIO + 3, + 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); +#endif +} diff --git a/boards/arm/rp2040/adafruit-kb2040/src/rp2040_bringup.c b/boards/arm/rp2040/adafruit-kb2040/src/rp2040_bringup.c new file mode 100644 index 0000000000..2ea4c442ff --- /dev/null +++ b/boards/arm/rp2040/adafruit-kb2040/src/rp2040_bringup.c @@ -0,0 +1,466 @@ +/**************************************************************************** + * boards/arm/rp2040/adafruit-kb2040/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 + +#include +#include + +#include + +#include + +#include "rp2040_pico.h" + +#ifdef CONFIG_LCD_BACKPACK +#include "rp2040_lcd_backpack.h" +#endif + +#ifdef CONFIG_LCD +#include +#endif + +#ifdef CONFIG_LCD_DEV +#include +#endif + +#ifdef CONFIG_VIDEO_FB +#include +#endif + +#ifdef CONFIG_SENSORS_INA219 +#include +#include "rp2040_ina219.h" +#endif + +#ifdef CONFIG_SENSORS_BMP180 +#include +#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 */ + +/**************************************************************************** + * 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_WS2812_LED_COUNT, + HAS_WHITE); +#endif + + return ret; +} diff --git a/boards/arm/rp2040/adafruit-kb2040/src/rp2040_gpio.c b/boards/arm/rp2040/adafruit-kb2040/src/rp2040_gpio.c new file mode 100644 index 0000000000..fc7703b9d3 --- /dev/null +++ b/boards/arm/rp2040/adafruit-kb2040/src/rp2040_gpio.c @@ -0,0 +1,392 @@ +/**************************************************************************** + * boards/arm/rp2040/adafruit-kb2040/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 + +#include +#include +#include +#include +#include +#include + +#include + +#include + +#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 */ diff --git a/boards/arm/rp2040/adafruit-kb2040/src/rp2040_pico.h b/boards/arm/rp2040/adafruit-kb2040/src/rp2040_pico.h new file mode 100644 index 0000000000..895f105733 --- /dev/null +++ b/boards/arm/rp2040/adafruit-kb2040/src/rp2040_pico.h @@ -0,0 +1,36 @@ +/**************************************************************************** + * boards/arm/rp2040/adafruit-kb2040/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 + +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 */ diff --git a/boards/arm/rp2040/adafruit-kb2040/src/rp2040_reset.c b/boards/arm/rp2040/adafruit-kb2040/src/rp2040_reset.c new file mode 100644 index 0000000000..59160ff748 --- /dev/null +++ b/boards/arm/rp2040/adafruit-kb2040/src/rp2040_reset.c @@ -0,0 +1,61 @@ +/**************************************************************************** + * boards/arm/rp2040/adafruit-kb2040/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 +#include +#include + +#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 */ diff --git a/boards/arm/rp2040/adafruit-kb2040/src/rp2040_spi.c b/boards/arm/rp2040/adafruit-kb2040/src/rp2040_spi.c new file mode 100644 index 0000000000..242305bf6d --- /dev/null +++ b/boards/arm/rp2040/adafruit-kb2040/src/rp2040_spi.c @@ -0,0 +1,150 @@ +/**************************************************************************** + * boards/arm/rp2040/adafruit-kb2040/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 + +#include +#include +#include +#include + +#include +#include + +#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_GPIO + 1, !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_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_GPIO + 1, !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_GPIO, !cmd); + + return OK; + } +#endif + + return -ENODEV; +} +#endif +#endif diff --git a/boards/arm/rp2040/common/src/rp2040_pwmdev.c b/boards/arm/rp2040/common/src/rp2040_pwmdev.c index 902c75418c..21dfce7d74 100644 --- a/boards/arm/rp2040/common/src/rp2040_pwmdev.c +++ b/boards/arm/rp2040/common/src/rp2040_pwmdev.c @@ -37,7 +37,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: board_pwmdev_initialize + * Name: rp2040_pwmdev_initialize * * Description: * Initialize and register spi driver for the specified pwm port diff --git a/boards/arm/rp2040/pimoroni-tiny2040/configs/composite/defconfig b/boards/arm/rp2040/pimoroni-tiny2040/configs/composite/defconfig index 573206543a..69ca44c4aa 100644 --- a/boards/arm/rp2040/pimoroni-tiny2040/configs/composite/defconfig +++ b/boards/arm/rp2040/pimoroni-tiny2040/configs/composite/defconfig @@ -73,3 +73,4 @@ CONFIG_USBDEV_COMPOSITE=y CONFIG_USBMSC=y CONFIG_USBMSC_COMPOSITE=y CONFIG_USBMSC_NOT_STALL_BULKEP=y +CONFIG_WS2812_NON_SPI_DRIVER=y diff --git a/boards/arm/rp2040/pimoroni-tiny2040/configs/gpio/defconfig b/boards/arm/rp2040/pimoroni-tiny2040/configs/gpio/defconfig index a25898b337..7d9cc0dc26 100644 --- a/boards/arm/rp2040/pimoroni-tiny2040/configs/gpio/defconfig +++ b/boards/arm/rp2040/pimoroni-tiny2040/configs/gpio/defconfig @@ -49,3 +49,4 @@ CONFIG_SYSTEM_NSH=y CONFIG_TESTING_GETPRIME=y CONFIG_TESTING_OSTEST=y CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_WS2812_NON_SPI_DRIVER=y diff --git a/boards/arm/rp2040/pimoroni-tiny2040/configs/nsh/defconfig b/boards/arm/rp2040/pimoroni-tiny2040/configs/nsh/defconfig index 3630991fa0..1fe47c2d58 100644 --- a/boards/arm/rp2040/pimoroni-tiny2040/configs/nsh/defconfig +++ b/boards/arm/rp2040/pimoroni-tiny2040/configs/nsh/defconfig @@ -49,3 +49,4 @@ CONFIG_SYSTEM_NSH=y CONFIG_TESTING_GETPRIME=y CONFIG_TESTING_OSTEST=y CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_WS2812_NON_SPI_DRIVER=y diff --git a/boards/arm/rp2040/pimoroni-tiny2040/configs/nshsram/defconfig b/boards/arm/rp2040/pimoroni-tiny2040/configs/nshsram/defconfig index 99dbb282a9..af64bf2dfc 100644 --- a/boards/arm/rp2040/pimoroni-tiny2040/configs/nshsram/defconfig +++ b/boards/arm/rp2040/pimoroni-tiny2040/configs/nshsram/defconfig @@ -47,3 +47,4 @@ CONFIG_SYSTEM_NSH=y CONFIG_TESTING_GETPRIME=y CONFIG_TESTING_OSTEST=y CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_WS2812_NON_SPI_DRIVER=y diff --git a/boards/arm/rp2040/pimoroni-tiny2040/configs/smp/defconfig b/boards/arm/rp2040/pimoroni-tiny2040/configs/smp/defconfig index 235ce75b96..71cf234cc3 100644 --- a/boards/arm/rp2040/pimoroni-tiny2040/configs/smp/defconfig +++ b/boards/arm/rp2040/pimoroni-tiny2040/configs/smp/defconfig @@ -53,3 +53,4 @@ CONFIG_TESTING_GETPRIME=y CONFIG_TESTING_OSTEST=y CONFIG_TESTING_SMP=y CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_WS2812_NON_SPI_DRIVER=y diff --git a/boards/arm/rp2040/pimoroni-tiny2040/configs/spisd/defconfig b/boards/arm/rp2040/pimoroni-tiny2040/configs/spisd/defconfig index de1e4d5a48..21efdfd143 100644 --- a/boards/arm/rp2040/pimoroni-tiny2040/configs/spisd/defconfig +++ b/boards/arm/rp2040/pimoroni-tiny2040/configs/spisd/defconfig @@ -59,3 +59,4 @@ CONFIG_SYSTEM_SPITOOL=y CONFIG_TESTING_GETPRIME=y CONFIG_TESTING_OSTEST=y CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_WS2812_NON_SPI_DRIVER=y diff --git a/boards/arm/rp2040/pimoroni-tiny2040/configs/usbmsc/defconfig b/boards/arm/rp2040/pimoroni-tiny2040/configs/usbmsc/defconfig index 57cddbec76..f40550f67a 100644 --- a/boards/arm/rp2040/pimoroni-tiny2040/configs/usbmsc/defconfig +++ b/boards/arm/rp2040/pimoroni-tiny2040/configs/usbmsc/defconfig @@ -66,3 +66,4 @@ CONFIG_USBDEV=y CONFIG_USBDEV_BUSPOWERED=y CONFIG_USBMSC=y CONFIG_USBMSC_NOT_STALL_BULKEP=y +CONFIG_WS2812_NON_SPI_DRIVER=y diff --git a/boards/arm/rp2040/pimoroni-tiny2040/configs/usbnsh/defconfig b/boards/arm/rp2040/pimoroni-tiny2040/configs/usbnsh/defconfig index d1af1ca2e9..3b6a733fe7 100644 --- a/boards/arm/rp2040/pimoroni-tiny2040/configs/usbnsh/defconfig +++ b/boards/arm/rp2040/pimoroni-tiny2040/configs/usbnsh/defconfig @@ -51,3 +51,4 @@ CONFIG_TESTING_GETPRIME=y CONFIG_TESTING_OSTEST=y CONFIG_USBDEV=y CONFIG_USBDEV_BUSPOWERED=y +CONFIG_WS2812_NON_SPI_DRIVER=y diff --git a/boards/arm/rp2040/raspberrypi-pico/configs/audiopack/defconfig b/boards/arm/rp2040/raspberrypi-pico/configs/audiopack/defconfig index 41d32edef7..30d8cd5445 100644 --- a/boards/arm/rp2040/raspberrypi-pico/configs/audiopack/defconfig +++ b/boards/arm/rp2040/raspberrypi-pico/configs/audiopack/defconfig @@ -70,3 +70,4 @@ CONFIG_SYSTEM_SPITOOL=y CONFIG_TESTING_GETPRIME=y CONFIG_TESTING_OSTEST=y CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_WS2812_NON_SPI_DRIVER=y diff --git a/boards/arm/rp2040/raspberrypi-pico/configs/composite/defconfig b/boards/arm/rp2040/raspberrypi-pico/configs/composite/defconfig index 38484216bc..400549c4d9 100644 --- a/boards/arm/rp2040/raspberrypi-pico/configs/composite/defconfig +++ b/boards/arm/rp2040/raspberrypi-pico/configs/composite/defconfig @@ -73,3 +73,4 @@ CONFIG_USBDEV_COMPOSITE=y CONFIG_USBMSC=y CONFIG_USBMSC_COMPOSITE=y CONFIG_USBMSC_NOT_STALL_BULKEP=y +CONFIG_WS2812_NON_SPI_DRIVER=y diff --git a/boards/arm/rp2040/raspberrypi-pico/configs/displaypack/defconfig b/boards/arm/rp2040/raspberrypi-pico/configs/displaypack/defconfig index f48923f4ae..8c5dce37a0 100644 --- a/boards/arm/rp2040/raspberrypi-pico/configs/displaypack/defconfig +++ b/boards/arm/rp2040/raspberrypi-pico/configs/displaypack/defconfig @@ -97,3 +97,4 @@ CONFIG_TESTING_OSTEST=y CONFIG_USBDEV=y CONFIG_USBDEV_BUSPOWERED=y CONFIG_VIDEO_FB=y +CONFIG_WS2812_NON_SPI_DRIVER=y diff --git a/boards/arm/rp2040/raspberrypi-pico/configs/enc28j60/defconfig b/boards/arm/rp2040/raspberrypi-pico/configs/enc28j60/defconfig index 89c73fc0c7..49bc039834 100644 --- a/boards/arm/rp2040/raspberrypi-pico/configs/enc28j60/defconfig +++ b/boards/arm/rp2040/raspberrypi-pico/configs/enc28j60/defconfig @@ -82,3 +82,4 @@ CONFIG_TESTING_GETPRIME=y CONFIG_TESTING_OSTEST=y CONFIG_UART0_SERIAL_CONSOLE=y CONFIG_WQUEUE_NOTIFIER=y +CONFIG_WS2812_NON_SPI_DRIVER=y diff --git a/boards/arm/rp2040/raspberrypi-pico/configs/lcd1602/defconfig b/boards/arm/rp2040/raspberrypi-pico/configs/lcd1602/defconfig index db9f390dec..fed9b66e24 100644 --- a/boards/arm/rp2040/raspberrypi-pico/configs/lcd1602/defconfig +++ b/boards/arm/rp2040/raspberrypi-pico/configs/lcd1602/defconfig @@ -55,3 +55,4 @@ CONFIG_SYSTEM_NSH=y CONFIG_TESTING_GETPRIME=y CONFIG_TESTING_OSTEST=y CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_WS2812_NON_SPI_DRIVER=y diff --git a/boards/arm/rp2040/raspberrypi-pico/configs/nsh/defconfig b/boards/arm/rp2040/raspberrypi-pico/configs/nsh/defconfig index 421ba0692a..08129b5168 100644 --- a/boards/arm/rp2040/raspberrypi-pico/configs/nsh/defconfig +++ b/boards/arm/rp2040/raspberrypi-pico/configs/nsh/defconfig @@ -47,3 +47,4 @@ CONFIG_SYSTEM_NSH=y CONFIG_TESTING_GETPRIME=y CONFIG_TESTING_OSTEST=y CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_WS2812_NON_SPI_DRIVER=y diff --git a/boards/arm/rp2040/raspberrypi-pico/configs/nshsram/defconfig b/boards/arm/rp2040/raspberrypi-pico/configs/nshsram/defconfig index 854cb64d53..c4c7aa01cc 100644 --- a/boards/arm/rp2040/raspberrypi-pico/configs/nshsram/defconfig +++ b/boards/arm/rp2040/raspberrypi-pico/configs/nshsram/defconfig @@ -47,3 +47,4 @@ CONFIG_SYSTEM_NSH=y CONFIG_TESTING_GETPRIME=y CONFIG_TESTING_OSTEST=y CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_WS2812_NON_SPI_DRIVER=y diff --git a/boards/arm/rp2040/raspberrypi-pico/configs/smp/defconfig b/boards/arm/rp2040/raspberrypi-pico/configs/smp/defconfig index e7fc281bcd..5c8304fafc 100644 --- a/boards/arm/rp2040/raspberrypi-pico/configs/smp/defconfig +++ b/boards/arm/rp2040/raspberrypi-pico/configs/smp/defconfig @@ -53,3 +53,4 @@ CONFIG_TESTING_GETPRIME=y CONFIG_TESTING_OSTEST=y CONFIG_TESTING_SMP=y CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_WS2812_NON_SPI_DRIVER=y diff --git a/boards/arm/rp2040/raspberrypi-pico/configs/spisd/defconfig b/boards/arm/rp2040/raspberrypi-pico/configs/spisd/defconfig index b662bbaa52..929424e4fb 100644 --- a/boards/arm/rp2040/raspberrypi-pico/configs/spisd/defconfig +++ b/boards/arm/rp2040/raspberrypi-pico/configs/spisd/defconfig @@ -59,3 +59,4 @@ CONFIG_SYSTEM_SPITOOL=y CONFIG_TESTING_GETPRIME=y CONFIG_TESTING_OSTEST=y CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_WS2812_NON_SPI_DRIVER=y diff --git a/boards/arm/rp2040/raspberrypi-pico/configs/ssd1306/defconfig b/boards/arm/rp2040/raspberrypi-pico/configs/ssd1306/defconfig index e9ebc400d2..1678ed2e99 100644 --- a/boards/arm/rp2040/raspberrypi-pico/configs/ssd1306/defconfig +++ b/boards/arm/rp2040/raspberrypi-pico/configs/ssd1306/defconfig @@ -74,3 +74,4 @@ CONFIG_SYSTEM_NSH=y CONFIG_TESTING_GETPRIME=y CONFIG_TESTING_OSTEST=y CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_WS2812_NON_SPI_DRIVER=y diff --git a/boards/arm/rp2040/raspberrypi-pico/configs/st7735/defconfig b/boards/arm/rp2040/raspberrypi-pico/configs/st7735/defconfig index 9e7d8caaab..9e91a499b6 100644 --- a/boards/arm/rp2040/raspberrypi-pico/configs/st7735/defconfig +++ b/boards/arm/rp2040/raspberrypi-pico/configs/st7735/defconfig @@ -58,3 +58,4 @@ CONFIG_TESTING_GETPRIME=y CONFIG_TESTING_OSTEST=y CONFIG_UART0_SERIAL_CONSOLE=y CONFIG_VIDEO_FB=y +CONFIG_WS2812_NON_SPI_DRIVER=y diff --git a/boards/arm/rp2040/raspberrypi-pico/configs/usbmsc/defconfig b/boards/arm/rp2040/raspberrypi-pico/configs/usbmsc/defconfig index fc4af6e603..cf214e051e 100644 --- a/boards/arm/rp2040/raspberrypi-pico/configs/usbmsc/defconfig +++ b/boards/arm/rp2040/raspberrypi-pico/configs/usbmsc/defconfig @@ -66,3 +66,4 @@ CONFIG_USBDEV=y CONFIG_USBDEV_BUSPOWERED=y CONFIG_USBMSC=y CONFIG_USBMSC_NOT_STALL_BULKEP=y +CONFIG_WS2812_NON_SPI_DRIVER=y diff --git a/boards/arm/rp2040/raspberrypi-pico/configs/usbnsh/defconfig b/boards/arm/rp2040/raspberrypi-pico/configs/usbnsh/defconfig index 1944655f00..a7929feb87 100644 --- a/boards/arm/rp2040/raspberrypi-pico/configs/usbnsh/defconfig +++ b/boards/arm/rp2040/raspberrypi-pico/configs/usbnsh/defconfig @@ -51,3 +51,4 @@ CONFIG_TESTING_GETPRIME=y CONFIG_TESTING_OSTEST=y CONFIG_USBDEV=y CONFIG_USBDEV_BUSPOWERED=y +CONFIG_WS2812_NON_SPI_DRIVER=y diff --git a/boards/arm/rp2040/raspberrypi-pico/configs/waveshare-lcd-1.14/defconfig b/boards/arm/rp2040/raspberrypi-pico/configs/waveshare-lcd-1.14/defconfig index b4748ad3df..bf601aa777 100644 --- a/boards/arm/rp2040/raspberrypi-pico/configs/waveshare-lcd-1.14/defconfig +++ b/boards/arm/rp2040/raspberrypi-pico/configs/waveshare-lcd-1.14/defconfig @@ -94,3 +94,4 @@ CONFIG_TESTING_GETPRIME=y CONFIG_TESTING_OSTEST=y CONFIG_UART0_SERIAL_CONSOLE=y CONFIG_VIDEO_FB=y +CONFIG_WS2812_NON_SPI_DRIVER=y diff --git a/boards/arm/rp2040/raspberrypi-pico/configs/waveshare-lcd-1.3/defconfig b/boards/arm/rp2040/raspberrypi-pico/configs/waveshare-lcd-1.3/defconfig index 70ffeac581..d6d356ca8d 100644 --- a/boards/arm/rp2040/raspberrypi-pico/configs/waveshare-lcd-1.3/defconfig +++ b/boards/arm/rp2040/raspberrypi-pico/configs/waveshare-lcd-1.3/defconfig @@ -91,3 +91,4 @@ CONFIG_TESTING_GETPRIME=y CONFIG_TESTING_OSTEST=y CONFIG_UART0_SERIAL_CONSOLE=y CONFIG_VIDEO_FB=y +CONFIG_WS2812_NON_SPI_DRIVER=y diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index b4e2997567..ad23a4ca94 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -106,12 +106,51 @@ config WS2812 ---help--- Enable support for the Worldsemi WS2812 LED driver which commonly found in LED strips. - NOTE: This device is a one wire device and has no CS or RESET - line it must have exclusive use of the bus! + NOTE: Depening on the board slected this device may require + exclusive use of an SPI bus as ws2812 LEDs have no CS or + RESET line. + +# NOTE: Once the older SPI driver is migrated to the new model +# we should remove the "select SPI" in the above config. + +config WS2812_NON_SPI_DRIVER + bool "Support the new non-SPI WS2812 driver." + default n + depends on WS2812 + ---help--- + The original driver used SPI hardware to clock bits to the + pixels. The driver is being re-designed to support other + implementations. Selecting this option builds the new + model driver. + +config WS2812_LED_COUNT + int "Number of ws2812s connected." + default 1 + range 1 65535 + depends on WS2812 + ---help--- + The number of ws2812s chained to this port. Although the + driver allows up to 65,535 ws2812s the practical limit will + depend on processor speed and other resources. + +config WS2812_HAS_WHITE + bool "ws2812s have white LED." + default n + depends on WS2812 + ---help--- + Some ws2812 work-alike chips have a white LED in addition + to the standard red, green, and blue LEDs. This option + enables support for such chips. Note that the driver does + not support chains with a mix of RGB and RGBW pixels. config WS2812_FREQUENCY - int "WS2812 LED Driver SPI Frequency" - default 8000000 + int "WS2812 Bit Frequency (Hz)" + default 800000 depends on WS2812 - + ---help--- + This is should be set to the bit frequency of the + ws2812s being used. Newer chips use an 800 kHz + bit frequency (the default); although, some older + chips run at 400 kHz. + endmenu # LED Support diff --git a/drivers/leds/ws2812.c b/drivers/leds/ws2812.c index b80b1a7fa8..1c2b0df89b 100644 --- a/drivers/leds/ws2812.c +++ b/drivers/leds/ws2812.c @@ -30,15 +30,36 @@ #include #include -#include #include +#ifndef CONFIG_WS2812_NON_SPI_DRIVER +#include +#endif /* CONFIG_WS2812_NON_SPI_DRIVER */ + #ifdef CONFIG_WS2812 +/**************************************************************************** + * ######## ATTENTION ####### + * This file contains code that supports two separate ws2812 upper-half + * models: + * + * If CONFIG_WS2812_NON_SPI_DRIVER is NOT defined the older upper-half + * code that uses SPI to send the serial data will be built. + * + * If WS2812_NEW_MODEL_DRIVER is defined the upper-half code that does + * not relay on SPI will be built. + ****************************************************************************/ + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ +#define WS2812_RW_PIXEL_SIZE 4 + +#ifdef CONFIG_WS2812_NON_SPI_DRIVER + +#else /* CONFIG_WS2812_NON_SPI_DRIVER */ + /* In order to meet the signaling timing requirements, the waveforms required * to represent a 0/1 symbol are created by specific SPI bytes defined here. * @@ -57,10 +78,10 @@ * Reset: low signal >50us */ -#if CONFIG_WS2812_FREQUENCY >= 3600000 && CONFIG_WS2812_FREQUENCY <= 5000000 +#if CONFIG_WS2812_FREQUENCY >= 360000 && CONFIG_WS2812_FREQUENCY <= 500000 # define WS2812_ZERO_BYTE 0b01000000 /* 200ns at 5 MHz, 278ns at 3.6 MHz */ # define WS2812_ONE_BYTE 0b01110000 /* 600ns at 5 MHz, 833ns at 3.6 MHz */ -#elif CONFIG_WS2812_FREQUENCY >= 5900000 && CONFIG_WS2812_FREQUENCY <= 9000000 +#elif CONFIG_WS2812_FREQUENCY >= 590000 && CONFIG_WS2812_FREQUENCY <= 900000 # define WS2812_ZERO_BYTE 0b01100000 /* 222ns at 9 MHz, 339ns at 5.9 MHz */ # define WS2812_ONE_BYTE 0b01111100 /* 556ns at 9 MHz, 847ns at 5.9 MHz */ #else @@ -72,10 +93,9 @@ * Aiming for 60 us, safely above the 50us required. */ -#define WS2812_RST_CYCLES (CONFIG_WS2812_FREQUENCY * 60 / 1000000 / 8) +#define WS2812_RST_CYCLES (CONFIG_WS2812_FREQUENCY * 60 / 100000 / 8) #define WS2812_BYTES_PER_LED (8 * 3) -#define WS2812_RW_PIXEL_SIZE 4 /* Transmit buffer looks like: * [<----N reset bytes---->|<-RGBn->...<-RGB0->|<----1 reset byte---->] @@ -90,10 +110,14 @@ #define TXBUFF_SIZE(n) (WS2812_RST_CYCLES + n * WS2812_BYTES_PER_LED + 1) +#endif /* CONFIG_WS2812_NON_SPI_DRIVER */ + /**************************************************************************** * Private Types ****************************************************************************/ +#ifndef CONFIG_WS2812_NON_SPI_DRIVER + struct ws2812_dev_s { FAR struct spi_dev_s *spi; /* SPI interface */ @@ -102,15 +126,29 @@ struct ws2812_dev_s sem_t exclsem; /* Assures exclusive access to the driver */ }; +#endif /* CONFIG_WS2812_NON_SPI_DRIVER */ + /**************************************************************************** * Private Function Prototypes ****************************************************************************/ +#ifndef CONFIG_WS2812_NON_SPI_DRIVER + static inline void ws2812_configspi(FAR struct spi_dev_s *spi); static void ws2812_pack(FAR uint8_t *buf, uint32_t rgb); +#endif /* CONFIG_WS2812_NON_SPI_DRIVER */ + /* Character driver methods */ +#ifdef CONFIG_WS2812_NON_SPI_DRIVER + +static ssize_t ws2812_open(FAR struct file *filep); + +static ssize_t ws2812_close(FAR struct file *filep); + +#endif /* CONFIG_WS2812_NON_SPI_DRIVER */ + static ssize_t ws2812_read(FAR struct file *filep, FAR char *buffer, size_t buflen); static ssize_t ws2812_write(FAR struct file *filep, FAR const char *buffer, @@ -123,8 +161,13 @@ static off_t ws2812_seek(FAR struct file *filep, off_t offset, int whence); static const struct file_operations g_ws2812fops = { +#ifdef CONFIG_WS2812_NON_SPI_DRIVER + ws2812_open, /* open */ + ws2812_close, /* close */ +#else /* CONFIG_WS2812_NON_SPI_DRIVER */ NULL, /* open */ NULL, /* close */ +#endif /* CONFIG_WS2812_NON_SPI_DRIVER */ ws2812_read, /* read */ ws2812_write, /* write */ ws2812_seek, /* seek */ @@ -135,10 +178,199 @@ static const struct file_operations g_ws2812fops = #endif }; +/**************************************************************************** + * #### TODO #### + * + * Consider supporting mmap by returning memory buffer using... + * file_ioctl(filep, FIOC_MMAP, (unsigned long)((uintptr_t)&addr)); + * Code using this would be non-portable across architectures as the format + * of the buffer can be different. + * + * Consider supporting rectangular arrays of ws2812s as a video output + * device. + * + ****************************************************************************/ + +/**************************************************************************** + * Table of Gamma Correction Values + * + * This table is based on: + * y = 255 * (x / 255)^2.6 + ****************************************************************************/ + +static const uint8_t ws2812_gamma[256] = +{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, + 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, + 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, + 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 16, 16, 17, + 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 24, 24, 25, + 25, 26, 27, 27, 28, 29, 29, 30, 31, 31, 32, 33, 34, 34, 35, + 36, 37, 38, 38, 39, 40, 41, 42, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 68, 69, 70, 71, 72, 73, 75, 76, 77, 78, 80, 81, + 82, 84, 85, 86, 88, 89, 90, 92, 93, 94, 96, 97, 99, 100, 102, + 103, 105, 106, 108, 109, 111, 112, 114, 115, 117, 119, 120, 122, 124, 125, + 127, 129, 130, 132, 134, 136, 137, 139, 141, 143, 145, 146, 148, 150, 152, + 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, + 184, 186, 188, 191, 193, 195, 197, 199, 202, 204, 206, 209, 211, 213, 215, + 218, 220, 223, 225, 227, 230, 232, 235, 237, 240, 242, 245, 247, 250, 252, + 255 +}; + +/**************************************************************************** + * Table for HSV to RGB conversion + ****************************************************************************/ + + static const uint8_t hsv_rgb[43] = + { + 0, 6, 12, 18, 24, 30, 36, 43, 49, 55, + 61, 67, 73, 79, 85, 91, 97, 103, 109, 115, + 121, 128, 134, 140, 146, 152, 158, 164, 170, 176, + 182, 188, 194, 200, 206, 213, 219, 225, 231, 237, + 243, 249, 255 + }; + /**************************************************************************** * Private Functions ****************************************************************************/ +#ifdef CONFIG_WS2812_NON_SPI_DRIVER + +/**************************************************************************** + * Name: ws2812_open + * + * Description: + * Prepare the ws2812 for use. This method just calls the lower-half + * open routine if one exists. + * + * Input Parameters: + * filep - Pointer system file data + * + * Returned Value: + * A pointer to an internal structure used by rp2040_ws2812 + * + ****************************************************************************/ + +ssize_t ws2812_open(FAR struct file *filep) +{ + FAR struct inode *inode = filep->f_inode; + FAR struct ws2812_dev_s *priv = inode->i_private; + int res; + + res = priv->open(filep); + + return res; +} + +/**************************************************************************** + * Name: ws2812_close + * + * Description: + * Cleanup after use. This method just calls the lower-half + * open routine if one exists. + * + * Input Parameters: + * filep - Pointer system file data + * + * Returned Value: + * OK if successful, or an error code on failure. + * + ****************************************************************************/ + +static int ws2812_close(FAR struct file *filep) +{ + FAR struct inode *inode = filep->f_inode; + FAR struct ws2812_dev_s *priv = inode->i_private; + int res = OK; + + if (priv != NULL && priv->close != NULL) + { + res = priv->close(filep); + } + + return res; +} + +/**************************************************************************** + * Name: ws2812_write + * Description: + * Updates the data buffer with the supplied data any then sends the data + * to the LEDs. A write length of zero does not update data but will + * re-send the data to the leds. + * + * Input Parameter: + * filep - Pointer system file data + * data - Data to send. + * len - Length of data in bytes. + * + * Returned Value: + * number of bytes written on success, ERROR if write fails. + * + ****************************************************************************/ + +ssize_t ws2812_write(FAR struct file *filep, + FAR const char *data, + size_t len) +{ + FAR struct inode *inode = filep->f_inode; + FAR struct ws2812_dev_s *priv = inode->i_private; + ssize_t res; + + if ((len % WS2812_RW_PIXEL_SIZE) != 0) + { + lederr("ERROR: LED values must be 24bit packed in 32bit\n"); + return -EINVAL; + } + + res = priv->write(filep, data, len); + + return res; +} + +/**************************************************************************** + * Name: ws2812_read + * Description: + * Fetches data from the pixel buffer. + * + * Input Parameter: + * filep - Pointer system file data + * data - pointer to receive buffer. + * len - Length to read in bytes. + * + * Returned Value: + * number of bytes read on success, ERROR if read fails. + * + ****************************************************************************/ + +ssize_t ws2812_read(FAR struct file *filep, + FAR char *data, + size_t len) +{ + FAR struct inode *inode = filep->f_inode; + FAR struct ws2812_dev_s *priv = inode->i_private; + ssize_t res; + + if (priv == NULL || priv->read == NULL) + { + return -ENOSYS; + } + + if ((len % WS2812_RW_PIXEL_SIZE) != 0) + { + lederr("ERROR: LED values must be packed in 32bit words.\n"); + return -EINVAL; + } + + res = priv->read(filep, data, len); + + return res; +} + +#else /* CONFIG_WS2812_NON_SPI_DRIVER */ + /**************************************************************************** * Name: ws2812_configspi * @@ -157,7 +389,7 @@ static inline void ws2812_configspi(FAR struct spi_dev_s *spi) SPI_SETMODE(spi, SPIDEV_MODE3); SPI_SETBITS(spi, 8); SPI_HWFEATURES(spi, 0); - SPI_SETFREQUENCY(spi, CONFIG_WS2812_FREQUENCY); + SPI_SETFREQUENCY(spi, 10 * CONFIG_WS2812_FREQUENCY); } /**************************************************************************** @@ -293,6 +525,8 @@ static ssize_t ws2812_write(FAR struct file *filep, FAR const char *buffer, return written; } +#endif /* CONFIG_WS2812_NON_SPI_DRIVER */ + /**************************************************************************** * Name: ws2812_seek * @@ -325,55 +559,39 @@ static off_t ws2812_seek(FAR struct file *filep, off_t offset, int whence) { case SEEK_CUR: pos += offset; - if (pos > maxpos) - { - pos = maxpos; - } - else if (pos < 0) - { - pos = 0; - } - filep->f_pos = pos; break; case SEEK_SET: pos = offset; - if (pos > maxpos) - { - pos = maxpos; - } - else if (pos < 0) - { - pos = 0; - } - - filep->f_pos = pos; break; case SEEK_END: - pos = maxpos + offset; - if (pos > maxpos) - { - pos = maxpos; - } - else if (pos < 0) - { - pos = 0; - } - - filep->f_pos = pos; + pos = maxpos + offset + 4; break; default: /* Return EINVAL if the whence argument is invalid */ - pos = (off_t)-EINVAL; - break; + nxsem_post(&priv->exclsem); + + return (off_t)-EINVAL; } + if (pos > maxpos) + { + pos = maxpos; + } + else if (pos < 0) + { + pos = 0; + } + + filep->f_pos = pos; + nxsem_post(&priv->exclsem); + return pos; } @@ -381,6 +599,41 @@ static off_t ws2812_seek(FAR struct file *filep, off_t offset, int whence) * Public Functions ****************************************************************************/ +#ifdef CONFIG_WS2812_NON_SPI_DRIVER + +/**************************************************************************** + * Name: ws2812_register + * + * Description: + * Initialize a ws2812 device as a LEDs interface. + * + * Input Parameters: + * dev_path - The full path to the driver to register. E.g., "/dev/leds0" + * count - The number of ws2812s in the chain + * has_white - Set true if the ws2812s in the chain have while LEDs + * slow_leds - Set true to support older 400 kHz leds. + * + * Returned Value: + * Zero (OK) on success; a negated errno value on failure. + * + ****************************************************************************/ + +int ws2812_register(FAR const char *dev_path, + FAR struct ws2812_dev_s *dev_data) +{ + /* Register the character driver */ + + int ret = register_driver(dev_path, &g_ws2812fops, 0666, dev_data); + if (ret < 0) + { + lederr("ERROR: Failed to register ws2812 driver: %d\n", ret); + } + + return ret; +} + +#else /* CONFIG_WS2812_NON_SPI_DRIVER */ + /**************************************************************************** * Name: ws2812_leds_register * @@ -451,4 +704,158 @@ int ws2812_leds_register(FAR const char *devpath, FAR struct spi_dev_s *spi, return ret; } + +#endif /* CONFIG_WS2812_NON_SPI_DRIVER */ + +/**************************************************************************** + * Name: ws2812_hsv_to_rgb + * + * Description: + * Convert a set of hue, saturation and value numbers to an RGB pixel. + * + * Representative "hue" values: + * Red 0 + * Yellow 42 + * Green 86 + * Cyan 128 + * Blue 170 + * Magenta 212 + * + * "Saturation" values run from 0 (gray) to 255 (pure color) + * + * "Value" values run from 0 (black) to 255 (full brightness) + * + * Input Parameters: + * hue in range (0-255) (red -> 0, green -> 85, blue -> 170) + * saturation in range (0-255) + * value in range (0-255) + * + * Returned Value: + * A 32-bit pixel in 0x00RRGGBB format. + * + ****************************************************************************/ + +uint32_t ws2812_hsv_to_rgb(uint8_t hue, + uint8_t saturation, + uint8_t value) +{ + uint32_t val = value + 1; /* move value to range 1...256 */ + uint32_t sat = saturation + 1; /* move value to range 1...256 */ + uint16_t r; + uint16_t g; + uint16_t b; + + /* ===== Compute full saturation R,G,B based on hue ===== + * + * These computed values are inverted from the normal + * sense. (0 -> full color 255 -> black) in preparation + * for the saturation adjustment. + */ + + if (hue < 86) + { + /* Color between Red and Green */ + + b = 255; + if (hue < 43) + { + /* 0 - 42 Color between Red and Yellow */ + + r = 0; + g = 255 - hsv_rgb[hue]; + } + else + { + /* 43 - 85 Color between Yellow and Green */ + + r = hsv_rgb[hue - 43]; + g = 0; + } + } + else if (hue < 171) + { + /* Color between Green and Blue */ + + r = 255; + if (hue < 128) + { + /* 86 - 127 Color between Green and Cyan */ + + g = 0; + b = 255 - hsv_rgb[hue - 86]; + } + else + { + /* 128 - 170 Color between Cyan and Blue */ + + g = hsv_rgb[hue - 128]; + b = 0; + } + } + else + { + /* Color between Blue and Red */ + + g = 255; + if (hue < 214) + { + /* 171 - 213 Color between Blue and Magenta */ + + b = 0; + r = 255 - hsv_rgb[hue - 171]; + } + else + { + /* 214 - 255 Color between Magenta and Red */ + + b = hsv_rgb[hue - 214]; + r = 0; + } + } + + /* This step scales the color for saturation and inverts + * back to 255 -> bright and 0 -> black. + */ + + r = 255 - ((r * sat) >> 8); + g = 255 - ((g * sat) >> 8); + b = 255 - ((b * sat) >> 8); + + /* compute the return value using the r, g, and b values scaled + * by the value parameter + */ + + return (((r * val) << 8) & 0xff0000) + | (((g * val) << 0) & 0x00ff00) + | (((b * val) >> 8) & 0x0000ff); +} + +/**************************************************************************** + * Name: ws2812_gamma_correct + * + * Description: + * Applies a gamma correction to the supplied pixel. + * + * Input Parameters: + * a 32-bit pixel with 8-bit color components. + * + * Returned Value: + * A 32-bit gamma corrected pixel. + * + ****************************************************************************/ + +uint32_t ws2812_gamma_correct(uint32_t pixel) +{ + uint32_t res; + FAR uint8_t *in = (FAR uint8_t *) &pixel; + FAR uint8_t *out = (FAR uint8_t *) &res; + + *out++ = ws2812_gamma[*in++]; + *out++ = ws2812_gamma[*in++]; + *out++ = ws2812_gamma[*in++]; + *out = ws2812_gamma[*in]; + + return res; +} + #endif /* CONFIG_WS2812 */ diff --git a/include/nuttx/leds/ws2812.h b/include/nuttx/leds/ws2812.h index 37c3f7c6f0..e64759e6d6 100644 --- a/include/nuttx/leds/ws2812.h +++ b/include/nuttx/leds/ws2812.h @@ -27,16 +27,29 @@ #include #include -#include +#include +#ifdef CONFIG_WS2812_NON_SPI_DRIVER +#include +#else /* CONFIG_WS2812_NON_SPI_DRIVER */ +#include +#endif /* CONFIG_WS2812_NON_SPI_DRIVER */ #ifdef CONFIG_WS2812 /**************************************************************************** - * Pre-processor Definitions + * ######## ATTENTION ####### + * This file contains code that supports two separate ws2812 upper-half + * models: + * + * If CONFIG_WS2812_NON_SPI_DRIVER is NOT defined the older upper-half + * code that uses SPI to send the serial data will be built. + * + * If WS2812_NEW_MODEL_DRIVER is defined the upper-half code that does + * not relay on SPI will be built. ****************************************************************************/ /**************************************************************************** - * Public Types + * Pre-processor Definitions ****************************************************************************/ #ifdef __cplusplus @@ -47,6 +60,75 @@ extern "C" #define EXTERN extern #endif +/**************************************************************************** + * Public Types + ****************************************************************************/ + +#ifdef CONFIG_WS2812_NON_SPI_DRIVER + +struct ws2812_dev_s +{ + /* -------------------------------------------------------- + * Each board that implements ws2812 must initialize the + * following fields before calling ws2812_register. + * + * The close and read pointer may be initialized to NULL + * and the upper-half will do the right thing. + */ + + FAR int (*open)(FAR struct file *filep); + + FAR int (*close)(FAR struct file *filep); + + FAR ssize_t (*write)(FAR struct file *filep, + FAR const char *data, + size_t len); + + FAR ssize_t (*read)(FAR struct file *filep, + FAR char *data, + size_t len); + + uint32_t clock; + sem_t exclsem; + int port; + uint16_t nleds; + bool has_white; + + /* -------------------------------------------------------- + * Other fields must be set to zero. + */ + + void *private; /* Private data for opened device */ +}; + +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifdef CONFIG_WS2812_NON_SPI_DRIVER + +/**************************************************************************** + * Name: ws2812_register + * + * Description: + * Initialize a ws2812 device as a LEDs interface. + * + * Input Parameters: + * dev_path - The full path to the driver to register. E.g., "/dev/leds0" + * dev_data - The partially initialize ws2812 structure. + * + * Returned Value: + * Zero (OK) on success; a negated errno value on failure. + * + ****************************************************************************/ + +int ws2812_register(FAR const char *dev_path, + FAR struct ws2812_dev_s *dev_data); + +#else /* CONFIG_WS2812_NON_SPI_DRIVER */ + /**************************************************************************** * Name: ws2812_leds_register * @@ -64,9 +146,62 @@ extern "C" * ****************************************************************************/ -int ws2812_leds_register(FAR const char *devpath, FAR struct spi_dev_s *spi, +int ws2812_leds_register(FAR const char *devpath, FAR struct spi_dev_s *spi, uint16_t nleds); +#endif /* CONFIG_WS2812_NON_SPI_DRIVER */ + +/**************************************************************************** + * Name: ws2812_hsv_to_rgb + * + * Description: + * Convert a set of hue, saturation and value numbers to an RGB pixel. + * + * Representative "hue" values: + * Red 0 + * Yellow 42 + * Green 86 + * Cyan 128 + * Blue 170 + * Magenta 212 + * + * "Saturation" values run from 0 (gray) to 255 (pure color) + * + * "Value" values run from 0 (black) to 255 (full brightness) + * + * Input Parameters: + * hue in range (0-255) (red -> 0, green -> 85, blue -> 170) + * saturation in range (0-255) + * value in range (0-255) + * + * Returned Value: + * A 32-bit pixel in 0x00RRGGBB format. + * + ****************************************************************************/ + +uint32_t ws2812_hsv_to_rgb(uint8_t hue, + uint8_t saturation, + uint8_t value); + +/**************************************************************************** + * Name: ws2812_gamma_correct + * + * Description: + * Applies a gamma correction to the supplied pixel. + * + * This applies the function y = 255 * (x / 255)^2.6 to each color + * component of the pixel. + * + * Input Parameters: + * a 32-bit pixel with 8-bit color components. + * + * Returned Value: + * A 32-bit gamma corrected pixel. + * + ****************************************************************************/ + +uint32_t ws2812_gamma_correct(uint32_t pixel); + #undef EXTERN #ifdef __cplusplus }