Skip to content

Commit 43f3fc6

Browse files
authored
Merge pull request #69 from johalun/master
Add Clockwork Pi board
2 parents 34697fe + ee623a3 commit 43f3fc6

File tree

5 files changed

+27
-1
lines changed

5 files changed

+27
-1
lines changed

adafruit_platformdetect/board.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ def id(self):
7373
board_id = self._pynq_id()
7474
elif chip_id == chips.A64:
7575
board_id = self._pine64_id()
76+
elif chip_id == chips.A33:
77+
board_id = self._clockwork_pi_id()
7678
return board_id
7779

7880
# pylint: enable=invalid-name
@@ -252,6 +254,14 @@ def _pynq_id(self):
252254
except FileNotFoundError:
253255
return None
254256

257+
def _clockwork_pi_id(self):
258+
"""Check what type of Clockwork Pi board."""
259+
board_value = self.detector.get_device_model()
260+
board = None
261+
if board_value and "Clockwork CPI3" in board_value:
262+
board = boards.CLOCKWORK_CPI3
263+
return board
264+
255265
@property
256266
def any_96boards(self):
257267
"""Check whether the current board is any 96boards board."""
@@ -322,6 +332,11 @@ def any_pine64_board(self):
322332
"""Check whether the current board is any Pine64 device."""
323333
return self.id in boards._PINE64_DEV_IDS
324334

335+
@property
336+
def any_clockwork_pi_board(self):
337+
"""Check whether the current board is any Clockwork Pi device."""
338+
return self.CLOCKWORK_CPI3
339+
325340
@property
326341
def any_embedded_linux(self):
327342
"""Check whether the current board is any embedded Linux device."""
@@ -331,7 +346,7 @@ def any_embedded_linux(self):
331346
self.any_giant_board, self.any_jetson_board, self.any_coral_board,
332347
self.any_odroid_40_pin, self.any_96boards, self.any_sifive_board,
333348
self.any_onion_omega_board, self.any_pine64_board,
334-
self.any_pynq_board,
349+
self.any_pynq_board, self.any_clockwork_pi_board
335350
]
336351
)
337352

adafruit_platformdetect/chip.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ def _linux_id(self): # pylint: disable=too-many-branches,too-many-statements
6464
if self.detector.check_dt_compatible_value('fu500'):
6565
return chips.HFU540
6666

67+
if self.detector.check_dt_compatible_value('sun8i-a33'):
68+
return chips.A33
69+
6770
linux_id = None
6871
hardware = self.detector.get_cpuinfo_field('Hardware')
6972

adafruit_platformdetect/constants/boards.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
NODEMCU = "NODEMCU"
2525
GIANT_BOARD = "GIANT_BOARD"
2626

27+
# Clockwork Pi boards
28+
CLOCKWORK_CPI3 = "CLOCKWORK_CPI3"
29+
2730
# Orange Pi boards
2831
ORANGE_PI_PC = "ORANGE_PI_PC"
2932
ORANGE_PI_R1 = "ORANGE_PI_R1"

adafruit_platformdetect/constants/chips.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@
2424
MIPS24KEC = "MIPS24KEC"
2525
ZYNQ7000 = "ZYNQ7000"
2626
A64 = "A64"
27+
A33 = "A33"
2728

2829
BCM_RANGE = {'BCM2708', 'BCM2709', 'BCM2711', 'BCM2835', 'BCM2837'}

bin/detect.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
print("Is this a Coral Edge TPU?", detector.board.CORAL_EDGE_TPU_DEV)
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)
22+
print("Is this a Clockwork Pi board?", detector.board.any_clockwork_pi_board)
2223
print("Is this an embedded Linux system?", detector.board.any_embedded_linux)
2324
print("Is this a generic Linux PC?", detector.board.GENERIC_LINUX_PC)
2425
print("Is this an OS environment variable special case?", detector.board.FTDI_FT232H |
@@ -44,3 +45,6 @@
4445

4546
if detector.board.any_pine64_board:
4647
print("Pine64 device detected.")
48+
49+
if detector.board.any_clockwork_pi:
50+
print("Clockwork Pi device detected.")

0 commit comments

Comments
 (0)