Skip to content

Commit b25f2d6

Browse files
authored
Merge pull request #138 from makermelissa/master
Add NanoPi NEO Air and NanoPi Duo2 detection
2 parents c57f666 + 4574565 commit b25f2d6

File tree

3 files changed

+33
-12
lines changed

3 files changed

+33
-12
lines changed

adafruit_platformdetect/board.py

+22-12
Original file line numberDiff line numberDiff line change
@@ -249,30 +249,34 @@ def _armbian_id(self):
249249

250250
if board_value == "orangepipc":
251251
board = boards.ORANGE_PI_PC
252-
if board_value == "orangepi-r1":
252+
elif board_value == "orangepi-r1":
253253
board = boards.ORANGE_PI_R1
254-
if board_value == "orangepizero":
254+
elif board_value == "orangepizero":
255255
board = boards.ORANGE_PI_ZERO
256-
if board_value == "orangepione":
256+
elif board_value == "orangepione":
257257
board = boards.ORANGE_PI_ONE
258-
if board_value == "orangepilite":
258+
elif board_value == "orangepilite":
259259
board = boards.ORANGE_PI_LITE
260-
if board_value == "orangepiplus2e":
260+
elif board_value == "orangepiplus2e":
261261
board = boards.ORANGE_PI_PLUS_2E
262-
if board_value == "orangepipcplus":
262+
elif board_value == "orangepipcplus":
263263
board = boards.ORANGE_PI_PC_PLUS
264-
if board_value == "pinebook-a64":
264+
elif board_value == "pinebook-a64":
265265
board = boards.PINEBOOK
266-
if board_value == "pineH64":
266+
elif board_value == "pineH64":
267267
board = boards.PINEH64
268-
if board_value == "orangepi2":
268+
elif board_value == "orangepi2":
269269
board = boards.ORANGE_PI_2
270-
if board_value == "bananapim2zero":
270+
elif board_value == "bananapim2zero":
271271
board = boards.BANANA_PI_M2_ZERO
272-
if board_value == "orangepizeroplus2-h5":
272+
elif board_value == "orangepizeroplus2-h5":
273273
board = boards.ORANGE_PI_ZERO_PLUS_2H5
274-
if board_value == "orangepizeroplus":
274+
elif board_value == "orangepizeroplus":
275275
board = boards.ORANGE_PI_ZERO_PLUS
276+
elif board_value == "nanopiair":
277+
board = boards.NANOPI_NEO_AIR
278+
elif board_value == "nanopiduo2":
279+
board = boards.NANOPI_DUO2
276280

277281
return board
278282

@@ -398,6 +402,11 @@ def _asus_tinker_board_id(self):
398402
board = boards._ASUS_TINKER_BOARD_IDS
399403
return board
400404

405+
@property
406+
def any_nanopi(self):
407+
"""Check whether the current board is any defined Nano Pi."""
408+
return self.id in boards._NANOPI_IDS
409+
401410
@property
402411
def any_96boards(self):
403412
"""Check whether the current board is any 96boards board."""
@@ -506,6 +515,7 @@ def any_embedded_linux(self):
506515
self.any_raspberry_pi,
507516
self.any_beaglebone,
508517
self.any_orange_pi,
518+
self.any_nanopi,
509519
self.any_giant_board,
510520
self.any_jetson_board,
511521
self.any_coral_board,

adafruit_platformdetect/constants/boards.py

+10
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@
4343
ORANGE_PI_ZERO_PLUS_2H5 = "ORANGE_PI_ZERO_PLUS_2H5"
4444
ORANGE_PI_ZERO_PLUS = "ORANGE_PI_ZERO_PLUS"
4545

46+
# Nano Pi boards
47+
NANOPI_NEO_AIR = "NANOPI_NEO_AIR"
48+
NANOPI_DUO2 = "NANOPI_DUO2"
49+
4650
# Banana Pi boards
4751
BANANA_PI_M2_ZERO = "BANANA_PI_M2_ZERO"
4852

@@ -147,6 +151,12 @@
147151
ORANGE_PI_ZERO_PLUS,
148152
)
149153

154+
# NanoPi
155+
_NANOPI_IDS = (
156+
NANOPI_NEO_AIR,
157+
NANOPI_DUO2,
158+
)
159+
150160
# BananaPI
151161
_BANANA_PI_IDS = (BANANA_PI_M2_ZERO,)
152162

bin/detect.py

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
print("Is this a SiFive Unleashed? ", detector.board.SIFIVE_UNLEASHED)
2121
print("Is this a PYNQ Board?", detector.board.PYNQ_Z1 | detector.board.PYNQ_Z2)
2222
print("Is this a Rock Pi board?", detector.board.any_rock_pi_board)
23+
print("Is this a NanoPi board?", detector.board.any_nanopi)
2324
print("Is this a Clockwork Pi board?", detector.board.any_clockwork_pi_board)
2425
print("Is this an embedded Linux system?", detector.board.any_embedded_linux)
2526
print("Is this a generic Linux PC?", detector.board.GENERIC_LINUX_PC)

0 commit comments

Comments
 (0)