From 58bb49c07fb4592193ec80f8fbcde80072ac3f9e Mon Sep 17 00:00:00 2001 From: MoseMueller <58481522+MoseMueller@users.noreply.github.com> Date: Mon, 18 Oct 2021 09:42:05 +0200 Subject: [PATCH 1/2] Update board.py Adding support for bananaPi M(P)2 Zero detection. When trying to initialise I2C for the BPI, busio.py from adafruit_blinka was always trying to import `adafruit_blinka.microcontroller.generic_micropython.i2c` which imported `machine` (not found by python). As the file `constants/boards.py` contained the BPI board I figured it should also be included in this file as "any embedded linux". This works for my BananaPi P2 Zero. --- adafruit_platformdetect/board.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index 30412f2e..bbeaf9cf 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -598,6 +598,11 @@ def any_asus_tinker_board(self): def any_stm32mp1(self): """Check whether the current board is any stm32mp1 board.""" return self.id in boards._STM32MP1_IDS + + @property + def any_bananapi(self): + """Check whether the current board is any BananaPi-family system.""" + return self.id in boards._BANANA_PI_IDS @property def any_embedded_linux(self): @@ -624,6 +629,7 @@ def any_embedded_linux(self): self.any_asus_tinker_board, self.any_stm32mp1, self.any_lubancat, + self.any_bananapi, ] ) From cc2eee8b0e1805317f18390518a9ea7a24d343d5 Mon Sep 17 00:00:00 2001 From: Mose Mueller Date: Thu, 21 Oct 2021 09:12:05 +0200 Subject: [PATCH 2/2] Formatting board.py with black --- adafruit_platformdetect/board.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adafruit_platformdetect/board.py b/adafruit_platformdetect/board.py index bbeaf9cf..8458d73c 100644 --- a/adafruit_platformdetect/board.py +++ b/adafruit_platformdetect/board.py @@ -598,11 +598,11 @@ def any_asus_tinker_board(self): def any_stm32mp1(self): """Check whether the current board is any stm32mp1 board.""" return self.id in boards._STM32MP1_IDS - + @property def any_bananapi(self): """Check whether the current board is any BananaPi-family system.""" - return self.id in boards._BANANA_PI_IDS + return self.id in boards._BANANA_PI_IDS @property def any_embedded_linux(self):