Skip to content

Commit 7b80288

Browse files
authored
Merge pull request #382 from mrv96/ft4232h
Add support to FT4232H
2 parents 9679fba + 3f346a6 commit 7b80288

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

adafruit_platformdetect/board.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ def id(self) -> Optional[str]:
118118
board_id = boards.FTDI_FT232H
119119
elif chip_id == chips.FT2232H:
120120
board_id = boards.FTDI_FT2232H
121+
elif chip_id == chips.FT4232H:
122+
board_id = boards.FTDI_FT4232H
121123
elif chip_id == chips.APQ8016:
122124
board_id = boards.DRAGONBOARD_410C
123125
elif chip_id in (chips.T210, chips.T186, chips.T194, chips.T234):
@@ -1162,6 +1164,7 @@ def os_environ_board(self) -> bool:
11621164
def lazily_generate_conditions():
11631165
yield self.board.FTDI_FT232H
11641166
yield self.board.FTDI_FT2232H
1167+
yield self.board.FTDI_FT4232H
11651168
yield self.board.MICROCHIP_MCP2221
11661169
yield self.board.BINHO_NOVA
11671170
yield self.board.GREATFET_ONE
@@ -1245,6 +1248,11 @@ def ftdi_ft2232h(self) -> bool:
12451248
"""Check whether the current board is an FTDI FT2232H."""
12461249
return self.id == boards.FTDI_FT2232H
12471250

1251+
@property
1252+
def ftdi_ft4232h(self) -> bool:
1253+
"""Check whether the current board is an FTDI FT4232H."""
1254+
return self.id == boards.FTDI_FT4232H
1255+
12481256
@property
12491257
def microchip_mcp2221(self) -> bool:
12501258
"""Check whether the current board is a Microchip MCP2221."""

adafruit_platformdetect/chip.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,18 @@ def id(
8484
)
8585
self._chip_id = chips.FT2232H
8686
return self._chip_id
87+
if os.environ.get("BLINKA_FT4232H"):
88+
from pyftdi.usbtools import UsbTools
89+
90+
# look for it based on PID/VID
91+
count = len(UsbTools.find_all([(0x0403, 0x6011)]))
92+
if count == 0:
93+
raise RuntimeError(
94+
"BLINKA_FT4232H environment variable "
95+
+ "set, but no FT4232H device found"
96+
)
97+
self._chip_id = chips.FT4232H
98+
return self._chip_id
8799
if os.environ.get("BLINKA_MCP2221"):
88100
import hid
89101

adafruit_platformdetect/constants/boards.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@
164164

165165
FTDI_FT232H = "FTDI_FT232H"
166166
FTDI_FT2232H = "FTDI_FT2232H"
167+
FTDI_FT4232H = "FTDI_FT4232H"
167168
DRAGONBOARD_410C = "DRAGONBOARD_410C"
168169

169170
SIFIVE_UNLEASHED = "SIFIVE_UNLEASHED"

adafruit_platformdetect/constants/chips.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
GENERIC_X86 = "GENERIC_X86"
3939
FT232H = "FT232H"
4040
FT2232H = "FT2232H"
41+
FT4232H = "FT4232H"
4142
HFU540 = "HFU540"
4243
C906 = "C906"
4344
JH71X0 = "JH71X0"

0 commit comments

Comments
 (0)