Skip to content

Commit 93c4d5c

Browse files
authored
Merge pull request #43 from binhollc/master
Binho Nova integration
2 parents 2eba410 + 6f7af39 commit 93c4d5c

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

adafruit_platformdetect/board.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@
6868

6969
MICROCHIP_MCP2221 = "MICROCHIP_MCP2221"
7070

71+
BINHO_NOVA = "BINHO_NOVA"
72+
7173
# pylint: enable=bad-whitespace
7274

7375
#OrangePI
@@ -339,6 +341,8 @@ def id(self):
339341
board_id = self._sifive_id()
340342
elif chip_id == ap_chip.MCP2221:
341343
board_id = MICROCHIP_MCP2221
344+
elif chip_id == ap_chip.BINHO:
345+
board_id = BINHO_NOVA
342346
return board_id
343347
# pylint: enable=invalid-name
344348

@@ -503,6 +507,11 @@ def microchip_mcp2221(self):
503507
"""Check whether the current board is a Microchip MCP2221."""
504508
return self.id == MICROCHIP_MCP2221
505509

510+
@property
511+
def binho_nova(self):
512+
"""Check whether the current board is an BINHO NOVA."""
513+
return self.id == BINHO_NOVA
514+
506515
def __getattr__(self, attr):
507516
"""
508517
Detect whether the given attribute is the currently-detected board. See list

adafruit_platformdetect/chip.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
FT232H = "FT232H"
2222
HFU540 = "HFU540"
2323
MCP2221 = "MCP2221"
24+
BINHO = "BINHO"
2425

2526
class Chip:
2627
"""Attempt detection of current chip / CPU."""
@@ -54,6 +55,14 @@ def id(self): # pylint: disable=invalid-name,too-many-branches,too-many-return-s
5455
return MCP2221
5556
raise RuntimeError('BLINKA_MCP2221 environment variable ' + \
5657
'set, but no MCP2221 device found')
58+
if os.environ.get('BLINKA_NOVA'):
59+
# Check for Nova connection
60+
from adafruit_blinka.microcontroller.nova import Connection
61+
binho = Connection.getInstance()
62+
if binho is None:
63+
raise RuntimeError('BLINKA_NOVA environment variable ' + \
64+
'set, but no NOVA device found')
65+
return BINHO
5766

5867
platform = sys.platform
5968
if platform == "linux" or platform == "linux2":

0 commit comments

Comments
 (0)