From: Ryan L Date: Sat, 15 Apr 2023 20:30:43 +0000 (+0100) Subject: Merge remote-tracking branch 'adafruit/main' X-Git-Tag: 8.23.0~1^2~11 X-Git-Url: https://git.ayoreis.com/Adafruit_Blinka-hackapet.git/commitdiff_plain/7ed38d8a5d513ca1bc04cd491079069f45841744?hp=8e95d4f5241b3c05878edac1c66e50dc2d736c19 Merge remote-tracking branch 'adafruit/main' --- diff --git a/src/adafruit_blinka/board/beagleboard/beaglebone_blue.py b/src/adafruit_blinka/board/beagleboard/beaglebone_blue.py new file mode 100644 index 0000000..47f038f --- /dev/null +++ b/src/adafruit_blinka/board/beagleboard/beaglebone_blue.py @@ -0,0 +1,14 @@ +# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries +# +# SPDX-License-Identifier: MIT +"""Pin definitions for the Beaglebone Blue.""" +from adafruit_blinka.microcontroller.am335x import pin + +# common to all beagles +LED_USR0 = pin.USR0 +LED_USR1 = pin.USR1 +LED_USR2 = pin.USR2 +LED_USR3 = pin.USR3 + +SDA = pin.I2C1_SDA +SCL = pin.I2C1_SCL diff --git a/src/adafruit_blinka/board/coral_dev_board.py b/src/adafruit_blinka/board/coral_dev_board.py index 04fcbde..943ef36 100644 --- a/src/adafruit_blinka/board/coral_dev_board.py +++ b/src/adafruit_blinka/board/coral_dev_board.py @@ -8,6 +8,9 @@ from adafruit_blinka.microcontroller.nxp_imx8m import pin # Board name = RPI name [= alias] = pin name I2C2_SDA = D2 = SDA = pin.I2C2_SDA I2C2_SCL = D3 = SCL = pin.I2C2_SCL +I2C3_SDA = SDA3 = pin.I2C3_SDA +I2C3_SCL = SCL3 = pin.I2C3_SCL + PWM1 = D12 = pin.PWM1 PWM2 = D13 = pin.PWM2 diff --git a/src/adafruit_blinka/board/feather_can_u2if.py b/src/adafruit_blinka/board/feather_can_u2if.py new file mode 100644 index 0000000..d53d290 --- /dev/null +++ b/src/adafruit_blinka/board/feather_can_u2if.py @@ -0,0 +1,64 @@ +# SPDX-FileCopyrightText: 2023 Liz Clark for Adafruit Industries +# +# SPDX-License-Identifier: MIT +""" +Pin definitions for the Feather RP2040 CAN with u2if firmware. + +Adafruit CircuitPython 6.2.0 on 2021-04-05; Adafruit Feather RP2040 CAN with rp2040 +>>> import board +>>> board. +A0 A1 A2 A3 +D0 D1 D10 D11 +D12 D13 D24 D25 +D4 D5 D6 D9 +I2C SDA SCL LED +NEOPIXEL SPI SCK MISO +MOSI RX TX UART +CAN_STANDBY CAN_TX0_RTS CAN_RESET CAN_CS +CAN_INTERRUPT CAN_RX0_BF NEOPIXEL_POWER +""" + +from adafruit_blinka.microcontroller.rp2040_u2if import pin + +D0 = RX = pin.GP1 +D1 = TX = pin.GP0 +D4 = pin.GP4 +D5 = pin.GP5 +D6 = pin.GP6 +D9 = pin.GP9 +D10 = pin.GP10 +D11 = pin.GP11 +D12 = pin.GP12 +D13 = pin.GP13 +D24 = pin.GP24 +D25 = pin.GP25 + +A0 = pin.GP26 +A1 = pin.GP27 +A2 = pin.GP28 +A3 = pin.GP29 + +LED = pin.GP13 + +BUTTON = BOOT = pin.GP7 + +NEOPIXEL = pin.GP21 +NEOPIXEL_POWER = pin.GP20 + +SDA = pin.GP2 +SCL = pin.GP3 + +SCLK = SCK = pin.GP14 +MOSI = pin.GP15 +MISO = pin.GP8 + +CAN_STANDBY = pin.GP16 +CAN_TX0_RTS = pin.GP17 +CAN_RESET = pin.GP18 +CAN_CS = pin.GP19 +CAN_INTERRUPT = pin.GP22 +CAN_RX0_BF = pin.GP23 + +# access u2if via pin instance to open for specifc VID/PID +# pylint:disable = protected-access +pin.GP0._u2if_open_hid(0x239A, 0x8130) diff --git a/src/adafruit_blinka/board/feather_epd_u2if.py b/src/adafruit_blinka/board/feather_epd_u2if.py new file mode 100644 index 0000000..f31096f --- /dev/null +++ b/src/adafruit_blinka/board/feather_epd_u2if.py @@ -0,0 +1,64 @@ +# SPDX-FileCopyrightText: 2023 Liz Clark for Adafruit Industries +# +# SPDX-License-Identifier: MIT +""" +Pin definitions for the Feather RP2040 ThinkInk with u2if firmware. + +Adafruit CircuitPython 6.2.0 on 2021-04-05; Adafruit Feather RP2040 ThinkInk with rp2040 +>>> import board +>>> board. +A0 A1 A2 A3 +D0 D1 D10 D11 +D12 D13 D24 D25 +D4 D5 D6 D9 +I2C LED MISO MOSI +NEOPIXEL EPD_BUSY SCK SCL +SDA SPI TX UART +EPD_CS EPD_RESET EPD_DC EPD_MOSI +EPD_SCK +""" + +from adafruit_blinka.microcontroller.rp2040_u2if import pin + +D0 = pin.GP1 +D1 = pin.GP0 +D4 = pin.GP4 +D5 = pin.GP5 +D6 = pin.GP6 +D9 = pin.GP9 +D10 = pin.GP10 +D11 = pin.GP11 +D12 = pin.GP12 +D13 = pin.GP13 +D24 = pin.GP24 +D25 = pin.GP25 + +A0 = pin.GP26 +A1 = pin.GP27 +A2 = pin.GP28 +A3 = pin.GP29 + +LED = pin.GP13 + +BUTTON = BOOT = pin.GP7 + +NEOPIXEL = pin.GP21 +NEOPIXEL_POWER = pin.GP20 + +SDA = pin.GP2 +SCL = pin.GP3 + +SCLK = SCK = pin.GP14 +MOSI = pin.GP15 +MISO = pin.GP8 + +EPD_BUSY = pin.GP16 +EPD_RESET = pin.GP17 +EPD_DC = pin.GP18 +EPD_CS = pin.GP19 +EPD_SCK = pin.GP22 +EPD_MOSI = pin.GP23 + +# access u2if via pin instance to open for specifc VID/PID +# pylint:disable = protected-access +pin.GP0._u2if_open_hid(0x239A, 0x812C) diff --git a/src/adafruit_blinka/board/feather_rfm_u2if.py b/src/adafruit_blinka/board/feather_rfm_u2if.py new file mode 100644 index 0000000..13b37af --- /dev/null +++ b/src/adafruit_blinka/board/feather_rfm_u2if.py @@ -0,0 +1,65 @@ +# SPDX-FileCopyrightText: 2023 Liz Clark for Adafruit Industries +# +# SPDX-License-Identifier: MIT +""" +Pin definitions for the Feather RP2040 RFM with u2if firmware. + +Adafruit CircuitPython 6.2.0 on 2021-04-05; Adafruit Feather RP2040 RFM with rp2040 +>>> import board +>>> board. +A0 A1 A2 A3 +D0 D1 D10 D11 +D12 D13 D24 D25 +D4 D5 D6 D9 +I2C SDA SCL LED +NEOPIXEL SPI SCK MISO +MOSI RX TX UART +RFM_CS RFM_RST RFM_IO5 RFM_IO3 +RFM_IO4 RFM_IO0 RFM_IO1 RFM_IO2 +""" + +from adafruit_blinka.microcontroller.rp2040_u2if import pin + +D0 = RX = pin.GP1 +D1 = TX = pin.GP0 +D4 = pin.GP4 +D5 = pin.GP5 +D6 = pin.GP6 +D9 = pin.GP9 +D10 = pin.GP10 +D11 = pin.GP11 +D12 = pin.GP12 +D13 = pin.GP13 +D24 = pin.GP24 +D25 = pin.GP25 + +A0 = pin.GP26 +A1 = pin.GP27 +A2 = pin.GP28 +A3 = pin.GP29 + +LED = pin.GP13 + +BUTTON = BOOT = pin.GP7 + +NEOPIXEL = pin.GP4 + +SDA = pin.GP2 +SCL = pin.GP3 + +SCLK = SCK = pin.GP14 +MOSI = pin.GP15 +MISO = pin.GP8 + +RFM_CS = pin.GP16 +RFM_RST = pin.GP17 +RFM_IO5 = pin.GP18 +RFM_IO3 = pin.GP19 +RFM_IO4 = pin.GP20 +RFM_IO0 = pin.GP21 +RFM_IO1 = pin.GP22 +RFM_IO2 = pin.GP23 + +# access u2if via pin instance to open for specifc VID/PID +# pylint:disable = protected-access +pin.GP0._u2if_open_hid(0x239A, 0x812E) diff --git a/src/adafruit_blinka/board/nvidia/jetson_orin_nx.py b/src/adafruit_blinka/board/nvidia/jetson_orin_nx.py new file mode 100644 index 0000000..1aa27d3 --- /dev/null +++ b/src/adafruit_blinka/board/nvidia/jetson_orin_nx.py @@ -0,0 +1,42 @@ +# SPDX-FileCopyrightText: 2022 Linh Hoang for NVIDIA +# SPDX-FileCopyrightText: 2022 Melissa LeBlanc-Williams for Adafruit Industries +# +# SPDX-License-Identifier: MIT +"""Pin definitions for Jetson AGX Orin.""" + +from adafruit_blinka.microcontroller.tegra.t234 import pin + +SDA = pin.SDA +SCL = pin.SCL +SDA_1 = pin.SDA_1 +SCL_1 = pin.SCL_1 + +D4 = pin.AC06 +D5 = pin.Q05 +D6 = pin.Q06 +D7 = pin.Z07 +D8 = pin.Z06 +D9 = pin.Z04 +D10 = pin.Z05 +D11 = pin.Z03 +D12 = pin.G06 +D13 = pin.H00 +D16 = pin.R05 +D17 = pin.R04 +D18 = pin.H07 +D19 = pin.I02 +D20 = pin.I01 +D21 = pin.I00 +D22 = pin.N01 +D23 = pin.Y04 +D24 = pin.Y03 +D25 = pin.Y01 +D26 = pin.Y02 +D27 = pin.Y00 + +CE1 = D7 +CE0 = D8 +MISO = D9 +MOSI = D10 +SCLK = D11 +SCK = D11 diff --git a/src/adafruit_blinka/microcontroller/rp2040_u2if/i2c.py b/src/adafruit_blinka/microcontroller/rp2040_u2if/i2c.py index f4a1a61..1715b4a 100644 --- a/src/adafruit_blinka/microcontroller/rp2040_u2if/i2c.py +++ b/src/adafruit_blinka/microcontroller/rp2040_u2if/i2c.py @@ -88,6 +88,48 @@ class I2C_Feather(I2C): super().__init__(index, frequency=frequency) +class I2C_Feather_CAN(I2C): + """I2C Class for Feather EPD u2if""" + + def __init__(self, scl, sda, *, frequency=100000): + index = None + if scl.id == 3 and sda.id == 2: + index = 1 + if index is None: + raise ValueError("I2C not found on specified pins.") + self._index = index + + super().__init__(index, frequency=frequency) + + +class I2C_Feather_EPD(I2C): + """I2C Class for Feather EPD u2if""" + + def __init__(self, scl, sda, *, frequency=100000): + index = None + if scl.id == 3 and sda.id == 2: + index = 1 + if index is None: + raise ValueError("I2C not found on specified pins.") + self._index = index + + super().__init__(index, frequency=frequency) + + +class I2C_Feather_RFM(I2C): + """I2C Class for Feather EPD u2if""" + + def __init__(self, scl, sda, *, frequency=100000): + index = None + if scl.id == 3 and sda.id == 2: + index = 1 + if index is None: + raise ValueError("I2C not found on specified pins.") + self._index = index + + super().__init__(index, frequency=frequency) + + class I2C_QTPY(I2C): """I2C Class for QT Py 2if""" diff --git a/src/adafruit_blinka/microcontroller/rp2040_u2if/spi.py b/src/adafruit_blinka/microcontroller/rp2040_u2if/spi.py index 435baba..7491c03 100644 --- a/src/adafruit_blinka/microcontroller/rp2040_u2if/spi.py +++ b/src/adafruit_blinka/microcontroller/rp2040_u2if/spi.py @@ -4,6 +4,7 @@ """SPI Classes for RP2040s with u2if firmware""" from .rp2040_u2if import rp2040_u2if + # pylint: disable=protected-access, no-self-use class SPI: """SPI Base Class for RP2040 u2if""" @@ -93,6 +94,44 @@ class SPI_Feather(SPI): super().__init__(index, baudrate=baudrate) +class SPI_Feather_CAN(SPI): + """SPI Class for Feather EPD u2if""" + + def __init__(self, clock, *, baudrate=100000): + index = None + if clock.id == 14: + index = 1 + if index is None: + raise ValueError("No SPI port on specified pin.") + super().__init__(index, baudrate=baudrate) + + +class SPI_Feather_EPD(SPI): + """SPI Class for Feather EPD u2if""" + + def __init__(self, clock, *, baudrate=100000): + index = None + if clock.id == 22: + index = 0 + if clock.id == 14: + index = 1 + if index is None: + raise ValueError("No SPI port on specified pin.") + super().__init__(index, baudrate=baudrate) + + +class SPI_Feather_RFM(SPI): + """SPI Class for Feather EPD u2if""" + + def __init__(self, clock, *, baudrate=100000): + index = None + if clock.id == 14: + index = 1 + if index is None: + raise ValueError("No SPI port on specified pin.") + super().__init__(index, baudrate=baudrate) + + class SPI_QTPY(SPI): """SPI Class for QT Py u2if""" diff --git a/src/adafruit_blinka/microcontroller/tegra/t234/pin.py b/src/adafruit_blinka/microcontroller/tegra/t234/pin.py index f2f3332..26a8072 100644 --- a/src/adafruit_blinka/microcontroller/tegra/t234/pin.py +++ b/src/adafruit_blinka/microcontroller/tegra/t234/pin.py @@ -110,6 +110,18 @@ AA03 = Pin("GP20_CAN1_DIN") I01 = Pin("GP124") I00 = Pin("GP123") + +AC06 = Pin("GP167") +Y00 = Pin("SPI1_SCK") +N01 = Pin("GP88_PWM1") +Y04 = Pin("GP40_SPI3_CS1_N") +Y03 = Pin("GP39_SPI3_CS0_N") +Y01 = Pin("GP37_SPI3_MISO") +Q05 = Pin("GP65") +G06 = Pin("GP113_PWM7") +Y02 = Pin("GP38_SPI3_MOSI") + + i2cPorts = ( (7, SCL, SDA), (1, SCL_1, SDA_1), diff --git a/src/board.py b/src/board.py index fc3b754..bdb94ac 100644 --- a/src/board.py +++ b/src/board.py @@ -61,6 +61,9 @@ elif board_id == ap_board.BEAGLEBONE: elif board_id == ap_board.BEAGLEBONE_BLACK: from adafruit_blinka.board.beagleboard.beaglebone_black import * +elif board_id == ap_board.BEAGLEBONE_BLUE: + from adafruit_blinka.board.beagleboard.beaglebone_blue import * + elif board_id == ap_board.BEAGLEBONE_GREEN: from adafruit_blinka.board.beagleboard.beaglebone_black import * @@ -163,6 +166,9 @@ elif board_id == ap_board.JETSON_NX: elif board_id == ap_board.JETSON_AGX_ORIN: from adafruit_blinka.board.nvidia.jetson_orin import * +elif board_id in (ap_board.JETSON_ORIN_NX, ap_board.JETSON_ORIN_NANO): + from adafruit_blinka.board.nvidia.jetson_orin_nx import * + elif board_id == ap_board.CLARA_AGX_XAVIER: from adafruit_blinka.board.nvidia.clara_agx_xavier import * @@ -301,6 +307,15 @@ elif board_id == ap_board.PICO_U2IF: elif board_id == ap_board.FEATHER_U2IF: from adafruit_blinka.board.feather_u2if import * +elif board_id == ap_board.FEATHER_CAN_U2IF: + from adafruit_blinka.board.feather_can_u2if import * + +elif board_id == ap_board.FEATHER_EPD_U2IF: + from adafruit_blinka.board.feather_epd_u2if import * + +elif board_id == ap_board.FEATHER_RFM_U2IF: + from adafruit_blinka.board.feather_rfm_u2if import * + elif board_id == ap_board.QTPY_U2IF: from adafruit_blinka.board.qtpy_u2if import * @@ -340,15 +355,16 @@ elif board_id is None: package = str(pkg_resources.get_distribution("adafruit_platformdetect")).split() raise NotImplementedError( - "{1} version {2} was unable to identify the board and/or microcontroller running " - "the {0} platform. Please be sure you have the latest packages running: 'pip3 install " - "--upgrade adafruit-blinka adafruit-platformdetect'".format( - platform.system(), package[0], package[1] - ) + f""" + {package[0]} version {package[1]} was unable to identify the board and/or + microcontroller running the {platform.system()} platform. Please be sure you + have the latest packages running: + 'pip3 install --upgrade adafruit-blinka adafruit-platformdetect' + """ ) else: - raise NotImplementedError("Board not supported {}".format(board_id)) + raise NotImplementedError(f"Board not supported {board_id}.") if "SCL" in locals() and "SDA" in locals(): diff --git a/src/busio.py b/src/busio.py index 75b08cb..ed5c88c 100644 --- a/src/busio.py +++ b/src/busio.py @@ -67,6 +67,27 @@ class I2C(Lockable): I2C_Feather as _I2C, ) + self._i2c = _I2C(scl, sda, frequency=frequency) + return + if detector.board.feather_can_u2if: + from adafruit_blinka.microcontroller.rp2040_u2if.i2c import ( + I2C_Feather_CAN as _I2C, + ) + + self._i2c = _I2C(scl, sda, frequency=frequency) + return + if detector.board.feather_epd_u2if: + from adafruit_blinka.microcontroller.rp2040_u2if.i2c import ( + I2C_Feather_EPD as _I2C, + ) + + self._i2c = _I2C(scl, sda, frequency=frequency) + return + if detector.board.feather_rfm_u2if: + from adafruit_blinka.microcontroller.rp2040_u2if.i2c import ( + I2C_Feather_RFM as _I2C, + ) + self._i2c = _I2C(scl, sda, frequency=frequency) return if detector.board.qtpy_u2if: @@ -245,6 +266,30 @@ class SPI(Lockable): SPI_Feather as _SPI, ) + self._spi = _SPI(clock) # this is really all that's needed + self._pins = (clock, clock, clock) # will determine MOSI/MISO from clock + return + if detector.board.feather_can_u2if: + from adafruit_blinka.microcontroller.rp2040_u2if.spi import ( + SPI_Feather_CAN as _SPI, + ) + + self._spi = _SPI(clock) # this is really all that's needed + self._pins = (clock, clock, clock) # will determine MOSI/MISO from clock + return + if detector.board.feather_epd_u2if: + from adafruit_blinka.microcontroller.rp2040_u2if.spi import ( + SPI_Feather_EPD as _SPI, + ) + + self._spi = _SPI(clock) # this is really all that's needed + self._pins = (clock, clock, clock) # will determine MOSI/MISO from clock + return + if detector.board.feather_rfm_u2if: + from adafruit_blinka.microcontroller.rp2040_u2if.spi import ( + SPI_Feather_RFM as _SPI, + ) + self._spi = _SPI(clock) # this is really all that's needed self._pins = (clock, clock, clock) # will determine MOSI/MISO from clock return @@ -332,6 +377,18 @@ class SPI(Lockable): from adafruit_blinka.microcontroller.rp2040_u2if.spi import ( SPI_Feather as _SPI, ) + elif detector.board.feather_can_u2if: + from adafruit_blinka.microcontroller.rp2040_u2if.spi import ( + SPI_Feather_CAN as _SPI, + ) + elif detector.board.feather_epd_u2if: + from adafruit_blinka.microcontroller.rp2040_u2if.spi import ( + SPI_Feather_EPD as _SPI, + ) + elif detector.board.feather_rfm_u2if: + from adafruit_blinka.microcontroller.rp2040_u2if.spi import ( + SPI_Feather_RFM as _SPI, + ) elif detector.board.itsybitsy_u2if: from adafruit_blinka.microcontroller.rp2040_u2if.spi import ( SPI_ItsyBitsy as _SPI, diff --git a/src/neopixel_write.py b/src/neopixel_write.py index 2bc5f81..997dd0d 100644 --- a/src/neopixel_write.py +++ b/src/neopixel_write.py @@ -10,7 +10,7 @@ Currently supported on Raspberry Pi only. * Author(s): ladyada """ - +# pylint: disable=too-many-boolean-expressions import sys from adafruit_blinka.agnostic import detector @@ -21,6 +21,9 @@ elif detector.board.pico_u2if: from adafruit_blinka.microcontroller.rp2040_u2if import neopixel as _neopixel elif ( detector.board.feather_u2if + or detector.board.feather_can_u2if + or detector.board.feather_epd_u2if + or detector.board.feather_rfm_u2if or detector.board.qtpy_u2if or detector.board.itsybitsy_u2if or detector.board.macropad_u2if diff --git a/src/pwmio.py b/src/pwmio.py index 8584c19..d19a855 100644 --- a/src/pwmio.py +++ b/src/pwmio.py @@ -9,7 +9,7 @@ Not supported by all boards. * Author(s): Melissa LeBlanc-Williams """ - +# pylint: disable=too-many-boolean-expressions import sys from adafruit_blinka.agnostic import detector @@ -40,6 +40,9 @@ elif detector.board.pico_u2if: from adafruit_blinka.microcontroller.rp2040_u2if.pwmio import PWMOut elif ( detector.board.feather_u2if + or detector.board.feather_can_u2if + or detector.board.feather_epd_u2if + or detector.board.feather_rfm_u2if or detector.board.qtpy_u2if or detector.board.itsybitsy_u2if or detector.board.macropad_u2if