From: Melissa LeBlanc-Williams Date: Thu, 10 Feb 2022 17:55:07 +0000 (-0800) Subject: Merge pull request #548 from makermelissa/main X-Git-Tag: 6.20.2 X-Git-Url: https://git.ayoreis.com/hackapet/Adafruit_Blinka.git/commitdiff_plain/66fb79ea0a686ebe057f6a6cb085de44870648ba?hp=8ab434ea68abcc408b2ec2fca62f94259f2d46dc Merge pull request #548 from makermelissa/main Set executable flag on libgpiod_pulsein64 so pip installs it --- diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 95bdea1..79c2575 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,10 +13,10 @@ jobs: - name: Translate Repo Name For Build Tools filename_prefix id: repo-name run: echo ::set-output name=repo-name::Adafruit-Blinka - - name: Set up Python 3.6 + - name: Set up Python 3.7 uses: actions/setup-python@v1 with: - python-version: 3.6 + python-version: 3.7 - name: Versions run: | python3 --version diff --git a/README.rst b/README.rst index 8f3aa29..5e9c020 100755 --- a/README.rst +++ b/README.rst @@ -20,10 +20,12 @@ Introduction This repository contains a selection of packages emulating the CircuitPython API for devices or hosts running CPython or MicroPython. Working code exists to emulate these CircuitPython packages: +* **_typing** - (Legacy) subset of types for C-level protocols * **analogio** - analog input/output pins, using pin identities from board+microcontroller packages * **bitbangio** - software-driven interfaces for I2C, SPI * **board** - breakout-specific pin identities * **busio** - hardware-driven interfaces for I2C, SPI, UART +* **circuitpython_typing** - Subset of types for C-level protocols * **digitalio** - digital input/output pins, using pin identities from board+microcontroller packages * **keypad** - support for scanning keys and key matrices * **microcontroller** - chip-specific pin identities diff --git a/docs/api.rst b/docs/api.rst index dc0aeb6..e25be92 100755 --- a/docs/api.rst +++ b/docs/api.rst @@ -4,8 +4,11 @@ .. If your library file(s) are nested in a directory (e.g. /adafruit_foo/foo.py) .. use this format as the module name: "adafruit_foo.foo" +.. automodule:: _typing + :members: + .. automodule:: adafruit_blinka - :members: + :members: .. automodule:: adafruit_blinka.agnostic :members: @@ -25,6 +28,9 @@ .. automodule:: busio :members: +.. automodule:: circuitpython_typing + :members: + .. automodule:: digitalio :members: diff --git a/docs/conf.py b/docs/conf.py index 7c11d8a..2e54ac7 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -29,7 +29,7 @@ autodoc_mock_imports = [ ] intersphinx_mapping = { - "python": ("https://docs.python.org/3.6", None), + "python": ("https://docs.python.org/3.7", None), "CircuitPython": ("https://circuitpython.readthedocs.io/en/latest/", None), } diff --git a/requirements.txt b/requirements.txt index 013f2dc..851141c 100755 --- a/requirements.txt +++ b/requirements.txt @@ -6,3 +6,4 @@ rpi_ws281x>=4.0.0; platform_machine=='armv7l' or platform_machine=='armv6l' sysv_ipc>=1.1.0; sys_platform == 'linux' and platform_machine!='mips' pyftdi>=0.40.0 binho-host-adapter>=0.1.6 +numpy>=1.21.5 diff --git a/setup.py b/setup.py index a18904c..3a30af0 100755 --- a/setup.py +++ b/setup.py @@ -45,17 +45,19 @@ setup( long_description_content_type="text/x-rst", author="Adafruit Industries", author_email="circuitpython@adafruit.com", - python_requires=">=3.6.0", + python_requires=">=3.7.0", url="https://github.com/adafruit/Adafruit_Blinka", package_dir={"": "src"}, packages=find_packages("src"), # py_modules lists top-level single file packages to include. # find_packages only finds packages in directories with __init__.py files. py_modules=[ + "_typing", "analogio", "bitbangio", "board", "busio", + "circuitpython_typing", "digitalio", "keypad", "micropython", @@ -80,7 +82,7 @@ setup( "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: MicroPython", ], ) diff --git a/src/_typing.py b/src/_typing.py new file mode 100644 index 0000000..0e371c4 --- /dev/null +++ b/src/_typing.py @@ -0,0 +1,31 @@ +# The MIT License (MIT) +# +# Copyright (c) 2017 cefn for adafruit industries +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +""" +`_typing` - Define (legacy) subset of types for C-level protocols +================================================================= + +* Author(s): Alec Delaney + +See `CircuitPython:circuitpython_typing` in CircuitPython for more details. +""" + +from circuitpython_typing import * # pylint: disable=wildcard-import,unused-wildcard-import diff --git a/src/adafruit_blinka/board/nanopi/neo.py b/src/adafruit_blinka/board/nanopi/neo.py new file mode 100644 index 0000000..68b5cbe --- /dev/null +++ b/src/adafruit_blinka/board/nanopi/neo.py @@ -0,0 +1,49 @@ +"""Pin definitions for the NanoPi NEO Air.""" +# Enable I2C0, UART1, and SPI by adding the following lines to /boot/armbianEnv.txt +# overlays=usbhost2 usbhost3 spi-spidev uart1 i2c0 +# param_spidev_spi_bus=0 + +from adafruit_blinka.microcontroller.allwinner.h3 import pin + +# Left GPIOs +D2 = pin.PA12 +D3 = pin.PA11 +D4 = pin.PG11 +D17 = pin.PA0 +D27 = pin.PA2 +D22 = pin.PA3 +D10 = pin.PC0 +D9 = pin.PC1 +D11 = pin.PC2 + +# Right GPIOs +D14 = pin.PG6 +D15 = pin.PG7 +D18 = pin.PA6 +D23 = pin.PG8 +D24 = pin.PG9 +D25 = pin.PA1 +D8 = pin.PC3 + +# I2C +SDA = D2 +SCL = D3 + +# SPI +SCLK = D11 +MOSI = D10 +MISO = D9 +CE0 = D8 +SCK = SCLK + +# Serial UART +UART1_TX = D14 +UART1_RX = D15 + +UART2_RX = D8 +UART2_TX = D17 +UART2_RTS = D27 +UART2_CTS = D22 + +# PWM +PWM1 = D4 diff --git a/src/adafruit_blinka/board/orangepi/orangepi3.py b/src/adafruit_blinka/board/orangepi/orangepi3.py new file mode 100644 index 0000000..ad60965 --- /dev/null +++ b/src/adafruit_blinka/board/orangepi/orangepi3.py @@ -0,0 +1,31 @@ +"""Pin definitions for the Orange Pi 3.""" + +from adafruit_blinka.microcontroller.allwinner.h6 import pin + +PD26 = pin.PD26 +SDA = pin.PD26 +PD25 = pin.PD25 +SCL = pin.PD25 +PD22 = pin.PD22 +PL2 = pin.PL2 +PL3 = pin.PL3 +PD24 = pin.PD24 +UART3_RX = pin.PD24 +PD18 = pin.PD18 +PD23 = pin.PD23 +UART3_TX = pin.PD23 +PL10 = pin.PL10 +PD15 = pin.PD15 +PD16 = pin.PD16 +PH5 = pin.PH5 +PH6 = pin.PH6 +PD21 = pin.PD21 +PH4 = pin.PH4 +SPI1_CLK = pin.PH4 +PH3 = pin.PH3 +SPI1_CS = pin.PH3 +PL8 = pin.PL8 + +SCLK = pin.PH4 +MOSI = pin.PH5 +MISO = pin.PH6 diff --git a/src/adafruit_blinka/board/stm32/osd32mp1_brk.py b/src/adafruit_blinka/board/stm32/osd32mp1_brk.py new file mode 100644 index 0000000..3fa9e46 --- /dev/null +++ b/src/adafruit_blinka/board/stm32/osd32mp1_brk.py @@ -0,0 +1,169 @@ +"""Pin definitions for the Octavo OSD32MP1 BRK board.""" + +# See: https://octavosystems.com/octavosystems.com/wp-content/uploads/2020/05/Default-Pin-Mapping.pdf # pylint: disable=line-too-long + +from adafruit_blinka.microcontroller.stm32.stm32mp157 import pin + +# Board pin name = OSD32MP1 pin name = STM32MP1 pin name + +# fmt: off +# -------------------------------- +# Header Location A +# -------------------------------- +# VIN - VIN A01 +ADC_IN0 = ANA0 = pin.PAN0 # A02 +TIM8_CH2 = PI6 = pin.PI6 # A03 +GPIO_PI5 = PI5 = pin.PI5 # A04 +SPI2_NSS = PI0 = pin.PI0 # A05 +SPI2_SCK = PI1 = pin.PI1 # A06 +FDCAN1_RX = PH14 = pin.PH14 # A07 +FDCAN1_TX = PH13 = pin.PH13 # A08 +I2C1_SCL = PH11 = pin.PH11 # A09 +TIM12_CH2 = PH9 = pin.PH9 # A10 +SPI4_MOSI = PE14 = pin.PE14 # A11 +SPI4_NSS = PE11 = pin.PE11 # A12 +GPIO_PH8 = PH8 = pin.PH8 # A13 +GPIO_PD10 = PD10 = pin.PD10 # A14 +GPIO_PH5 = PH5 = pin.PH5 # A15 +USART2_RX = PF4 = pin.PF4 # A16 +USART2_TX = PF5 = pin.PF5 # A17 +I2C2_SCL = PF1 = pin.PF1 # A18 +I2C2_SDA = PG15 = pin.PG15 # A19 +GPIO_PD4 = PD4 = pin.PD4 # A20 +GPIO_PD6 = PD6 = pin.PD6 # A21 +I2C5_SDA = PD0 = pin.PD0 # A22 +TIM4_CH2 = PB7 = pin.PB7 # A23 +GPIO_PE3 = PE3 = pin.PE3 # A24 +GPIO_PB15 = PB15 = pin.PB15 # A25 +UART7_RX = PB3 = pin.PB3 # A26 +GPIO_PE5 = PE5 = pin.PE5 # A27 +GPIO_PB14 = PB14 = pin.PE14 # A28 +# GND - VSS A29 +# GND - VSS A30 + +# -------------------------------- +# Header Location B +# -------------------------------- +# VIN - VIN B01 +ADC_IN1 = ANA1 = pin.PAN1 # B02 +GPIO_PI7 = PI7 = pin.PI7 # B03 +GPIO_PI4 = PI4 = pin.PI4 # B04 +SPI2_MOSI = PI3 = pin.PI3 # B05 +SPI2_MISO = PI2 = pin.PI2 # B06 +GPIO_PH15 = PH15 = pin.PH15 # B07 +I2C1_SDA = PH12 = pin.PH12 # B08 +GPIO_PH10 = PH10 = pin.PH10 # B09 +GPIO_PE15 = PE15 = pin.PE15 # B10 +SPI4_SCK = PE12 = pin.PE12 # B11 +GPIO_PH4 = PH4 = pin.PH4 # B12 +SPI4_MISO = PE13 = pin.PE13 # B13 +UART8_RX = PE0 = pin.PE0 # B14 +UART8_TX = PE1 = pin.PE1 # B15 +GPIO_PF0 = PF0 = pin.PF0 # B16 +GPIO_PE6 = PE6 = pin.PE6 # B17 +GPIO_PD7 = PD7 = pin.PD7 # B18 +GPIO_PD5 = PD5 = pin.PD5 # B19 +I2C5_SCL = PD1 = pin.PD1 # B20 +GPIO_PD3 = PD3 = pin.PD3 # B21 +TIM1_CH2 = PA9 = pin.PA9 # B22 +GPIO_PB9 = PB9 = pin.PB9 # B23 +GPIO_PB8 = PB8 = pin.PB8 # B24 +GPIO_PB4 = PB4 = pin.PB4 # B25 +GPIO_PG6 = PG6 = pin.PG6 # B26 +UART7_TX = PA15 = pin.PA15 # B27 +GPIO_PC7 = PC7 = pin.PC7 # B28 +# USB1_DP - USB_DP1 B29 +# USB1_DN - USB_DM1 B30 + +# -------------------------------- +# Header Location C +# -------------------------------- +# 3.3V - PMIC_V4OUT C01 +GPIO_PD9 = PD9 = pin.PD9 # C02 +GPIO_PD15 = PD15 = pin.PD15 # C03 +GPIO_PD14 = PD14 = pin.PD14 # C04 +GPIO_PF3 = PF3 = pin.PF3 # C05 +GPIO_PC3 = PC3 = pin.PC3 # C06 +GPIO_PG13 = PG13 = pin.PG13 # C07 +GPIO_PG1 = PG1 = pin.PG1 # C08 +GPIO_PG4 = PG4 = pin.PG4 # C09 +GPIO_PF14 = PF14 = pin.PF14 # C10 +GPIO_PB1 = PB1 = pin.PB1 # C11 +SPI6_MISO = PZ1 = pin.PZ1 # C12 +SPI6_NSS = PZ3 = pin.PZ3 # C13 +# PONKEY - PWC_PONKEY C14 +# VLD02 - PMIC_LD02 C15 +# VBAT - VBAT C16 +# VSW - PMC_SWOUT C17 +# VBST - PMIC_BSTOUT C18 +GPIO_PC5 = PC5 = pin.PC5 # C19 +GPIO_PA1 = PA1 = pin.PA1 # C20 +GPIO_PC4 = PC4 = pin.PC4 # C21 +GPIO_PB10 = PB10 = pin.PB10 # C22 +UART5_RX = PB12 = pin.PB12 # C23 +GPIO_PC1 = PC1 = pin.PC1 # C24 +GPIO_PA4 = PA4 = pin.PA4 # C25 +GPIO_PA6 = PA6 = pin.PA6 # C26 +GPIO_PD11 = PD11 = pin.PD11 # C27 +GPIO_PF6 = PF6 = pin.PF6 # C28 +GPIO_PD12 = PD12 = pin.PD12 # C29 +GPIO_PB6 = PB6 = pin.PB6 # C30 + +# -------------------------------- +# Header Location D +# -------------------------------- +# 3.V - PMIC_V4OUT D01 +# RESETN - NRST D02 +GPIO_PD8 = PD8 = pin.PD8 # D03 +GPIO_PA14 = PA14 = pin.PA14 # D04 +GPIO_PG12 = PG12 = pin.PG12 # D05 +GPIO_PA3 = PA3 = pin.PA3 # D06 +GPIO_PE2 = PE2 = pin.PE2 # D07 +GPIO_PG14 = PG14 = pin.PG14 # D08 +GPIO_PG2 = PG2 = pin.PG2 # D09 +GPIO_PB11 = PB11 = pin.PB11 # D10 +GPIO_PF13 = PF13 = pin.PF13 # D11 +SPI6_SCK = PZ0 = pin.PZ0 # D12 +SPI6_MOSI = PZ2 = pin.PZ2 # D13 +GPIO_PC2 = PC2 = pin.PC2 # D14 +GPIO_PG0 = PG0 = pin.PG0 # D15 +GPIO_PG3 = PG3 = pin.PG3 # D16 +GPIO_PF15 = PF15 = pin.PF15 # D17 +GPIO_PF12 = PF12 = pin.PF12 # D18 +GPIO_PG5 = PG5 = pin.PG5 # D19 +TIM3_CH2 = PB5 = pin.PB5 # D20 +GPIO_PB0 = PB0 = pin.PB0 # D21 +GPIO_PA7 = PA7 = pin.PA7 # D22 +UART5_TX = PB13 = pin.PB13 # D23 +GPIO_PA2 = PA2 = pin.PA2 # D24 +GPIO_PA5 = PA5 = pin.PA5 # D25 +GPIO_PC0 = PC0 = pin.PC0 # D26 +GPIO_PF11 = PF11 = pin.PF11 # D27 +GPIO_PD13 = PD13 = pin.PD13 # D28 +# GND - VSS D29 +# GND - VSS D30 +# fmt: on + +# I2C defaults +SDA1 = SDA = I2C1_SDA +SCL1 = SCL = I2C1_SCL +SDA2 = I2C2_SDA +SCL2 = I2C2_SCL +SDA5 = I2C5_SDA +SCL5 = I2C5_SCL + +# SPI defaults +SCK = SPI2_SCK +MOSI = SPI2_MOSI +MISO = SPI2_MISO +CS = SPI2_NSS + +# Board LED's +LED1_RED = pin.PZ6 +LED1_GRN = pin.PZ7 +LED2_RED = pin.PI8 +LED2_GRN = pin.PI9 + +# Console UART +UART4_TX = pin.PG11 +UART4_RX = pin.PB2 diff --git a/src/adafruit_blinka/board/stm32/osd32mp1_red.py b/src/adafruit_blinka/board/stm32/osd32mp1_red.py new file mode 100644 index 0000000..67395f9 --- /dev/null +++ b/src/adafruit_blinka/board/stm32/osd32mp1_red.py @@ -0,0 +1,53 @@ +"""Pin definitions for the Octavo OSD32MP1 RED board.""" + +from adafruit_blinka.microcontroller.stm32.stm32mp157 import pin + +# RPi header JP20 +D0 = pin.PF15 +D1 = pin.PD12 +D2 = pin.PA12 +D3 = pin.PA11 +D4 = pin.PI11 +D5 = pin.PG2 +D6 = pin.PH11 +D7 = pin.PF13 +D8 = pin.PF6 +D9 = pin.PF8 +D10 = pin.PF9 +D11 = pin.PF7 +D12 = pin.PD13 +D13 = pin.PB5 +D14 = pin.PB10 +D15 = pin.PB12 +D16 = pin.PB13 +D17 = pin.PG8 +D18 = pin.PI5 +D19 = pin.PI7 +D20 = pin.PI6 +D21 = pin.PE11 +D22 = pin.PG15 +D23 = pin.PF1 +D24 = pin.PF0 +D25 = pin.PF4 +D26 = pin.PF5 +D27 = pin.PD7 + +I2C5_SDA = SDA = D2 +I2C5_SCL = SCL = D3 + +I2C1_SDA = ID_SD = D0 +I2C1_SCL = ID_SC = D1 + +SPI5_SCLK = SCLK = SCK = D11 +SPI5_MOSI = MOSI = D10 +SPI5_MISO = MISO = D9 +SPI5_NSS = CS = CE0 = D8 + +PI_GPIO7 = CE1 = D7 + +UART_TX = D14 +UART_RX = D15 + +# Console UART +UART4_TX = pin.PG11 +UART4_RX = pin.PB2 diff --git a/src/adafruit_blinka/microcontroller/allwinner/h6/pin.py b/src/adafruit_blinka/microcontroller/allwinner/h6/pin.py index 53c469f..6375938 100644 --- a/src/adafruit_blinka/microcontroller/allwinner/h6/pin.py +++ b/src/adafruit_blinka/microcontroller/allwinner/h6/pin.py @@ -39,8 +39,11 @@ SPI1_MISO = PH6 PH8 = Pin((1, 230)) PH9 = Pin((1, 231)) +PL2 = Pin((0, 2)) +PL3 = Pin((0, 3)) PL8 = Pin((0, 8)) PL9 = Pin((0, 9)) +PL10 = Pin((0, 10)) i2cPorts = ((0, TWI0_SCL, TWI0_SDA),) spiPorts = ((1, SPI1_SCLK, SPI1_MOSI, SPI1_MISO),) diff --git a/src/adafruit_blinka/microcontroller/stm32/stm32mp157/pin.py b/src/adafruit_blinka/microcontroller/stm32/stm32mp157/pin.py index 6aa6426..c7ad756 100755 --- a/src/adafruit_blinka/microcontroller/stm32/stm32mp157/pin.py +++ b/src/adafruit_blinka/microcontroller/stm32/stm32mp157/pin.py @@ -94,6 +94,7 @@ PF12 = Pin((5, 12)) PF13 = Pin((5, 13)) PF14 = Pin((5, 14)) PF15 = Pin((5, 15)) +PG0 = Pin((6, 0)) PG1 = Pin((6, 1)) PG2 = Pin((6, 2)) PG3 = Pin((6, 3)) diff --git a/src/board.py b/src/board.py index 576a98d..69bd3a7 100755 --- a/src/board.py +++ b/src/board.py @@ -82,6 +82,9 @@ elif board_id == ap_board.BEAGLEBONE_BLACK: elif board_id == ap_board.BEAGLEBONE_GREEN: from adafruit_blinka.board.beagleboard.beaglebone_black import * +elif board_id == ap_board.BEAGLEBONE_GREEN_GATEWAY: + from adafruit_blinka.board.beagleboard.beaglebone_black import * + elif board_id == ap_board.BEAGLEBONE_BLACK_INDUSTRIAL: from adafruit_blinka.board.beagleboard.beaglebone_black import * @@ -133,6 +136,9 @@ elif board_id == ap_board.ORANGE_PI_ZERO_PLUS: elif board_id == ap_board.ORANGE_PI_ZERO_2: from adafruit_blinka.board.orangepi.orangepizero2 import * +elif board_id == ap_board.ORANGE_PI_3: + from adafruit_blinka.board.orangepi.orangepi3 import * + elif board_id == ap_board.BANANA_PI_M2_ZERO: from adafruit_blinka.board.bananapi.bpim2zero import * @@ -229,6 +235,12 @@ elif board_id == ap_board.UDOO_X86: elif board_id == ap_board.STM32MP157C_DK2: from adafruit_blinka.board.stm32.stm32mp157c_dk2 import * +elif board_id == ap_board.OSD32MP1_RED: + from adafruit_blinka.board.stm32.osd32mp1_red import * + +elif board_id == ap_board.OSD32MP1_BRK: + from adafruit_blinka.board.stm32.osd32mp1_brk import * + elif board_id == ap_board.LUBANCAT_IMX6ULL: from adafruit_blinka.board.lubancat.lubancat_imx6ull import * @@ -241,6 +253,9 @@ elif board_id == ap_board.NANOPI_NEO_AIR: elif board_id == ap_board.NANOPI_DUO2: from adafruit_blinka.board.nanopi.duo2 import * +elif board_id == ap_board.NANOPI_NEO: + from adafruit_blinka.board.nanopi.neo import * + elif board_id == ap_board.PICO_U2IF: from adafruit_blinka.board.pico_u2if import * diff --git a/src/circuitpython_typing.py b/src/circuitpython_typing.py new file mode 100644 index 0000000..3ab01c3 --- /dev/null +++ b/src/circuitpython_typing.py @@ -0,0 +1,52 @@ +# The MIT License (MIT) +# +# Copyright (c) 2017 cefn for adafruit industries +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +""" +`circuitpython_typing` - Define subset of types for C-level protocols +===================================================================== + +See `CircuitPython:circuitpython_typing` in CircuitPython for more details. + +* Author(s): Alec Delaney +""" + +from typing import Union +from array import array +from numpy import ndarray + +ReadableBuffer = Union[bytes, bytearray, memoryview, array, ndarray] +"""Classes that implement the readable buffer protocol + + * `bytes` + * `bytearray` + * `memoryview` + * `array.array` + * ``numpy.ndarray`` +""" + +WriteableBuffer = Union[bytearray, memoryview, array, ndarray] +"""Classes that implement the writeable buffer protocol + + * `bytearray` + * `memoryview` + * `array.array` + * ``numpy.ndarray`` +""" diff --git a/src/digitalio.py b/src/digitalio.py index 3aea4c6..f00b266 100755 --- a/src/digitalio.py +++ b/src/digitalio.py @@ -77,6 +77,8 @@ elif detector.chip.STM32MP157: from adafruit_blinka.microcontroller.stm32.stm32mp157.pin import Pin elif detector.chip.MT8167: from adafruit_blinka.microcontroller.mt8167.pin import Pin +elif detector.chip.H3: + from adafruit_blinka.microcontroller.allwinner.h3.pin import Pin elif detector.chip.H5: from adafruit_blinka.microcontroller.allwinner.h5.pin import Pin elif detector.chip.H6: diff --git a/src/microcontroller/__init__.py b/src/microcontroller/__init__.py index 03253b3..59bf33d 100755 --- a/src/microcontroller/__init__.py +++ b/src/microcontroller/__init__.py @@ -107,6 +107,8 @@ elif chip_id == ap_chip.RK3399: from adafruit_blinka.microcontroller.rockchip.rk3399.pin import * elif chip_id == ap_chip.RK3328: from adafruit_blinka.microcontroller.rockchip.rk3328.pin import * +elif chip_id == ap_chip.H3: + from adafruit_blinka.microcontroller.allwinner.h3.pin import * elif chip_id == ap_chip.H5: from adafruit_blinka.microcontroller.allwinner.h5.pin import * elif chip_id == ap_chip.IMX8MX: @@ -119,6 +121,8 @@ elif chip_id == ap_chip.BINHO: from adafruit_blinka.microcontroller.nova import * elif chip_id == ap_chip.LPC4330: from adafruit_blinka.microcontroller.nxp_lpc4330 import * +elif chip_id == ap_chip.MCP2221: + from adafruit_blinka.microcontroller.mcp2221.pin import * elif chip_id == ap_chip.MIPS24KC: from adafruit_blinka.microcontroller.atheros.ar9331 import * elif chip_id == ap_chip.MIPS24KEC: @@ -135,6 +139,8 @@ elif chip_id == ap_chip.MT8167: from adafruit_blinka.microcontroller.mt8167.pin import * elif chip_id == ap_chip.RP2040_U2IF: from adafruit_blinka.microcontroller.rp2040_u2if.pin import * +elif chip_id == ap_chip.GENERIC_X86: + print("WARNING: GENERIC_X86 is not fully supported. Some features may not work.") elif "sphinx" in sys.modules: pass else: diff --git a/src/microcontroller/pin.py b/src/microcontroller/pin.py index 149c342..cfacf5f 100755 --- a/src/microcontroller/pin.py +++ b/src/microcontroller/pin.py @@ -29,6 +29,8 @@ elif chip_id == ap_chip.JH71x0: from adafruit_blinka.microcontroller.starfive.JH71x0.pin import * elif chip_id == ap_chip.SUN8I: from adafruit_blinka.microcontroller.allwinner.h3.pin import * +elif chip_id == ap_chip.H3: + from adafruit_blinka.microcontroller.allwinner.h3.pin import * elif chip_id == ap_chip.H5: from adafruit_blinka.microcontroller.allwinner.h5.pin import * elif chip_id == ap_chip.H6: