From: Ryan L Date: Wed, 22 Jun 2022 19:19:19 +0000 (+0100) Subject: Merge remote-tracking branch 'adafruit/main' X-Git-Tag: 8.23.0~1^2~29 X-Git-Url: https://git.ayoreis.com/Adafruit_Blinka-hackapet.git/commitdiff_plain/d50f67848c801bc48f5e98e7236a6869264b22ab?hp=bea978b3069117dddbae680cf93b37fce764f974 Merge remote-tracking branch 'adafruit/main' --- diff --git a/docs/api.rst b/docs/api.rst index b28e684..1480320 100755 --- a/docs/api.rst +++ b/docs/api.rst @@ -40,6 +40,9 @@ .. automodule:: neopixel_write :members: +.. automodule:: onewireio + :members: + .. automodule:: pulseio :members: diff --git a/docs/conf.py b/docs/conf.py index 84be265..0b0b04f 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -64,7 +64,7 @@ release = "1.0.0" # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +language = "en" # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. diff --git a/requirements.txt b/requirements.txt index 851141c..329c2f0 100755 --- a/requirements.txt +++ b/requirements.txt @@ -7,3 +7,4 @@ 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 +adafruit-circuitpython-typing diff --git a/setup.py b/setup.py index fc2a39b..67ef7ee 100755 --- a/setup.py +++ b/setup.py @@ -64,9 +64,11 @@ setup( "keypad", "micropython", "neopixel_write", + "onewireio", "pulseio", "pwmio", "rainbowio", + "usb_hid", ], package_data={ "adafruit_blinka.microcontroller.bcm283x.pulseio": [ @@ -78,6 +80,7 @@ setup( "Adafruit-PlatformDetect>=3.13.0", "Adafruit-PureIO>=1.1.7", "pyftdi>=0.40.0", + "adafruit-circuitpython-typing", ] + board_reqs, license="MIT", diff --git a/src/adafruit_blinka/board/radxa/radxazero.py b/src/adafruit_blinka/board/radxa/radxazero.py new file mode 100644 index 0000000..381bfaf --- /dev/null +++ b/src/adafruit_blinka/board/radxa/radxazero.py @@ -0,0 +1,55 @@ +# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries +# +# SPDX-License-Identifier: MIT +"""Pin definitions for the Radxa Zero.""" + +from adafruit_blinka.microcontroller.amlogic.s905y2 import pin + +D3 = pin.GPIOA_14 +D5 = pin.GPIOA_15 +D7 = pin.GPIOAO_3 +D8 = pin.GPIOAO_8 +D10 = pin.GPIOAO_1 +D11 = pin.GPIOAO_2 +D12 = pin.GPIOX_9 +D13 = pin.GPIOX_11 +D16 = pin.GPIOX_10 +D18 = pin.GPIOX_8 +D19 = pin.GPIOH_4 +D21 = pin.GPIOH_5 +D23 = pin.GPIOH_7 +D24 = pin.GPIOH_6 +D27 = pin.GPIOAO_3 +D28 = pin.GPIOAO_2 +D32 = pin.GPIOAO_4 +D35 = pin.GPIOAO_8 +D36 = pin.GPIOH_8 +D37 = pin.GPIOAO_9 +D38 = pin.GPIOAO_10 +D40 = pin.GPIOAO_11 + +SDA1 = D24 +SCL1 = D23 + +SDA3 = D3 +SCL3 = D5 + +SDA4 = D27 +SCL4 = D28 + +SCLK = D13 +MOSI = D18 +MISO = D12 + +SCLK1 = D23 +MOSI1 = D19 +MISO1 = D21 + +UART_TX = D11 +UART_RX = D7 + +UART_TX1 = D18 +UART_RX1 = D12 + +UART_TX4 = D23 +UART_RX4 = D24 diff --git a/src/adafruit_blinka/microcontroller/amlogic/s905y2/__init__.py b/src/adafruit_blinka/microcontroller/amlogic/s905y2/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/adafruit_blinka/microcontroller/amlogic/s905y2/pin.py b/src/adafruit_blinka/microcontroller/amlogic/s905y2/pin.py new file mode 100644 index 0000000..2d0bfff --- /dev/null +++ b/src/adafruit_blinka/microcontroller/amlogic/s905y2/pin.py @@ -0,0 +1,75 @@ +# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries +# +# SPDX-License-Identifier: MIT +"""AmLogic s905y2 pin names""" +# pylint: disable=wildcard-import,unused-wildcard-import +from adafruit_blinka.microcontroller.generic_linux.libgpiod_pin import Pin + +periphs = 0 +aobus = 1 + +GPIO412 = GPIOAO_0 = Pin((aobus, 0)) +GPIO413 = GPIOAO_1 = Pin((aobus, 1)) +GPIO414 = GPIOAO_2 = Pin((aobus, 2)) +GPIO415 = GPIOAO_3 = Pin((aobus, 3)) +GPIO416 = GPIOAO_4 = Pin((aobus, 4)) + +GPIO420 = GPIOAO_8 = Pin((aobus, 8)) +GPIO421 = GPIOAO_9 = Pin((aobus, 9)) +GPIO422 = GPIOAO_10 = Pin((aobus, 10)) +GPIO423 = GPIOAO_11 = Pin((aobus, 11)) + +GPIO447 = GPIOH_4 = Pin((periphs, 20)) +GPIO448 = GPIOH_5 = Pin((periphs, 21)) +GPIO449 = GPIOH_6 = Pin((periphs, 22)) +GPIO450 = GPIOH_7 = Pin((periphs, 23)) +GPIO451 = GPIOH_8 = Pin((periphs, 24)) + +GPIO490 = GPIOA_14 = Pin((periphs, 63)) +GPIO491 = GPIOA_15 = Pin((periphs, 64)) + + +GPIO500 = GPIOX_8 = Pin((periphs, 73)) +GPIO501 = GPIOX_9 = Pin((periphs, 74)) +GPIO502 = GPIOX_10 = Pin((periphs, 75)) +GPIO503 = GPIOX_11 = Pin((periphs, 76)) + + +I2C1_SDA = GPIOH_6 +I2C1_SCL = GPIOH_7 +I2C3_SDA = GPIOA_14 +I2C3_SCL = GPIOA_15 +I2C4_SDA = GPIOAO_3 +I2C4_SCL = GPIOAO_2 + +SPIA_SCLK = GPIOX_11 +SPIA_MISO = GPIOX_9 +SPIA_MOSI = GPIOX_8 + +SPIB_SCLK = GPIOH_7 +SPIB_MISO = GPIOH_5 +SPIB_MOSI = GPIOH_4 + +UARTA_TX = GPIOAO_2 +UARTA_RX = GPIOAO_3 +UARTB_TX = GPIOAO_8 +UARTB_RX = GPIOAO_9 +UARTC_TX = GPIOH_7 +UARTC_RX = GPIOH_6 + +i2cPorts = ( + (1, I2C1_SCL, I2C1_SDA), + (3, I2C3_SCL, I2C3_SDA), + (4, I2C4_SCL, I2C4_SDA), +) + +spiPorts = ( + (0, SPIA_SCLK, SPIA_MOSI, SPIA_MISO), + (1, SPIB_SCLK, SPIB_MOSI, SPIB_MISO), +) + +uartPorts = ( + (0, UARTA_TX, UARTA_RX), + (1, UARTB_TX, UARTB_RX), + (4, UARTC_TX, UARTC_RX), +) diff --git a/src/adafruit_blinka/microcontroller/bcm2711/pin.py b/src/adafruit_blinka/microcontroller/bcm2711/pin.py index 91b4030..ffc508b 100644 --- a/src/adafruit_blinka/microcontroller/bcm2711/pin.py +++ b/src/adafruit_blinka/microcontroller/bcm2711/pin.py @@ -82,7 +82,7 @@ D45 = Pin(45) # ordered as spiId, sckId, mosiId, misoId spiPorts = ( (0, SCLK, MOSI, MISO), - (6, SCLK_1, MOSI_1, MISO_1), + (1, SCLK_1, MOSI_1, MISO_1), (2, SCLK_2, MOSI_2, MISO_2), (3, D3, D2, D1), (4, D7, D6, D5), diff --git a/src/adafruit_blinka/microcontroller/bcm283x/pulseio/libgpiod_pulsein b/src/adafruit_blinka/microcontroller/bcm283x/pulseio/libgpiod_pulsein index 0291c1b..e1783f8 100755 Binary files a/src/adafruit_blinka/microcontroller/bcm283x/pulseio/libgpiod_pulsein and b/src/adafruit_blinka/microcontroller/bcm283x/pulseio/libgpiod_pulsein differ diff --git a/src/adafruit_blinka/microcontroller/bcm283x/pulseio/libgpiod_pulsein64 b/src/adafruit_blinka/microcontroller/bcm283x/pulseio/libgpiod_pulsein64 index 0143060..1bad045 100755 Binary files a/src/adafruit_blinka/microcontroller/bcm283x/pulseio/libgpiod_pulsein64 and b/src/adafruit_blinka/microcontroller/bcm283x/pulseio/libgpiod_pulsein64 differ diff --git a/src/board.py b/src/board.py index 656216b..3a51e5c 100644 --- a/src/board.py +++ b/src/board.py @@ -208,6 +208,9 @@ elif board_id == ap_board.CLOCKWORK_CPI3: elif board_id == ap_board.ONION_OMEGA2: from adafruit_blinka.board.onion.omega2 import * +elif board_id == ap_board.RADXA_ZERO: + from adafruit_blinka.board.radxa.radxazero import * + elif board_id == ap_board.ROCK_PI_S: from adafruit_blinka.board.radxa.rockpis import * diff --git a/src/busio.py b/src/busio.py index 0605ee9..dd748a5 100644 --- a/src/busio.py +++ b/src/busio.py @@ -492,36 +492,3 @@ class UART(Lockable): def write(self, buf): """Write to the UART from a buffer""" return self._uart.write(buf) - - -class OneWire: - """ - Stub class for OneWire, which is currently not implemented - """ - - def __init__(self, pin): - raise NotImplementedError("OneWire has not been implemented") - - def deinit(self): - """ - Deinitialize the OneWire bus and release any hardware resources for reuse. - """ - raise NotImplementedError("OneWire has not been implemented") - - def reset(self): - """ - Reset the OneWire bus and read presence - """ - raise NotImplementedError("OneWire has not been implemented") - - def read_bit(self): - """ - Read in a bit - """ - raise NotImplementedError("OneWire has not been implemented") - - def write_bit(self, value): - """ - Write out a bit based on value. - """ - raise NotImplementedError("OneWire has not been implemented") diff --git a/src/digitalio.py b/src/digitalio.py index 509aece..6b89bf0 100644 --- a/src/digitalio.py +++ b/src/digitalio.py @@ -38,6 +38,8 @@ elif detector.chip.S905: from adafruit_blinka.microcontroller.amlogic.s905.pin import Pin elif detector.chip.S905X3: from adafruit_blinka.microcontroller.amlogic.s905x3.pin import Pin +elif detector.chip.S905Y2: + from adafruit_blinka.microcontroller.amlogic.s905y2.pin import Pin elif detector.chip.S922X: from adafruit_blinka.microcontroller.amlogic.s922x.pin import Pin elif detector.chip.A311D: diff --git a/src/microcontroller/__init__.py b/src/microcontroller/__init__.py index a307a0d..6865c4e 100644 --- a/src/microcontroller/__init__.py +++ b/src/microcontroller/__init__.py @@ -68,6 +68,8 @@ elif chip_id == ap_chip.S905: from adafruit_blinka.microcontroller.amlogic.s905 import * elif chip_id == ap_chip.S905X3: from adafruit_blinka.microcontroller.amlogic.s905x3 import * +elif chip_id == ap_chip.S905Y2: + from adafruit_blinka.microcontroller.amlogic.s905y2 import * elif chip_id == ap_chip.S922X: from adafruit_blinka.microcontroller.amlogic.s922x import * elif chip_id == ap_chip.A311D: @@ -122,6 +124,10 @@ elif chip_id == ap_chip.RP2040_U2IF: from adafruit_blinka.microcontroller.rp2040_u2if import * elif chip_id == ap_chip.GENERIC_X86: print("WARNING: GENERIC_X86 is not fully supported. Some features may not work.") +elif chip_id is None: + print( + "WARNING: chip_id == None 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 ab96c7b..79627c0 100644 --- a/src/microcontroller/pin.py +++ b/src/microcontroller/pin.py @@ -55,6 +55,8 @@ elif chip_id == ap_chip.S905: from adafruit_blinka.microcontroller.amlogic.s905.pin import * elif chip_id == ap_chip.S905X3: from adafruit_blinka.microcontroller.amlogic.s905x3.pin import * +elif chip_id == ap_chip.S905Y2: + from adafruit_blinka.microcontroller.amlogic.s905y2.pin import * elif chip_id == ap_chip.S922X: from adafruit_blinka.microcontroller.amlogic.s922x.pin import * elif chip_id == ap_chip.A311D: @@ -106,5 +108,13 @@ elif chip_id == ap_chip.RP2040_U2IF: elif "sphinx" in sys.modules: # pylint: disable=unused-import from adafruit_blinka.microcontroller.generic_micropython import Pin +elif chip_id == ap_chip.GENERIC_X86: + print("WARNING: GENERIC_X86 is not fully supported. Some features may not work.") + from adafruit_blinka.microcontroller.generic_micropython import Pin +elif chip_id is None: + print( + "WARNING: chip_id == None is not fully supported. Some features may not work." + ) + from adafruit_blinka.microcontroller.generic_micropython import Pin else: raise NotImplementedError("Microcontroller not supported: ", chip_id) diff --git a/src/onewireio.py b/src/onewireio.py new file mode 100644 index 0000000..4e37463 --- /dev/null +++ b/src/onewireio.py @@ -0,0 +1,47 @@ +# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries +# +# SPDX-License-Identifier: MIT +""" +`onewireio` - 1-wire bus protocol +================================================= + +See `CircuitPython:onewireio` in CircuitPython for more details. + +* Author(s): cefn +""" + +# pylint: disable=import-outside-toplevel,too-many-branches,too-many-statements +# pylint: disable=too-many-arguments,too-many-function-args,too-many-return-statements + + +class OneWire: + """ + Stub class for OneWire, which is currently not implemented + """ + + def __init__(self, pin): + raise NotImplementedError("OneWire has not been implemented") + + def deinit(self): + """ + Deinitialize the OneWire bus and release any hardware resources for reuse. + """ + raise NotImplementedError("OneWire has not been implemented") + + def reset(self): + """ + Reset the OneWire bus and read presence + """ + raise NotImplementedError("OneWire has not been implemented") + + def read_bit(self): + """ + Read in a bit + """ + raise NotImplementedError("OneWire has not been implemented") + + def write_bit(self, value): + """ + Write out a bit based on value. + """ + raise NotImplementedError("OneWire has not been implemented")