From a9dba12376a0cb58b1267a12e9603ce7348e0fbc Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Wed, 15 Jan 2025 11:43:13 -0800 Subject: [PATCH 1/3] Add Pi500 and CM5 Lite Detection --- adafruit_platformdetect/board.py | 10 +++ adafruit_platformdetect/constants/boards.py | 82 ++++++++++++++------- adafruit_platformdetect/revcodes.py | 2 + 3 files changed, 66 insertions(+), 28 deletions(-) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index 4acac9d4..5c1ade88 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -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.""" diff --git a/adafruit_platformdetect/constants/boards.py b/adafruit_platformdetect/constants/boards.py index 4f9d3a7e..392b4100 100644 --- a/adafruit_platformdetect/constants/boards.py +++ b/adafruit_platformdetect/constants/boards.py @@ -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" @@ -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, @@ -426,6 +430,7 @@ RASPBERRY_PI_AVNET_IIOT_GW, RASPBERRY_PI_400, RASPBERRY_PI_5, + RASPBERRY_PI_500, ) _RASPBERRY_PI_CM_IDS = ( @@ -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, @@ -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 = ( diff --git a/adafruit_platformdetect/revcodes.py b/adafruit_platformdetect/revcodes.py index a2eb1c1b..b5f02e1e 100644 --- a/adafruit_platformdetect/revcodes.py +++ b/adafruit_platformdetect/revcodes.py @@ -97,6 +97,8 @@ 0x15: "CM4S", 0x17: "5", 0x18: "CM5", + 0x19: "500", + 0x1A: "CM5 Lite", } OLD_MANUFACTURER = ( From 95b773e52aef11bfae802383d04b6f01b74e888f Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Wed, 15 Jan 2025 12:47:42 -0800 Subject: [PATCH 2/3] Update python version to 3.7.x --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a23e5047..bb0d79ef 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ jobs: - name: Set up Python 3.7 uses: actions/setup-python@v4 with: - python-version: 3.7 + python-version: '3.7.x' - name: Versions run: | python3 --version From 0c47b07c95bdb6b8afba68902632fd918a17169a Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Wed, 15 Jan 2025 12:53:22 -0800 Subject: [PATCH 3/3] Update python version to 3.8 --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bb0d79ef..52a72c1f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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.x' + python-version: 3.8 - name: Versions run: | python3 --version