Skip to content

Commit 309a7d2

Browse files
authored
Merge pull request #77 from makermelissa/master
Added GreatFET One Detection
2 parents ad7120e + 8421507 commit 309a7d2

File tree

5 files changed

+26
-1
lines changed

5 files changed

+26
-1
lines changed

adafruit_platformdetect/board.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ def id(self):
103103
board_id = boards.MICROCHIP_MCP2221
104104
elif chip_id == chips.BINHO:
105105
board_id = boards.BINHO_NOVA
106+
elif chip_id == chips.LPC4330:
107+
board_id = boards.GREATFET_ONE
106108
elif chip_id == chips.MIPS24KC:
107109
board_id = boards.ONION_OMEGA
108110
elif chip_id == chips.MIPS24KEC:
@@ -426,6 +428,11 @@ def binho_nova(self):
426428
"""Check whether the current board is an BINHO NOVA."""
427429
return self.id == boards.BINHO_NOVA
428430

431+
@property
432+
def greatfet_one(self):
433+
"""Check whether the current board is a GreatFET One."""
434+
return self.id == boards.GREATFET_ONE
435+
429436
def __getattr__(self, attr):
430437
"""
431438
Detect whether the given attribute is the currently-detected board. See list

adafruit_platformdetect/chip.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,18 @@ def id(
8787
"BLINKA_MCP2221 environment variable "
8888
+ "set, but no MCP2221 device found"
8989
)
90+
if os.environ.get("BLINKA_GREATFET"):
91+
from greatfet import GreatFET
92+
from greatfet.errors import DeviceNotFoundError
93+
94+
try:
95+
_ = GreatFET()
96+
return chips.LPC4330
97+
except DeviceNotFoundError():
98+
raise RuntimeError(
99+
"BLINKA_GREATFET environment variable "
100+
+ "set, but no GreatFET device found"
101+
)
90102
if os.environ.get("BLINKA_NOVA"):
91103
return chips.BINHO
92104

adafruit_platformdetect/constants/boards.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@
9292

9393
ROCK_PI_S = "ROCK_PI_S"
9494

95+
GREATFET_ONE = "GREATFET_ONE"
96+
9597
# pylint: enable=bad-whitespace
9698

9799
# OrangePI

adafruit_platformdetect/constants/chips.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@
2626
A64 = "A64"
2727
A33 = "A33"
2828
RK3308 = "RK3308"
29+
LPC4330 = "LPC4330"
2930

3031
BCM_RANGE = {"BCM2708", "BCM2709", "BCM2711", "BCM2835", "BCM2837"}

bin/detect.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@
2525
print("Is this a generic Linux PC?", detector.board.GENERIC_LINUX_PC)
2626
print(
2727
"Is this an OS environment variable special case?",
28-
detector.board.FTDI_FT232H | detector.board.MICROCHIP_MCP2221,
28+
detector.board.FTDI_FT232H
29+
| detector.board.MICROCHIP_MCP2221
30+
| detector.board.BINHO_NOVA
31+
| detector.board.GREATFET_ONE,
2932
)
3033

3134
if detector.board.any_raspberry_pi:

0 commit comments

Comments
 (0)