Skip to content

Commit f0f7441

Browse files
author
root
committed
Add 8086 USB Interposer
1 parent 95dbb18 commit f0f7441

File tree

5 files changed

+131
-0
lines changed

5 files changed

+131
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// This file is part of the CircuitPython project: https://circuitpython.org
2+
//
3+
// SPDX-FileCopyrightText: Copyright (c) 2021 Scott Shawcroft for Adafruit Industries
4+
//
5+
// SPDX-License-Identifier: MIT
6+
7+
#include "supervisor/board.h"
8+
9+
#include "shared-bindings/digitalio/DigitalInOut.h"
10+
#include "shared-bindings/usb_host/Port.h"
11+
#include "hardware/gpio.h"
12+
13+
// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here.
14+
15+
digitalio_digitalinout_obj_t _host_power;
16+
17+
bool board_reset_pin_number(uint8_t pin_number) {
18+
if (pin_number == 18) {
19+
// doing this (rather than gpio_init) in this specific order ensures no
20+
// glitch if pin was already configured as a high output. gpio_init() temporarily
21+
// configures the pin as an input, so the power enable value would potentially
22+
// glitch.
23+
gpio_put(pin_number, 1);
24+
gpio_set_dir(pin_number, GPIO_OUT);
25+
gpio_set_function(pin_number, GPIO_FUNC_SIO);
26+
27+
return true;
28+
}
29+
return false;
30+
}
31+
void board_init(void) {
32+
common_hal_usb_host_port_construct(&pin_GPIO16, &pin_GPIO17);
33+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// This file is part of the CircuitPython project: https://circuitpython.org
2+
//
3+
// SPDX-FileCopyrightText: Copyright (c) 2021 Scott Shawcroft for Adafruit Industries
4+
//
5+
// SPDX-License-Identifier: MIT
6+
7+
#pragma once
8+
9+
#define MICROPY_HW_BOARD_NAME "8086 USB Interposer"
10+
#define MICROPY_HW_MCU_NAME "rp2040"
11+
12+
#define MICROPY_HW_LED_STATUS (&pin_GPIO7)
13+
14+
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO15)
15+
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO14)
16+
17+
#define DEFAULT_UART_BUS_RX (&pin_GPIO1)
18+
#define DEFAULT_UART_BUS_TX (&pin_GPIO0)
19+
20+
// #define CIRCUITPY_CONSOLE_UART_RX DEFAULT_UART_BUS_RX
21+
// #define CIRCUITPY_CONSOLE_UART_TX DEFAULT_UART_BUS_TX
22+
23+
#define CIRCUITPY_USB_HOST_INSTANCE 1
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
USB_VID = 0x3171
2+
USB_PID = 0x010C
3+
USB_PRODUCT = "USB Interposer"
4+
USB_MANUFACTURER = "8086 Consultancy"
5+
6+
CHIP_VARIANT = RP2040
7+
CHIP_FAMILY = rp2
8+
9+
EXTERNAL_FLASH_DEVICES = "W25Q128JVxQ"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// This file is part of the CircuitPython project: https://circuitpython.org
2+
//
3+
// SPDX-FileCopyrightText: Copyright (c) 2021 Scott Shawcroft for Adafruit Industries
4+
//
5+
// SPDX-License-Identifier: MIT
6+
7+
#pragma once
8+
9+
// Put board-specific pico-sdk definitions here. This file must exist.
10+
11+
// Allow extra time for xosc to start.
12+
#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// This file is part of the CircuitPython project: https://circuitpython.org
2+
//
3+
// SPDX-FileCopyrightText: Copyright (c) 2021 Scott Shawcroft for Adafruit Industries
4+
//
5+
// SPDX-License-Identifier: MIT
6+
7+
#include "shared-bindings/board/__init__.h"
8+
9+
static const mp_rom_map_elem_t board_module_globals_table[] = {
10+
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
11+
12+
{ MP_ROM_QSTR(MP_QSTR_ADC_VBUS_IN), MP_ROM_PTR(&pin_GPIO26) },
13+
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) },
14+
15+
{ MP_ROM_QSTR(MP_QSTR_ADC_VBUS_OUT), MP_ROM_PTR(&pin_GPIO27) },
16+
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) },
17+
18+
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO7) },
19+
{ MP_ROM_QSTR(MP_QSTR_LED_TOP_RED), MP_ROM_PTR(&pin_GPIO7) },
20+
{ MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7) },
21+
22+
{ MP_ROM_QSTR(MP_QSTR_LED_TOP_AMBER), MP_ROM_PTR(&pin_GPIO8) },
23+
{ MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8) },
24+
25+
{ MP_ROM_QSTR(MP_QSTR_LED_BOTTOM_RED), MP_ROM_PTR(&pin_GPIO22) },
26+
{ MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO22) },
27+
28+
{ MP_ROM_QSTR(MP_QSTR_LED_BOTTOM_AMBER), MP_ROM_PTR(&pin_GPIO23) },
29+
{ MP_ROM_QSTR(MP_QSTR_GP23), MP_ROM_PTR(&pin_GPIO23) },
30+
31+
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO1) },
32+
{ MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1) },
33+
34+
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO0) },
35+
{ MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0) },
36+
37+
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO14) },
38+
{ MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14) },
39+
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO15) },
40+
{ MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO15) },
41+
42+
{ MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO12) },
43+
{ MP_ROM_QSTR(MP_QSTR_BOOT), MP_ROM_PTR(&pin_GPIO12) },
44+
{ MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12) },
45+
46+
{ MP_ROM_QSTR(MP_QSTR_USB_HOST_DATA_PLUS), MP_ROM_PTR(&pin_GPIO16) },
47+
{ MP_ROM_QSTR(MP_QSTR_USB_HOST_DATA_MINUS), MP_ROM_PTR(&pin_GPIO17) },
48+
{ MP_ROM_QSTR(MP_QSTR_USB_HOST_5V_POWER), MP_ROM_PTR(&pin_GPIO18) },
49+
50+
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
51+
{ MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) },
52+
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
53+
};
54+
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);

0 commit comments

Comments
 (0)