|
17 | 17 | **Software and Dependencies:** |
18 | 18 |
|
19 | 19 | * Linux and Python 3.7 or Higher |
| 20 | +* or MicroPython |
20 | 21 |
|
21 | 22 | """ |
22 | 23 |
|
23 | | -import glob |
| 24 | +try: |
| 25 | + import glob |
| 26 | +except ImportError: |
| 27 | + pass |
24 | 28 | import os |
25 | 29 | import re |
26 | 30 |
|
@@ -101,8 +105,8 @@ def id(self) -> Optional[str]: |
101 | 105 | board_id = boards.FEATHER_M0_EXPRESS |
102 | 106 | elif chip_id == chips.STM32F405: |
103 | 107 | board_id = boards.PYBOARD |
104 | | - elif chip_id == chips.RP2040: |
105 | | - board_id = boards.RASPBERRY_PI_PICO |
| 108 | + elif chip_id in (chips.RP2040, chips.RP2350): |
| 109 | + board_id = self._raspberry_pi_pico_id() |
106 | 110 | elif chip_id == chips.S805: |
107 | 111 | board_id = boards.ODROID_C1 |
108 | 112 | elif chip_id == chips.S905: |
@@ -516,6 +520,20 @@ def _armbian_id(self) -> Optional[str]: |
516 | 520 | board = boards.MILKV_DUO |
517 | 521 | return board |
518 | 522 |
|
| 523 | + @staticmethod |
| 524 | + def _raspberry_pi_pico_id() -> Optional[str]: |
| 525 | + """Try to detect id of a Raspberry Pi Pico.""" |
| 526 | + board_id = os.uname().machine |
| 527 | + if "Raspberry Pi Pico 2 W" in board_id: |
| 528 | + return boards.RASPBERRY_PI_PICO_2_W |
| 529 | + if "Raspberry Pi Pico 2" in board_id: |
| 530 | + return boards.RASPBERRY_PI_PICO_2 |
| 531 | + if "Raspberry Pi Pico W" in board_id: |
| 532 | + return boards.RASPBERRY_PI_PICO_W |
| 533 | + if "Raspberry Pi Pico" in board_id: |
| 534 | + return boards.RASPBERRY_PI_PICO |
| 535 | + return None |
| 536 | + |
519 | 537 | # pylint: enable=too-many-return-statements |
520 | 538 |
|
521 | 539 | def _diet_pi_id(self) -> Optional[str]: |
@@ -1228,6 +1246,11 @@ def any_particle_board(self): |
1228 | 1246 | """Check whether the current board is any Particle device.""" |
1229 | 1247 | return self.id in boards._PARTICLE_IDS |
1230 | 1248 |
|
| 1249 | + @property |
| 1250 | + def any_raspberry_pi_pico_id(self): |
| 1251 | + """Check whether the current board is any Raspberry Pi Pico.""" |
| 1252 | + return self.id in boards._RASPBERRY_PI_PICO_IDS |
| 1253 | + |
1231 | 1254 | @property |
1232 | 1255 | def os_environ_board(self) -> bool: |
1233 | 1256 | """Check whether the current board is an OS environment variable special case.""" |
|
0 commit comments