Skip to content

Commit c9518b0

Browse files
authored
Merge pull request #377 from makermelissa/main
Add Pi500 and CM5 Lite Detection
2 parents 49b6779 + 0c47b07 commit c9518b0

File tree

4 files changed

+68
-30
lines changed

4 files changed

+68
-30
lines changed

.github/workflows/build.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ jobs:
1818
awk -F '\/' '{ print tolower($2) }' |
1919
tr '_' '-'
2020
)
21-
- name: Set up Python 3.7
21+
- name: Set up Python 3.8
2222
uses: actions/setup-python@v4
2323
with:
24-
python-version: 3.7
24+
python-version: 3.8
2525
- name: Versions
2626
run: |
2727
python3 --version

adafruit_platformdetect/board.py

+10
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,16 @@ def any_raspberry_pi_cm(self) -> bool:
946946
"""Check whether the current board is any Compute Module Raspberry Pi."""
947947
return self.id in boards._RASPBERRY_PI_CM_IDS
948948

949+
@property
950+
def any_raspberry_pi_4_board(self) -> bool:
951+
"""Check whether the current board is any Raspberry Pi 4."""
952+
return self.id in boards._RASPBERRY_PI_4_IDS
953+
954+
@property
955+
def any_raspberry_pi_5_board(self) -> bool:
956+
"""Check whether the current board is any Raspberry Pi 5."""
957+
return self.id in boards._RASPBERRY_PI_5_IDS
958+
949959
@property
950960
def any_beaglebone(self) -> bool:
951961
"""Check whether the current board is any Beaglebone-family system."""

adafruit_platformdetect/constants/boards.py

+54-28
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@
147147
RASPBERRY_PI_CM4S = "RASPBERRY_PI_CM4S"
148148
RASPBERRY_PI_5 = "RASPBERRY_PI_5"
149149
RASPBERRY_PI_CM5 = "RASPBERRY_PI_CM5"
150+
RASPBERRY_PI_500 = "RASPBERRY_PI_500"
151+
RASPBERRY_PI_CM5_LITE = "RASPBERRY_PI_CM5_LITE"
150152

151153
ODROID_C1 = "ODROID_C1"
152154
ODROID_C1_PLUS = "ODROID_C1_PLUS"
@@ -412,6 +414,8 @@
412414

413415
_TI_SK_BOARD_IDS = ((TI_J721E_SK, ("ti,j721e-sk", "ti,j721e")),)
414416

417+
# Raspberry Pi boards
418+
415419
_RASPBERRY_PI_40_PIN_IDS = (
416420
RASPBERRY_PI_B_PLUS,
417421
RASPBERRY_PI_A_PLUS,
@@ -426,6 +430,7 @@
426430
RASPBERRY_PI_AVNET_IIOT_GW,
427431
RASPBERRY_PI_400,
428432
RASPBERRY_PI_5,
433+
RASPBERRY_PI_500,
429434
)
430435

431436
_RASPBERRY_PI_CM_IDS = (
@@ -435,8 +440,56 @@
435440
RASPBERRY_PI_CM4,
436441
RASPBERRY_PI_CM4S,
437442
RASPBERRY_PI_CM5,
443+
RASPBERRY_PI_CM5_LITE,
438444
)
439445

