From e352048db91bbd2f267ffdf850d841607f84cfc6 Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Sun, 5 Dec 2021 14:49:48 -0700 Subject: [PATCH 1/3] Add ODT Cast-Away RP2040 --- .../boards/odt_cast_away_rp2040/board.c | 40 ++++++++++++++++++ .../odt_cast_away_rp2040/mpconfigboard.h | 14 +++++++ .../odt_cast_away_rp2040/mpconfigboard.mk | 11 +++++ .../pico-sdk-configboard.h | 3 ++ .../boards/odt_cast_away_rp2040/pins.c | 41 +++++++++++++++++++ 5 files changed, 109 insertions(+) create mode 100644 ports/raspberrypi/boards/odt_cast_away_rp2040/board.c create mode 100644 ports/raspberrypi/boards/odt_cast_away_rp2040/mpconfigboard.h create mode 100644 ports/raspberrypi/boards/odt_cast_away_rp2040/mpconfigboard.mk create mode 100644 ports/raspberrypi/boards/odt_cast_away_rp2040/pico-sdk-configboard.h create mode 100644 ports/raspberrypi/boards/odt_cast_away_rp2040/pins.c diff --git a/ports/raspberrypi/boards/odt_cast_away_rp2040/board.c b/ports/raspberrypi/boards/odt_cast_away_rp2040/board.c new file mode 100644 index 000000000000..de6e424ed92b --- /dev/null +++ b/ports/raspberrypi/boards/odt_cast_away_rp2040/board.c @@ -0,0 +1,40 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" + +void board_init(void) { +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { +} + +void board_deinit(void) { +} diff --git a/ports/raspberrypi/boards/odt_cast_away_rp2040/mpconfigboard.h b/ports/raspberrypi/boards/odt_cast_away_rp2040/mpconfigboard.h new file mode 100644 index 000000000000..db2b871bb044 --- /dev/null +++ b/ports/raspberrypi/boards/odt_cast_away_rp2040/mpconfigboard.h @@ -0,0 +1,14 @@ +#define MICROPY_HW_BOARD_NAME "Oak Dev Tech Cast-Away RP2040" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO18) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO1) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO0) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO2) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO3) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO4) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO14) +#define DEFAULT_UART_BUS_TX (&pin_GPIO15) diff --git a/ports/raspberrypi/boards/odt_cast_away_rp2040/mpconfigboard.mk b/ports/raspberrypi/boards/odt_cast_away_rp2040/mpconfigboard.mk new file mode 100644 index 000000000000..40f358200534 --- /dev/null +++ b/ports/raspberrypi/boards/odt_cast_away_rp2040/mpconfigboard.mk @@ -0,0 +1,11 @@ +USB_VID = 0x1209 +USB_PID = 0x4DF2 +USB_PRODUCT = "CAST AWAY RP2040" +USB_MANUFACTURER = "Oak Dev Tech" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ" + +CIRCUITPY__EVE = 1 diff --git a/ports/raspberrypi/boards/odt_cast_away_rp2040/pico-sdk-configboard.h b/ports/raspberrypi/boards/odt_cast_away_rp2040/pico-sdk-configboard.h new file mode 100644 index 000000000000..7d1b96b85aa3 --- /dev/null +++ b/ports/raspberrypi/boards/odt_cast_away_rp2040/pico-sdk-configboard.h @@ -0,0 +1,3 @@ +// Put board-specific pico-sdk definitions here. This file must exist. +// Allow extra time for xosc to start. +#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64 diff --git a/ports/raspberrypi/boards/odt_cast_away_rp2040/pins.c b/ports/raspberrypi/boards/odt_cast_away_rp2040/pins.c new file mode 100644 index 000000000000..8686f7ae0b6f --- /dev/null +++ b/ports/raspberrypi/boards/odt_cast_away_rp2040/pins.c @@ -0,0 +1,41 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_ROM_QSTR(MP_QSTR_D26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_D27), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_D28), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); From db6e58dc2d789502af2deaa435e5402c1ae801d3 Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Sun, 5 Dec 2021 15:02:18 -0700 Subject: [PATCH 2/3] run precommit locally and passed --- locale/circuitpython.pot | 12 +++++++----- .../boards/adafruit_feather_esp32s2_tft/board.c | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 835ef9538b96..4cd4de67d16f 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -574,7 +574,7 @@ msgstr "" #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c -#: shared-bindings/is31fl3741/is31fl3741.c +#: shared-bindings/is31fl3741/IS31FL3741.c #: shared-bindings/rgbmatrix/RGBMatrix.c msgid "Brightness must be 0-1.0" msgstr "" @@ -1462,7 +1462,7 @@ msgstr "" msgid "Key must be 16, 24, or 32 bytes long" msgstr "" -#: shared-module/is31fl3741/is31fl3741.c +#: shared-module/is31fl3741/IS31FL3741.c msgid "LED mappings must match display size" msgstr "" @@ -2090,7 +2090,7 @@ msgstr "" msgid "Sample rate too high. It must be less than %d" msgstr "" -#: shared-bindings/is31fl3741/is31fl3741.c +#: shared-bindings/is31fl3741/IS31FL3741.c msgid "Scale dimensions must divide by 3" msgstr "" @@ -2351,7 +2351,7 @@ msgstr "" msgid "Unable to create lock" msgstr "" -#: shared-module/displayio/I2CDisplay.c shared-module/is31fl3741/is31fl3741.c +#: shared-module/displayio/I2CDisplay.c shared-module/is31fl3741/IS31FL3741.c #, c-format msgid "Unable to find I2C Display at %x" msgstr "" @@ -3950,12 +3950,14 @@ msgstr "" #: ports/espressif/boards/adafruit_funhouse/mpconfigboard.h #: ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h +#: ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.h #: ports/espressif/boards/artisense_rd00/mpconfigboard.h #: ports/espressif/boards/atmegazero_esp32s2/mpconfigboard.h #: ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h #: ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.h #: ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1/mpconfigboard.h @@ -4462,7 +4464,7 @@ msgstr "" msgid "width must be from 2 to 8 (inclusive), not %d" msgstr "" -#: shared-bindings/is31fl3741/is31fl3741.c +#: shared-bindings/is31fl3741/IS31FL3741.c #: shared-bindings/rgbmatrix/RGBMatrix.c msgid "width must be greater than zero" msgstr "" diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tft/board.c b/ports/espressif/boards/adafruit_feather_esp32s2_tft/board.c index adc4ae1b011e..c6d9b581b3fc 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tft/board.c +++ b/ports/espressif/boards/adafruit_feather_esp32s2_tft/board.c @@ -86,7 +86,7 @@ void board_init(void) { common_hal_busio_spi_never_reset(spi); - displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus; + displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; bus->base.type = &displayio_fourwire_type; common_hal_displayio_fourwire_construct( @@ -99,7 +99,7 @@ void board_init(void) { 0, // polarity 0 // phase ); - displayio_display_obj_t* display = &displays[0].display; + displayio_display_obj_t *display = &displays[0].display; display->base.type = &displayio_display_type; // workaround as board_init() is called before reset_port() in main.c From 1a1f0158951d0e71f654806014608e606298620d Mon Sep 17 00:00:00 2001 From: Seth Kerr Date: Sun, 5 Dec 2021 15:09:56 -0700 Subject: [PATCH 3/3] fixing files changed by precommit --- locale/circuitpython.pot | 12 +++++------- .../boards/adafruit_feather_esp32s2_tft/board.c | 4 ++-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 4cd4de67d16f..835ef9538b96 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -574,7 +574,7 @@ msgstr "" #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c -#: shared-bindings/is31fl3741/IS31FL3741.c +#: shared-bindings/is31fl3741/is31fl3741.c #: shared-bindings/rgbmatrix/RGBMatrix.c msgid "Brightness must be 0-1.0" msgstr "" @@ -1462,7 +1462,7 @@ msgstr "" msgid "Key must be 16, 24, or 32 bytes long" msgstr "" -#: shared-module/is31fl3741/IS31FL3741.c +#: shared-module/is31fl3741/is31fl3741.c msgid "LED mappings must match display size" msgstr "" @@ -2090,7 +2090,7 @@ msgstr "" msgid "Sample rate too high. It must be less than %d" msgstr "" -#: shared-bindings/is31fl3741/IS31FL3741.c +#: shared-bindings/is31fl3741/is31fl3741.c msgid "Scale dimensions must divide by 3" msgstr "" @@ -2351,7 +2351,7 @@ msgstr "" msgid "Unable to create lock" msgstr "" -#: shared-module/displayio/I2CDisplay.c shared-module/is31fl3741/IS31FL3741.c +#: shared-module/displayio/I2CDisplay.c shared-module/is31fl3741/is31fl3741.c #, c-format msgid "Unable to find I2C Display at %x" msgstr "" @@ -3950,14 +3950,12 @@ msgstr "" #: ports/espressif/boards/adafruit_funhouse/mpconfigboard.h #: ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h -#: ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h #: ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.h #: ports/espressif/boards/artisense_rd00/mpconfigboard.h #: ports/espressif/boards/atmegazero_esp32s2/mpconfigboard.h #: ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h #: ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h -#: ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.h #: ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.h #: ports/espressif/boards/espressif_kaluga_1/mpconfigboard.h @@ -4464,7 +4462,7 @@ msgstr "" msgid "width must be from 2 to 8 (inclusive), not %d" msgstr "" -#: shared-bindings/is31fl3741/IS31FL3741.c +#: shared-bindings/is31fl3741/is31fl3741.c #: shared-bindings/rgbmatrix/RGBMatrix.c msgid "width must be greater than zero" msgstr "" diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tft/board.c b/ports/espressif/boards/adafruit_feather_esp32s2_tft/board.c index c6d9b581b3fc..adc4ae1b011e 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tft/board.c +++ b/ports/espressif/boards/adafruit_feather_esp32s2_tft/board.c @@ -86,7 +86,7 @@ void board_init(void) { common_hal_busio_spi_never_reset(spi); - displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; + displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus; bus->base.type = &displayio_fourwire_type; common_hal_displayio_fourwire_construct( @@ -99,7 +99,7 @@ void board_init(void) { 0, // polarity 0 // phase ); - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t* display = &displays[0].display; display->base.type = &displayio_display_type; // workaround as board_init() is called before reset_port() in main.c