Skip to content

Add support to FT4232H #382

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions adafruit_platformdetect/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ def id(self) -> Optional[str]:
board_id = boards.FTDI_FT232H
elif chip_id == chips.FT2232H:
board_id = boards.FTDI_FT2232H
elif chip_id == chips.FT4232H:
board_id = boards.FTDI_FT4232H
elif chip_id == chips.APQ8016:
board_id = boards.DRAGONBOARD_410C
elif chip_id in (chips.T210, chips.T186, chips.T194, chips.T234):
Expand Down Expand Up @@ -1133,6 +1135,7 @@ def os_environ_board(self) -> bool:
def lazily_generate_conditions():
yield self.board.FTDI_FT232H
yield self.board.FTDI_FT2232H
yield self.board.FTDI_FT4232H
yield self.board.MICROCHIP_MCP2221
yield self.board.BINHO_NOVA
yield self.board.GREATFET_ONE
Expand Down Expand Up @@ -1216,6 +1219,11 @@ def ftdi_ft2232h(self) -> bool:
"""Check whether the current board is an FTDI FT2232H."""
return self.id == boards.FTDI_FT2232H

@property
def ftdi_ft4232h(self) -> bool:
"""Check whether the current board is an FTDI FT4232H."""
return self.id == boards.FTDI_FT4232H

@property
def microchip_mcp2221(self) -> bool:
"""Check whether the current board is a Microchip MCP2221."""
Expand Down
12 changes: 12 additions & 0 deletions adafruit_platformdetect/chip.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,18 @@ def id(
)
self._chip_id = chips.FT2232H
return self._chip_id
if os.environ.get("BLINKA_FT4232H"):
from pyftdi.usbtools import UsbTools

# look for it based on PID/VID
count = len(UsbTools.find_all([(0x0403, 0x6011)]))
if count == 0:
raise RuntimeError(
"BLINKA_FT4232H environment variable "
+ "set, but no FT4232H device found"
)
self._chip_id = chips.FT4232H
return self._chip_id
if os.environ.get("BLINKA_MCP2221"):
import hid

Expand Down
1 change: 1 addition & 0 deletions adafruit_platformdetect/constants/boards.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@

FTDI_FT232H = "FTDI_FT232H"
FTDI_FT2232H = "FTDI_FT2232H"
FTDI_FT4232H = "FTDI_FT4232H"
DRAGONBOARD_410C = "DRAGONBOARD_410C"

SIFIVE_UNLEASHED = "SIFIVE_UNLEASHED"
Expand Down
1 change: 1 addition & 0 deletions adafruit_platformdetect/constants/chips.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
GENERIC_X86 = "GENERIC_X86"
FT232H = "FT232H"
FT2232H = "FT2232H"
FT4232H = "FT4232H"
HFU540 = "HFU540"
C906 = "C906"
JH71X0 = "JH71X0"
Expand Down
Loading