446+
# Pi 4 boards have additional peripherals
447+
_RASPBERRY_PI_4_IDS = (
448+
RASPBERRY_PI_4B,
449+
RASPBERRY_PI_CM4,
450+
RASPBERRY_PI_CM4S,
451+
RASPBERRY_PI_400,
452+
)
453+
454+
# Pi 5 boards work differently
455+
_RASPBERRY_PI_5_IDS = (
456+
RASPBERRY_PI_5,
457+
RASPBERRY_PI_CM5,
458+
RASPBERRY_PI_500,
459+
RASPBERRY_PI_CM5_LITE,
460+
)
461+
462+
_PI_MODELS = {
463+
0x00: RASPBERRY_PI_A,
464+
0x01: {
465+
1.0: RASPBERRY_PI_B_REV1,
466+
2.0: RASPBERRY_PI_B_REV2,
467+
},
468+
0x02: RASPBERRY_PI_A_PLUS,
469+
0x03: RASPBERRY_PI_B_PLUS,
470+
0x04: RASPBERRY_PI_2B,
471+
0x06: RASPBERRY_PI_CM1,
472+
0x08: RASPBERRY_PI_3B,
473+
0x09: RASPBERRY_PI_ZERO,
474+
0x0A: RASPBERRY_PI_CM3,
475+
0x0B: RASPBERRY_PI_AVNET_IIOT_GW,
476+
0x0C: RASPBERRY_PI_ZERO_W,
477+
0x0D: RASPBERRY_PI_3B_PLUS,
478+
0x0E: RASPBERRY_PI_3A_PLUS,
479+
0x10: RASPBERRY_PI_CM3_PLUS,
480+
0x11: RASPBERRY_PI_4B,
481+
0x12: RASPBERRY_PI_ZERO_2_W,
482+
0x13: RASPBERRY_PI_400,
483+
0x14: RASPBERRY_PI_CM4,
484+
0x15: RASPBERRY_PI_CM4S,
485+
0x17: RASPBERRY_PI_5,
486+
0x18: RASPBERRY_PI_CM5,
487+
0x19: RASPBERRY_PI_500,
488+
0x1A: RASPBERRY_PI_CM5_LITE,
489+
}
490+
491+
# ODROID boards
492+
440493
_ODROID_40_PIN_IDS = (
441494
ODROID_C1,
442495
ODROID_C1_PLUS,
@@ -526,40 +579,13 @@
526579
BEAGLELOGIC_STANDALONE: (("A", "A335BLGC000A"),),
527580
}
528581

529-
_PI_MODELS = {
530-
0x00: RASPBERRY_PI_A,
531-
0x01: {
532-
1.0: RASPBERRY_PI_B_REV1,
533-
2.0: RASPBERRY_PI_B_REV2,
534-
},
535-
0x02: RASPBERRY_PI_A_PLUS,
536-
0x03: RASPBERRY_PI_B_PLUS,
537-
0x04: RASPBERRY_PI_2B,
538-
0x06: RASPBERRY_PI_CM1,
539-
0x08: RASPBERRY_PI_3B,
540-
0x09: RASPBERRY_PI_ZERO,
541-
0x0A: RASPBERRY_PI_CM3,
542-
0x0B: RASPBERRY_PI_AVNET_IIOT_GW,
543-
0x0C: RASPBERRY_PI_ZERO_W,
544-
0x0D: RASPBERRY_PI_3B_PLUS,
545-
0x0E: RASPBERRY_PI_3A_PLUS,
546-
0x10: RASPBERRY_PI_CM3_PLUS,
547-
0x11: RASPBERRY_PI_4B,
548-
0x12: RASPBERRY_PI_ZERO_2_W,
549-
0x13: RASPBERRY_PI_400,
550-
0x14: RASPBERRY_PI_CM4,
551-
0x15: RASPBERRY_PI_CM4S,
552-
0x17: RASPBERRY_PI_5,
553-
0x18: RASPBERRY_PI_CM5,
554-
}
555-
556582
# Onion omega boards
557583
_ONION_OMEGA_BOARD_IDS = (ONION_OMEGA, ONION_OMEGA2)
558584

559585
# Pine64 boards and devices
560586
_PINE64_DEV_IDS = (PINE64, PINEH64, PINEBOOK, PINEPHONE, SOPINE, QUARTZ64_A)
561587

562-
# Pcduino baords
588+
# Pcduino boards
563589
_PCDUINO_DEV_IDS = (PCDUINO2, PCDUINO3)
564590
# RockPi boards and devices
565591
_ROCK_PI_IDS = (

adafruit_platformdetect/revcodes.py

+2
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@
9797
0x15: "CM4S",
9898
0x17: "5",
9999
0x18: "CM5",
100+
0x19: "500",
101+
0x1A: "CM5 Lite",
100102
}
101103

102104
OLD_MANUFACTURER = (

0 commit comments

Comments
 (0)