From 9aeda2b967bf4ce9372f8a31c28f14b60bfafda0 Mon Sep 17 00:00:00 2001 From: Chris Burton Date: Tue, 17 Dec 2024 09:30:57 +0000 Subject: [PATCH] Add 8086 RP2040 Interfacer --- .../boards/8086_rp2040_interfacer/board.c | 9 ++++ .../8086_rp2040_interfacer/mpconfigboard.h | 21 ++++++++ .../8086_rp2040_interfacer/mpconfigboard.mk | 9 ++++ .../pico-sdk-configboard.h | 12 +++++ .../boards/8086_rp2040_interfacer/pins.c | 48 +++++++++++++++++++ 5 files changed, 99 insertions(+) create mode 100644 ports/raspberrypi/boards/8086_rp2040_interfacer/board.c create mode 100644 ports/raspberrypi/boards/8086_rp2040_interfacer/mpconfigboard.h create mode 100644 ports/raspberrypi/boards/8086_rp2040_interfacer/mpconfigboard.mk create mode 100644 ports/raspberrypi/boards/8086_rp2040_interfacer/pico-sdk-configboard.h create mode 100644 ports/raspberrypi/boards/8086_rp2040_interfacer/pins.c diff --git a/ports/raspberrypi/boards/8086_rp2040_interfacer/board.c b/ports/raspberrypi/boards/8086_rp2040_interfacer/board.c new file mode 100644 index 000000000000..e6a868ab2122 --- /dev/null +++ b/ports/raspberrypi/boards/8086_rp2040_interfacer/board.c @@ -0,0 +1,9 @@ +// This file is part of the CircuitPython project: https://circuitpython.org +// +// SPDX-FileCopyrightText: Copyright (c) 2021 Scott Shawcroft for Adafruit Industries +// +// SPDX-License-Identifier: MIT + +#include "supervisor/board.h" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/8086_rp2040_interfacer/mpconfigboard.h b/ports/raspberrypi/boards/8086_rp2040_interfacer/mpconfigboard.h new file mode 100644 index 000000000000..860ca65321c0 --- /dev/null +++ b/ports/raspberrypi/boards/8086_rp2040_interfacer/mpconfigboard.h @@ -0,0 +1,21 @@ +// This file is part of the CircuitPython project: https://circuitpython.org +// +// SPDX-FileCopyrightText: Copyright (c) 2021 Scott Shawcroft for Adafruit Industries +// +// SPDX-License-Identifier: MIT + +#pragma once + +#define MICROPY_HW_BOARD_NAME "8086 RP2040 Interfacer" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define MICROPY_HW_LED_STATUS (&pin_GPIO16) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO27) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO26) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO13) +#define DEFAULT_UART_BUS_TX (&pin_GPIO12) + +// #define CIRCUITPY_CONSOLE_UART_RX DEFAULT_UART_BUS_RX +// #define CIRCUITPY_CONSOLE_UART_TX DEFAULT_UART_BUS_TX diff --git a/ports/raspberrypi/boards/8086_rp2040_interfacer/mpconfigboard.mk b/ports/raspberrypi/boards/8086_rp2040_interfacer/mpconfigboard.mk new file mode 100644 index 000000000000..644d7d7520fd --- /dev/null +++ b/ports/raspberrypi/boards/8086_rp2040_interfacer/mpconfigboard.mk @@ -0,0 +1,9 @@ +USB_VID = 0x3171 +USB_PID = 0x010D +USB_PRODUCT = "RP2040 Interfacer" +USB_MANUFACTURER = "8086 Consultancy" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ" diff --git a/ports/raspberrypi/boards/8086_rp2040_interfacer/pico-sdk-configboard.h b/ports/raspberrypi/boards/8086_rp2040_interfacer/pico-sdk-configboard.h new file mode 100644 index 000000000000..ce5a7645b4e2 --- /dev/null +++ b/ports/raspberrypi/boards/8086_rp2040_interfacer/pico-sdk-configboard.h @@ -0,0 +1,12 @@ +// This file is part of the CircuitPython project: https://circuitpython.org +// +// SPDX-FileCopyrightText: Copyright (c) 2021 Scott Shawcroft for Adafruit Industries +// +// SPDX-License-Identifier: MIT + +#pragma once + +// 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/8086_rp2040_interfacer/pins.c b/ports/raspberrypi/boards/8086_rp2040_interfacer/pins.c new file mode 100644 index 000000000000..07ff7fbe31ad --- /dev/null +++ b/ports/raspberrypi/boards/8086_rp2040_interfacer/pins.c @@ -0,0 +1,48 @@ +// This file is part of the CircuitPython project: https://circuitpython.org +// +// SPDX-FileCopyrightText: Copyright (c) 2021 Scott Shawcroft for Adafruit Industries +// +// SPDX-License-Identifier: MIT + +#include "shared-bindings/board/__init__.h" + +static const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, + + { MP_ROM_QSTR(MP_QSTR_PULL_SDA), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_GP18), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_ROM_QSTR(MP_QSTR_PULL_SCL), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_GP19), MP_ROM_PTR(&pin_GPIO19) }, + + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16) }, + + { MP_ROM_QSTR(MP_QSTR_LED_UART), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_LED_STQW), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_GP23), MP_ROM_PTR(&pin_GPIO23) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);