add pico u2if

This commit is contained in:
caternuson 2021-04-19 17:53:27 -07:00
parent 59edca95e6
commit 1ea89bdac7
5 changed files with 26 additions and 1 deletions

View file

@ -151,6 +151,8 @@ class Board:
board_id = self._stm32mp1_id()
elif chip_id == chips.MT8167:
board_id = boards.CORAL_EDGE_TPU_DEV_MINI
elif chip_id == chips.PICO_U2IF:
board_id = boards.PICO_U2IF
self._board_id = board_id
return board_id
@ -559,6 +561,11 @@ class Board:
"""Check whether the current board is a Microchip MCP2221."""
return self.id == boards.MICROCHIP_MCP2221
@property
def pico_u2if(self):
"""Check whether the current board is a RPi Pico w/ u2if."""
return self.id == boards.PICO_U2IF
@property
def binho_nova(self):
"""Check whether the current board is an BINHO NOVA."""

View file

@ -107,6 +107,18 @@ class Chip:
"BLINKA_MCP2221 environment variable "
+ "set, but no MCP2221 device found"
)
if os.environ.get("BLINKA_PICO_U2IF"):
import hid
# look for it based on PID/VID
for dev in hid.enumerate():
if dev["vendor_id"] == 0xCAFE and dev["product_id"] == 0x4005:
self._chip_id = chips.PICO_U2IF
return self._chip_id
raise RuntimeError(
"BLINKA_PICO_U2IF environment variable "
+ "set, but no Pico device found"
)
if os.environ.get("BLINKA_GREATFET"):
import usb

View file

@ -111,6 +111,10 @@ SIFIVE_UNLEASHED = "SIFIVE_UNLEASHED"
MICROCHIP_MCP2221 = "MICROCHIP_MCP2221"
# Raspberry Pi Pico with u2if firmware
# https://github.com/execuc/u2if
PICO_U2IF = "PICO_U2IF"
BINHO_NOVA = "BINHO_NOVA"
ONION_OMEGA = "ONION_OMEGA"

View file

@ -42,5 +42,6 @@ STM32F405 = "STM32F405"
STM32MP157 = "STM32MP157"
MT8167 = "MT8167"
ATOM_X5_Z8350 = "X5-Z8350"
PICO_U2IF = "PICO_U2IF"
BCM_RANGE = {"BCM2708", "BCM2709", "BCM2711", "BCM2835", "BCM2837"}

View file

@ -33,7 +33,8 @@ print(
| detector.board.FTDI_FT2232H
| detector.board.MICROCHIP_MCP2221
| detector.board.BINHO_NOVA
| detector.board.GREATFET_ONE,
| detector.board.GREATFET_ONE
| detector.board.PICO_U2IF,
)
if detector.board.any_raspberry_pi: