From 563108df6701b52403b5a8924ef8f4e768db7255 Mon Sep 17 00:00:00 2001 From: Liz Date: Tue, 11 Apr 2023 10:42:46 -0400 Subject: [PATCH] Adding RFM and CAN feather --- adafruit_platformdetect/board.py | 18 ++++++++++++++++++ adafruit_platformdetect/chip.py | 14 +++++++++++++- adafruit_platformdetect/constants/boards.py | 2 ++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index 30391a58..b1341785 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -648,6 +648,12 @@ def _rp2040_u2if_id(self) -> Optional[str]: # Feather RP2040 ThinkInk if product == 0x812C: return boards.FEATHER_EPD_U2IF + # Feather RP2040 RFM + if product == 0x812E: + return boards.FEATHER_RFM_U2IF + # Feather RP2040 CAN + if product == 0x8130: + return boards.FEATHER_CAN_U2IF # Will only reach here if a device was added in chip.py but here. raise RuntimeError("RP2040_U2IF device was added to chip but not board.") @@ -830,7 +836,9 @@ def lazily_generate_conditions(): yield self.board.GREATFET_ONE yield self.board.PICO_U2IF yield self.board.FEATHER_U2IF + yield self.board.FEATHER_CAN_U2IF yield self.board.FEATHER_EPD_U2IF + yield self.board.FEATHER_RFM_U2IF yield self.board.ITSYBITY_U2IF yield self.board.MACROPAD_U2IF yield self.board.QTPY_U2IF @@ -907,11 +915,21 @@ def feather_u2if(self) -> bool: """Check whether the current board is a Feather RP2040 w/ u2if.""" return self.id == boards.FEATHER_U2IF + @property + def feather_can_u2if(self) -> bool: + """Check whether the current board is a Feather CAN Bus RP2040 w/ u2if.""" + return self.id == boards.FEATHER_CAN_U2IF + @property def feather_epd_u2if(self) -> bool: """Check whether the current board is a Feather ThinkInk RP2040 w/ u2if.""" return self.id == boards.FEATHER_EPD_U2IF + @property + def feather_rfm_u2if(self) -> bool: + """Check whether the current board is a Feather RFM RP2040 w/ u2if.""" + return self.id == boards.FEATHER_RFM_U2IF + @property def itsybitsy_u2if(self) -> bool: """Check whether the current board is a Itsy Bitsy w/ u2if.""" diff --git a/adafruit_platformdetect/chip.py b/adafruit_platformdetect/chip.py index 26d0b027..a5d95390 100644 --- a/adafruit_platformdetect/chip.py +++ b/adafruit_platformdetect/chip.py @@ -118,8 +118,20 @@ def id( # QT2040 Trinkey # MacroPad RP2040 # Feather RP2040 ThinkInk + # Feather RP2040 RFM + # Feather RP2040 CAN Bus vendor == 0x239A - and product in (0x00F1, 0x00FD, 0x00F7, 0x0109, 0x0107, 0x812C) + and product + in ( + 0x00F1, + 0x00FD, + 0x00F7, + 0x0109, + 0x0107, + 0x812C, + 0x812E, + 0x8130, + ) ): self._chip_id = chips.RP2040_U2IF return self._chip_id diff --git a/adafruit_platformdetect/constants/boards.py b/adafruit_platformdetect/constants/boards.py index 6a624917..7b8d5eb9 100644 --- a/adafruit_platformdetect/constants/boards.py +++ b/adafruit_platformdetect/constants/boards.py @@ -147,7 +147,9 @@ # https://github.com/execuc/u2if PICO_U2IF = "PICO_U2IF" FEATHER_U2IF = "FEATHER_U2IF" +FEATHER_CAN_U2IF = "FEATHER_CAN_U2IF" FEATHER_EPD_U2IF = "FEATHER_EPD_U2IF" +FEATHER_RFM_U2IF = "FEATHER_RFM_U2IF" ITSYBITSY_U2IF = "ITSYBITSY_U2IF" MACROPAD_U2IF = "MACROPAD_U2IF" QTPY_U2IF = "QTPY_U2IF"