Skip to content

Commit

Permalink
Merge pull request #377 from makermelissa/main
Browse files Browse the repository at this point in the history
Add Pi500 and CM5 Lite Detection
  • Loading branch information
tannewt authored Jan 16, 2025
2 parents 49b6779 + 0c47b07 commit c9518b0
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 30 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:
awk -F '\/' '{ print tolower($2) }' |
tr '_' '-'
)
- name: Set up Python 3.7
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.8
- name: Versions
run: |
python3 --version
Expand Down
10 changes: 10 additions & 0 deletions adafruit_platformdetect/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,16 @@ def any_raspberry_pi_cm(self) -> bool:
"""Check whether the current board is any Compute Module Raspberry Pi."""
return self.id in boards._RASPBERRY_PI_CM_IDS

@property
def any_raspberry_pi_4_board(self) -> bool:
"""Check whether the current board is any Raspberry Pi 4."""
return self.id in boards._RASPBERRY_PI_4_IDS

@property
def any_raspberry_pi_5_board(self) -> bool:
"""Check whether the current board is any Raspberry Pi 5."""
return self.id in boards._RASPBERRY_PI_5_IDS

@property
def any_beaglebone(self) -> bool:
"""Check whether the current board is any Beaglebone-family system."""
Expand Down
82 changes: 54 additions & 28 deletions adafruit_platformdetect/constants/boards.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@
RASPBERRY_PI_CM4S = "RASPBERRY_PI_CM4S"
RASPBERRY_PI_5 = "RASPBERRY_PI_5"
RASPBERRY_PI_CM5 = "RASPBERRY_PI_CM5"
RASPBERRY_PI_500 = "RASPBERRY_PI_500"
RASPBERRY_PI_CM5_LITE = "RASPBERRY_PI_CM5_LITE"

ODROID_C1 = "ODROID_C1"
ODROID_C1_PLUS = "ODROID_C1_PLUS"
Expand Down Expand Up @@ -412,6 +414,8 @@

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

# Raspberry Pi boards

_RASPBERRY_PI_40_PIN_IDS = (
RASPBERRY_PI_B_PLUS,
RASPBERRY_PI_A_PLUS,
Expand All @@ -426,6 +430,7 @@
RASPBERRY_PI_AVNET_IIOT_GW,
RASPBERRY_PI_400,
RASPBERRY_PI_5,
RASPBERRY_PI_500,
)

_RASPBERRY_PI_CM_IDS = (
Expand All @@ -435,8 +440,56 @@
RASPBERRY_PI_CM4,
RASPBERRY_PI_CM4S,
RASPBERRY_PI_CM5,
RASPBERRY_PI_CM5_LITE,
)

# Pi 4 boards have additional peripherals
_RASPBERRY_PI_4_IDS = (
RASPBERRY_PI_4B,
RASPBERRY_PI_CM4,
RASPBERRY_PI_CM4S,
RASPBERRY_PI_400,
)

# Pi 5 boards work differently
_RASPBERRY_PI_5_IDS = (
RASPBERRY_PI_5,
RASPBERRY_PI_CM5,
RASPBERRY_PI_500,
RASPBERRY_PI_CM5_LITE,
)

_PI_MODELS = {
0x00: RASPBERRY_PI_A,
0x01: {
1.0: RASPBERRY_PI_B_REV1,
2.0: RASPBERRY_PI_B_REV2,
},
0x02: RASPBERRY_PI_A_PLUS,
0x03: RASPBERRY_PI_B_PLUS,
0x04: RASPBERRY_PI_2B,
0x06: RASPBERRY_PI_CM1,
0x08: RASPBERRY_PI_3B,
0x09: RASPBERRY_PI_ZERO,
0x0A: RASPBERRY_PI_CM3,
0x0B: RASPBERRY_PI_AVNET_IIOT_GW,
0x0C: RASPBERRY_PI_ZERO_W,
0x0D: RASPBERRY_PI_3B_PLUS,
0x0E: RASPBERRY_PI_3A_PLUS,
0x10: RASPBERRY_PI_CM3_PLUS,
0x11: RASPBERRY_PI_4B,
0x12: RASPBERRY_PI_ZERO_2_W,
0x13: RASPBERRY_PI_400,
0x14: RASPBERRY_PI_CM4,
0x15: RASPBERRY_PI_CM4S,
0x17: RASPBERRY_PI_5,
0x18: RASPBERRY_PI_CM5,
0x19: RASPBERRY_PI_500,
0x1A: RASPBERRY_PI_CM5_LITE,
}

# ODROID boards

_ODROID_40_PIN_IDS = (
ODROID_C1,
ODROID_C1_PLUS,
Expand Down Expand Up @@ -526,40 +579,13 @@
BEAGLELOGIC_STANDALONE: (("A", "A335BLGC000A"),),
}

_PI_MODELS = {
0x00: RASPBERRY_PI_A,
0x01: {
1.0: RASPBERRY_PI_B_REV1,
2.0: RASPBERRY_PI_B_REV2,
},
0x02: RASPBERRY_PI_A_PLUS,
0x03: RASPBERRY_PI_B_PLUS,
0x04: RASPBERRY_PI_2B,
0x06: RASPBERRY_PI_CM1,
0x08: RASPBERRY_PI_3B,
0x09: RASPBERRY_PI_ZERO,
0x0A: RASPBERRY_PI_CM3,
0x0B: RASPBERRY_PI_AVNET_IIOT_GW,
0x0C: RASPBERRY_PI_ZERO_W,
0x0D: RASPBERRY_PI_3B_PLUS,
0x0E: RASPBERRY_PI_3A_PLUS,
0x10: RASPBERRY_PI_CM3_PLUS,
0x11: RASPBERRY_PI_4B,
0x12: RASPBERRY_PI_ZERO_2_W,
0x13: RASPBERRY_PI_400,
0x14: RASPBERRY_PI_CM4,
0x15: RASPBERRY_PI_CM4S,
0x17: RASPBERRY_PI_5,
0x18: RASPBERRY_PI_CM5,
}

# Onion omega boards
_ONION_OMEGA_BOARD_IDS = (ONION_OMEGA, ONION_OMEGA2)

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

# Pcduino baords
# Pcduino boards
_PCDUINO_DEV_IDS = (PCDUINO2, PCDUINO3)
# RockPi boards and devices
_ROCK_PI_IDS = (
Expand Down
2 changes: 2 additions & 0 deletions adafruit_platformdetect/revcodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@
0x15: "CM4S",
0x17: "5",
0x18: "CM5",
0x19: "500",
0x1A: "CM5 Lite",
}

OLD_MANUFACTURER = (
Expand Down

0 comments on commit c9518b0

Please sign in to comment.