From: twa127 <46624596+twa127@users.noreply.github.com> Date: Sat, 6 Feb 2021 23:08:12 +0000 (+0000) Subject: Merge pull request #4 from adafruit/master X-Git-Tag: 6.2.0^2~23 X-Git-Url: https://git.ayoreis.com/Adafruit_Blinka-hackapet.git/commitdiff_plain/6d50773d4e8191204b49207d717359317a27ea53?hp=b8231c830781673193adceb4a4a3f44ff29c12dc Merge pull request #4 from adafruit/master Merge --- diff --git a/docs/conf.py b/docs/conf.py index c51cebd..7c11d8a 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -29,7 +29,7 @@ autodoc_mock_imports = [ ] intersphinx_mapping = { - "python": ("https://docs.python.org/3.4", None), + "python": ("https://docs.python.org/3.6", None), "CircuitPython": ("https://circuitpython.readthedocs.io/en/latest/", None), } diff --git a/examples/analog_in.py b/examples/analog_in.py new file mode 100644 index 0000000..d72fbdc --- /dev/null +++ b/examples/analog_in.py @@ -0,0 +1,15 @@ +"""Analog in demo""" +import time +import board +from analogio import AnalogIn + +analog_in = AnalogIn(board.A1) + + +def get_voltage(pin): + return (pin.value * 3.3) / 4096 + + +while True: + print((get_voltage(analog_in),)) + time.sleep(0.1) diff --git a/requirements.txt b/requirements.txt index 4eaf385..b6336c5 100755 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,8 @@ -Adafruit-PlatformDetect>=2.18.1 +Adafruit-PlatformDetect>=3.0.0 Adafruit-PureIO>=1.1.7 Jetson.GPIO; platform_machine=='aarch64' RPi.GPIO; platform_machine=='armv7l' or platform_machine=='armv6l' rpi_ws281x>=4.0.0; platform_machine=='armv7l' or platform_machine=='armv6l' -sysv_ipc; sys_platform == 'linux' and platform_machine!='mips' +sysv_ipc>=1.1.0; sys_platform == 'linux' and platform_machine!='mips' pyftdi>=0.40.0 binho-host-adapter>=0.1.6 diff --git a/setup.py b/setup.py index 2465ba8..a3ebaca 100755 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ if os.path.exists("/proc/device-tree/compatible"): or b"brcm,bcm2837" in compat or b"brcm,bcm2838" in compat ): - board_reqs = ["RPi.GPIO", "rpi_ws281x>=4.0.0", "sysv_ipc"] + board_reqs = ["RPi.GPIO", "rpi_ws281x>=4.0.0", "sysv_ipc>=1.1.0"] setup( name="Adafruit-Blinka", @@ -40,7 +40,7 @@ setup( long_description_content_type="text/x-rst", author="Adafruit Industries", author_email="circuitpython@adafruit.com", - python_requires=">=3.5.0", + python_requires=">=3.6.0", url="https://github.com/adafruit/Adafruit_Blinka", package_dir={"": "src"}, packages=find_packages("src"), @@ -54,6 +54,7 @@ setup( "digitalio", "micropython", "pulseio", + "pwmio", "neopixel_write", ], package_data={ @@ -72,7 +73,7 @@ setup( "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: MicroPython", ], ) diff --git a/src/adafruit_blinka/board/beagleboard/beaglebone_ai.py b/src/adafruit_blinka/board/beagleboard/beaglebone_ai.py new file mode 100644 index 0000000..d88111f --- /dev/null +++ b/src/adafruit_blinka/board/beagleboard/beaglebone_ai.py @@ -0,0 +1,140 @@ +"""Pin definitions for the Beaglebone Black.""" +from adafruit_blinka.microcontroller.dra74x import pin + +# initial pins, to mimic bonescript demo +# BeagleBone Black +# P8_1 = DGND # DGND +# P8_2 = DGND # DGND +P8_3 = pin.P8_3 # GPIO1_6 - GPIO_38 +P8_4 = pin.P8_4 # GPIO1_7 - GPIO_39 +P8_5 = pin.P8_5 # GPIO1_2 - GPIO_34 +P8_6 = pin.P8_6 # GPIO1_3 - GPIO_35 +P8_7 = pin.P8_7 # TIMER4 - GPIO_66 +P8_8 = pin.P8_8 # TIMER7 - GPIO_67 +P8_9 = pin.P8_9 # TIMER5 - GPIO_69 +P8_10 = pin.P8_10 # TIMER6 - GPIO_68 +P8_11 = pin.P8_11 # GPIO1_13 - GPIO_45 +P8_12 = pin.P8_12 # GPIO1_12 - GPIO_44 +P8_13 = pin.P8_13 # EHRPWM2B - GPIO_23 +P8_14 = pin.P8_14 # GPIO0_26 - GPIO_26 +P8_15 = pin.P8_15 # GPIO1_15 - GPIO_47 +P8_16 = pin.P8_16 # GPIO1_14 - GPIO_46 +P8_17 = pin.P8_17 # GPIO0_27 - GPIO_27 +P8_18 = pin.P8_18 # GPIO2_1 - GPIO_65 +P8_19 = pin.P8_19 # EHRPWM2A - GPIO_22 +P8_20 = pin.P8_20 # GPIO1_31 - GPIO_63 +P8_21 = pin.P8_21 # GPIO1_30 - GPIO_62 +P8_22 = pin.P8_22 # GPIO1_5 - GPIO_37 +P8_23 = pin.P8_23 # GPIO1_4 - GPIO_36 +P8_24 = pin.P8_24 # GPIO1_1 - GPIO_33 +P8_25 = pin.P8_25 # GPIO1_0 - GPIO_32 +P8_26 = pin.P8_26 # GPIO1_29 - GPIO_61 +P8_27 = pin.P8_27 # GPIO2_22 - GPIO_86 +P8_28 = pin.P8_28 # GPIO2_24 - GPIO_88 +P8_29 = pin.P8_29 # GPIO2_23 - GPIO_87 +P8_30 = pin.P8_30 # GPIO2_25 - GPIO_89 +P8_31 = pin.P8_31 # UART5_CTSN - GPIO_10 +P8_32 = pin.P8_32 # UART5_RTSN - GPIO_11 +P8_33 = pin.P8_33 # UART4_RTSN - GPIO_9 +P8_34 = pin.P8_34 # UART3_RTSN - GPIO_81 +P8_35 = pin.P8_35 # UART4_CTSN - GPIO_8 +P8_36 = pin.P8_36 # UART3_CTSN - GPIO_80 +P8_37 = pin.P8_37 # UART5_TXD - GPIO_78 +P8_38 = pin.P8_38 # UART5_RXD - GPIO_79 +P8_39 = pin.P8_39 # GPIO2_12 - GPIO_76 +P8_40 = pin.P8_40 # GPIO2_13 - GPIO_77 +P8_41 = pin.P8_41 # GPIO2_10 - GPIO_74 +P8_42 = pin.P8_42 # GPIO2_11 - GPIO_75 +P8_43 = pin.P8_43 # GPIO2_8 - GPIO_72 +P8_44 = pin.P8_44 # GPIO2_9 - GPIO_73 +P8_45 = pin.P8_45 # GPIO2_6 - GPIO_70 +P8_46 = pin.P8_46 # GPIO2_7 - GPIO_71 + +# P9_1 = DGND # DGND +# P9_2 = DGND # DGND +# P9_3 = VDD_3V3 # VDD_3V3 +# P9_4 = VDD_3V3 # VDD_3V3 +# P9_5 = VDD_5V # VDD_5V +# P9_6 = VDD_5V # VDD_5V +# P9_7 = SYS_5V # SYS_5V +# P9_8 = SYS_5V # SYS_5V +# P9_9 = PWR_BUT # PWR_BUT +# P9_10 = SYS_RESETN # SYS_RESETn +P9_11 = pin.P9_11 # UART4_RXD - GPIO_30 +P9_12 = pin.P9_12 # GPIO1_28 - GPIO_60 +P9_13 = pin.P9_13 # UART4_TXD - GPIO_31 +P9_14 = pin.P9_14 # EHRPWM1A - GPIO_50 +P9_15 = pin.P9_15 # GPIO1_16 - GPIO_48 +P9_16 = pin.P9_16 # EHRPWM1B - GPIO_51 +P9_17 = pin.P9_17 # I2C1_SCL - GPIO_5 +P9_18 = pin.P9_18 # I2C1_SDA - GPIO_4 +P9_19 = pin.P9_19 # I2C2_SCL - GPIO_13 +P9_20 = pin.P9_20 # I2C2_SDA - GPIO_12 +P9_21 = pin.P9_21 # UART2_TXD - GPIO_3 +P9_22 = pin.P9_22 # UART2_RXD - GPIO_2 +P9_23 = pin.P9_23 # GPIO1_17 - GPIO_49 +P9_24 = pin.P9_24 # UART1_TXD - GPIO_15 +P9_25 = pin.P9_25 # GPIO3_21 - GPIO_117 +P9_26 = pin.P9_26 # UART1_RXD - GPIO_14 +P9_27 = pin.P9_27 # GPIO3_19 - GPIO_115 +P9_28 = pin.P9_28 # SPI1_CS0 - GPIO_113 +P9_29 = pin.P9_29 # SPI1_D0 - GPIO_111 +P9_30 = pin.P9_30 # SPI1_D1 - GPIO_112 +P9_31 = pin.P9_31 # SPI1_SCLK - GPIO_110 +# P9_32 = VDD_ADC # VDD_ADC +# P9_33 = AIN4 # AIN4 +# P9_34 = GNDA_ADC # GNDA_ADC +# P9_35 = AIN6 # AIN6 +# P9_36 = AIN5 # AIN5 +# P9_37 = AIN2 # AIN2 +# P9_38 = AIN3 # AIN3 +# P9_39 = AIN0 # AIN0 +# P9_40 = AIN1 # AIN1 +P9_41 = pin.P9_41 # CLKOUT2 - GPIO_20 +P9_42 = pin.P9_42 # GPIO0_7 - GPIO_7 +# P9_43 = DGND # DGND +# P9_44 = DGND # DGND +# P9_45 = DGND # DGND +# P9_46 = DGND # DGND + +# common to all beagles +LED_USR0 = pin.USR0 +LED_USR1 = pin.USR1 +LED_USR2 = pin.USR2 +LED_USR3 = pin.USR3 +LED_USR4 = pin.USR4 + +# I2C and SPI pins from: +# src/adafruit_blinka/board/raspi_40pin.py +# SDA = pin.SDA +# SCL = pin.SCL +# CE1 = pin.D7 +# CE0 = pin.D8 +# MISO = pin.D9 +# MOSI = pin.D10 +# SCLK = pin.D11 +# SCK = pin.D11 +# TXD = pin.D14 +# RXD = pin.D15 +# MISO_1 = pin.D19 +# MOSI_1 = pin.D20 +# SCLK_1 = pin.D21 +# SCK_1 = pin.D21 + +SDA = pin.I2C4_SDA # P9_19 +SCL = pin.I2C4_SCL # P9_20 + +# Pins for SPI +# +# To enable SPI and an additional I2C port, add the following line to /boot/uEnv.txt: +# dtb=am5729-beagleboneai-roboticscape.dtb +# +# You can verify the dtb file exists by checking the /boot/dtbs/{kernel_version}/ folder +# +CE0 = pin.SPI1_CS0 # P9_28 +CE1 = pin.SPI1_CS1 # P9_42 +MOSI = pin.SPI1_D1 # P9_29 +MISO = pin.SPI1_D0 # P9_30 +SCLK = pin.SPI1_SCLK # P9_31 +# CircuitPython naming convention for SPI Clock +SCK = SCLK diff --git a/src/adafruit_blinka/board/lubancat/__init__.py b/src/adafruit_blinka/board/lubancat/__init__.py new file mode 100644 index 0000000..d56e3ea --- /dev/null +++ b/src/adafruit_blinka/board/lubancat/__init__.py @@ -0,0 +1 @@ +"""Boards definition from LubanCat""" diff --git a/src/adafruit_blinka/board/lubancat/lubancat_imx6ull.py b/src/adafruit_blinka/board/lubancat/lubancat_imx6ull.py new file mode 100644 index 0000000..26a3221 --- /dev/null +++ b/src/adafruit_blinka/board/lubancat/lubancat_imx6ull.py @@ -0,0 +1,51 @@ +"""Pin definitions for the LubanCat IMX6ULL.""" + +from adafruit_blinka.microcontroller.nxp_imx6ull import pin + +# Pro board pin header CN4 named GPIO_PAx, pin header CN5 named GPIO_PBx +# Mini board pin header CN3 named GPIO_PCx, pin header CN4 named GPIO_PDx + +# Board pin name [= alias] = RPI name [= alias] = pin name +GPIO_PC3 = I2C2_SDA = D2 = SDA = pin.I2C2_SDA +GPIO_PC5 = I2C2_SCL = D3 = SCL = pin.I2C2_SCL + +GPIO_PC7 = D4 = pin.GPIO27 +GPIO_PC8 = D14 = TXD = pin.UART3_TXD +GPIO_PC10 = D15 = RXD = pin.UART3_RXD +GPIO_PC11 = ADC_IN3 = A3 = D17 = pin.GPIO3 +GPIO_PC12 = D18 = pin.GPIO112 +GPIO_PC13 = ADC_IN2 = A2 = D27 = pin.GPIO2 +GPIO_PC15 = ADC_IN0 = A0 = D22 = pin.GPIO0 +GPIO_PC16 = D23 = pin.GPIO119 +GPIO_PC18 = D24 = pin.GPIO114 + +GPIO_PC19 = ECSPI3_MOSI = D10 = MOSI = pin.ECSPI3_MOSI +GPIO_PC21 = ECSPI3_MISO = D9 = MISO = pin.ECSPI3_MISO +GPIO_PC22 = D25 = pin.GPIO27 +GPIO_PC23 = ECSPI3_SCLK = D11 = SCLK = SCK = pin.ECSPI3_SCLK +GPIO_PC24 = ECSPI3_SS0 = D8 = SS0 = pin.ECSPI3_SS0 +GPIO_PC26 = ECSPI3_SS1 = D7 = SS1 = pin.ECSPI3_SS1 + +GPIO_PC27 = I2C3_SDA = D0 = pin.I2C3_SDA +GPIO_PC28 = I2C3_SCL = D1 = pin.I2C3_SCL + +GPIO_PC29 = D5 = pin.GPIO117 +GPIO_PC31 = D6 = pin.GPIO118 + +GPIO_PC32 = LED_D6 = D12 = pin.GPIO115 +GPIO_PC33 = LED_D5 = D13 = pin.GPIO116 + +# Board pwm channel = RPI PWM Channel = pin name +PWM_C7 = PWM1 = pin.GPIO115 +PWM_C8 = PWM2 = pin.GPIO116 + +GPIO_PC35 = D19 = pin.GPIO121 +GPIO_PC36 = D16 = pin.GPIO120 +GPIO_PC37 = D26 = pin.GPIO26 +GPIO_PC38 = D20 = pin.GPIO123 +GPIO_PC40 = D21 = pin.GPIO124 + +# Mini header CN4 +GPIO_PD9 = ADC_IN1 = A1 = pin.GPIO1 +GPIO_PD4 = LED_D4 = PWM_C3 = pin.GPIO4 +GPIO_PD17 = BUTTON2 = pin.GPIO129 diff --git a/src/adafruit_blinka/board/nanopi/__init__.py b/src/adafruit_blinka/board/nanopi/__init__.py new file mode 100644 index 0000000..64e3b6c --- /dev/null +++ b/src/adafruit_blinka/board/nanopi/__init__.py @@ -0,0 +1 @@ +"""Board definitions from NanoPi""" diff --git a/src/adafruit_blinka/board/nanopi/duo2.py b/src/adafruit_blinka/board/nanopi/duo2.py new file mode 100644 index 0000000..368c939 --- /dev/null +++ b/src/adafruit_blinka/board/nanopi/duo2.py @@ -0,0 +1,23 @@ +"""Pin definitions for the NanoPi Duo2.""" +# 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 GPIO +PG11 = pin.PG11 + +# I2C +SDA = pin.PA12 +SCL = pin.PA11 + +# SPI +SCLK = pin.PA14 +MOSI = pin.PA15 +MISO = pin.PA16 +CE0 = pin.PA13 + +# Serial UART +UART1_TX = pin.PG6 +UART1_RX = pin.PG7 diff --git a/src/adafruit_blinka/board/nanopi/neoair.py b/src/adafruit_blinka/board/nanopi/neoair.py new file mode 100644 index 0000000..68b5cbe --- /dev/null +++ b/src/adafruit_blinka/board/nanopi/neoair.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/radxa/rockpis.py b/src/adafruit_blinka/board/radxa/rockpis.py index e11574f..bf147d7 100644 --- a/src/adafruit_blinka/board/radxa/rockpis.py +++ b/src/adafruit_blinka/board/radxa/rockpis.py @@ -19,8 +19,11 @@ D24 = pin.GPIO2_B1 D25 = pin.GPIO2_A7 D27 = pin.GPIO0_C0 -SDA = pin.I2C1_SDA -SCL = pin.I2C1_SCL +SDA0 = pin.I2C0_SDA +SCL0 = pin.I2C0_SCL + +SDA1 = pin.I2C1_SDA +SCL1 = pin.I2C1_SCL SCL2 = pin.I2C2_SCL SDA2 = pin.I2C2_SDA @@ -28,6 +31,9 @@ SDA2 = pin.I2C2_SDA SCL3 = pin.I2C3_SCL SDA3 = pin.I2C3_SDA +SDA = SDA1 +SCL = SCL1 + SCLK = pin.SPI2_SCLK MOSI = pin.SPI2_MOSI MISO = pin.SPI2_MISO diff --git a/src/adafruit_blinka/microcontroller/bcm283x/pin.py b/src/adafruit_blinka/microcontroller/bcm283x/pin.py index e95364c..5022366 100644 --- a/src/adafruit_blinka/microcontroller/bcm283x/pin.py +++ b/src/adafruit_blinka/microcontroller/bcm283x/pin.py @@ -147,8 +147,10 @@ spiPorts = ( # ordered as uartId, txId, rxId uartPorts = ((1, TXD, RXD),) +# These are the known hardware I2C ports / pins. +# For software I2C ports created with the i2c-gpio overlay, see: +# https://github.com/adafruit/Adafruit_Python_Extended_Bus i2cPorts = ( - (3, SCL, SDA), (1, SCL, SDA), (0, D1, D0), # both pi 1 and pi 2 i2c ports! ) diff --git a/src/adafruit_blinka/microcontroller/dra74x/__init__.py b/src/adafruit_blinka/microcontroller/dra74x/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/adafruit_blinka/microcontroller/dra74x/pin.py b/src/adafruit_blinka/microcontroller/dra74x/pin.py new file mode 100644 index 0000000..28738c1 --- /dev/null +++ b/src/adafruit_blinka/microcontroller/dra74x/pin.py @@ -0,0 +1,185 @@ +"""DRA74x pin names""" +from adafruit_blinka.microcontroller.generic_linux.libgpiod_pin import Pin + +# BeagleBone AI +# P8_1 = DGND # DGND +# P8_2 = DGND # DGND +P8_3 = Pin((0, 24)) # GPIO1_24 - GPIO_24 +P8_4 = Pin((0, 25)) # GPIO1_25 - GPIO_25 +P8_5 = Pin((6, 1)) # GPIO7_1 - GPIO_193 +P8_6 = Pin((6, 2)) # GPIO7_2 - GPIO_194 +P8_7 = Pin((5, 5)) # TIMER4 - GPIO_165 +P8_8 = Pin((5, 6)) # TIMER7 - GPIO_166 +P8_9 = Pin((5, 18)) # TIMER5 - GPIO_178 +P8_10 = Pin((5, 4)) # TIMER6 - GPIO_164 +P8_11 = Pin((2, 11)) # GPIO3_11 - GPIO_75 +P8_12 = Pin((2, 10)) # GPIO3_10 - GPIO_74 +P8_13 = Pin((3, 11)) # EHRPWM2B - GPIO_107 +P8_14 = Pin((3, 13)) # GPIO4_13 - GPIO_109 +P8_15 = Pin((3, 3)) # GPIO4_3 - GPIO_99 +P8_16 = Pin((3, 29)) # GPIO4_29 - GPIO_125 +P8_17 = Pin((7, 18)) # GPIO8_18 - GPIO_242 +P8_18 = Pin((3, 9)) # GPIO4_9 - GPIO_105 +P8_19 = Pin((3, 10)) # EHRPWM2A - GPIO_106 +P8_20 = Pin((5, 30)) # GPIO6_30 - GPIO_190 +P8_21 = Pin((5, 29)) # GPIO6_29 - GPIO_189 +P8_22 = Pin((0, 23)) # GPIO1_23 - GPIO_23 +P8_23 = Pin((0, 22)) # GPIO1_22 - GPIO_22 +P8_24 = Pin((6, 0)) # GPIO7_0 - GPIO_192 +P8_25 = Pin((5, 31)) # GPIO6_31 - GPIO_191 +P8_26 = Pin((3, 28)) # GPIO4_28 - GPIO_124 +P8_27 = Pin((3, 23)) # GPIO4_23 - GPIO_119 +P8_28 = Pin((3, 19)) # GPIO4_19 - GPIO_115 +P8_29 = Pin((3, 22)) # GPIO4_22 - GPIO_118 +P8_30 = Pin((3, 20)) # GPIO4_20 - GPIO_116 +P8_31 = Pin((7, 14)) # UART5_CTSN - GPIO_238 +P8_32 = Pin((7, 15)) # UART5_RTSN - GPIO_239 +P8_33 = Pin((7, 13)) # UART4_RTSN - GPIO_237 +P8_34 = Pin((7, 11)) # UART3_RTSN - GPIO_235 +P8_35 = Pin((7, 12)) # UART4_CTSN - GPIO_236 +P8_36 = Pin((7, 10)) # UART3_CTSN - GPIO_234 +P8_37 = Pin((7, 8)) # UART5_TXD - GPIO_232 +P8_38 = Pin((7, 9)) # UART5_RXD - GPIO_233 +P8_39 = Pin((7, 6)) # GPIO8_6 - GPIO_230 +P8_40 = Pin((7, 7)) # GPIO8_7 - GPIO_231 +P8_41 = Pin((7, 4)) # GPIO8_4 - GPIO_228 +P8_42 = Pin((7, 5)) # GPIO8_5 - GPIO_229 +P8_43 = Pin((7, 2)) # GPIO8_2 - GPIO_226 +P8_44 = Pin((7, 3)) # GPIO8_3 - GPIO_227 +P8_45 = Pin((7, 0)) # GPIO8_0 - GPIO_224 +P8_46 = Pin((7, 1)) # GPIO8_1 - GPIO_225 + +# P9_1 = DGND # DGND - GPIO_0 +# P9_2 = DGND # DGND - GPIO_0 +# P9_3 = VDD_3V3 # VDD_3V3 - GPIO_0 +# P9_4 = VDD_3V3 # VDD_3V3 - GPIO_0 +# P9_5 = VDD_5V # VDD_5V - GPIO_0 +# P9_6 = VDD_5V # VDD_5V - GPIO_0 +# P9_7 = SYS_5V # SYS_5V - GPIO_0 +# P9_8 = SYS_5V # SYS_5V - GPIO_0 +# P9_9 = PWR_BUT # PWR_BUT - GPIO_0 +# P9_10 = SYS_RESETN # SYS_RESETn - GPIO_0 +P9_11 = Pin((7, 17)) # UART4_RXD - GPIO_241 +P9_12 = Pin((4, 0)) # GPIO5_0 - GPIO_128 +P9_13 = Pin((5, 12)) # UART4_TXD - GPIO_172 +P9_14 = Pin((3, 25)) # EHRPWM1A - GPIO_121 +P9_15 = Pin((2, 12)) # GPIO3_12 - GPIO_76 +P9_16 = Pin((3, 26)) # EHRPWM1B - GPIO_122 +P9_17 = Pin((6, 17)) # I2C1_SCL - GPIO_209 +P9_18 = Pin((6, 16)) # I2C1_SDA - GPIO_208 +P9_19 = Pin((6, 3)) # I2C2_SCL - GPIO_195 +P9_20 = Pin((6, 4)) # I2C2_SDA - GPIO_196 +P9_21 = Pin((2, 3)) # UART3_TXD - GPIO_67 +P9_22 = Pin((5, 19)) # UART3_RXD - GPIO_179 +P9_23 = Pin((6, 11)) # GPIO7_11 - GPIO_203 +P9_24 = Pin((5, 15)) # UART1_TXD - GPIO_175 +P9_25 = Pin((5, 17)) # GPIO6_17 - GPIO_177 +P9_26 = Pin((5, 14)) # UART1_RXD - GPIO_174 +P9_27 = Pin((3, 15)) # GPIO4_15 - GPIO_111 +P9_28 = Pin((3, 17)) # SPI1_CS0 - GPIO_113 +P9_29 = Pin((4, 11)) # SPI1_D0 - GPIO_139 +P9_30 = Pin((4, 12)) # SPI1_D1 - GPIO_140 +P9_31 = Pin((4, 10)) # SPI1_SCLK - GPIO_138 +# P9_32 = VDD_ADC # VDD_ADC - GPIO_0 +# P9_33 = AIN4 # AIN4 - GPIO_0 +# P9_34 = GNDA_ADC # GNDA_ADC - GPIO_0 +# P9_35 = AIN6 # AIN6 - GPIO_0 +# P9_36 = AIN5 # AIN5 - GPIO_0 +# P9_37 = AIN2 # AIN2 - GPIO_0 +# P9_38 = AIN3 # AIN3 - GPIO_0 +# P9_39 = AIN0 # AIN0 - GPIO_0 +# P9_40 = AIN1 # AIN1 - GPIO_0 +P9_41 = Pin((5, 20)) # CLKOUT2 - GPIO_180 +P9_42 = Pin((3, 18)) # GPIO4_18 - GPIO_114 +# P9_43 = DGND # DGND - GPIO_0 +# P9_44 = DGND # DGND - GPIO_0 +# P9_45 = DGND # DGND - GPIO_0 +# P9_46 = DGND # DGND - GPIO_0 + + +########################################## +# User LEDs +USR0 = Pin((2, 17)) # USR0 - GPIO3_17 +USR1 = Pin((4, 5)) # USR1 - GPIO5_5 +USR2 = Pin((2, 15)) # USR2 - GPIO3_15 +USR3 = Pin((2, 14)) # USR3 - GPIO3_14 +USR4 = Pin((2, 7)) # USR4 - GPIO3_7 + +# I2C4 +I2C4_SCL = P9_19 # i2c4_scl +I2C4_SDA = P9_20 # i2c4_sda + +# I2C5 +I2C5_SCL = P9_17 # i2c5_scl +I2C5_SDA = P9_18 # i2c5_sda + +# SPI0 +SPI0_CS0 = P9_17 +SPI0_D1 = P9_18 +SPI0_D0 = P9_21 +SPI0_SCLK = P9_22 + +# SPI1 +SPI1_CS0 = P9_28 +SPI1_CS1 = P9_42 +SPI1_SCLK = P9_31 +SPI1_D0 = P9_30 +SPI1_D1 = P9_29 + +# UART0 +UART0_TXD = P8_44 +UART0_RXD = P8_36 +UART0_RTSn = P8_34 +UART0_CTSn = P8_45 + +# UART3 +UART3_TXD = P9_21 +UART3_RXD = P9_22 +UART3_RTSn = P9_17 +UART3_CTSn = P9_18 + +# UART5 +UART5_TXD = P9_13 +UART5_RXD = P9_11 +UART5_RTSn = P8_6 +UART5_CTSn = P8_5 + +# UART8 +UART8_TXD = P8_37 +UART8_RXD = P8_38 +UART8_RTSn = P8_32 +UART8_CTSn = P8_31 + +# UART10 +UART10_TXD = P9_24 +UART10_RXD = P9_26 +UART10_RTSn = P8_4 +UART10_CTSn = P8_3 + +# PWM +TIMER10 = P8_10 +TIMER11 = P8_7 +TIMER12 = P8_8 +TIMER14 = P8_9 + +# ordered as i2cId, SCL, SDA +i2cPorts = ( + (3, I2C4_SCL, I2C4_SDA), # default config + (4, I2C4_SCL, I2C4_SDA), # roboticscape config + (3, I2C5_SCL, I2C5_SDA), # roboticscape config +) + +# ordered as spiId, sckId, mosiId, misoId +spiPorts = ( + (0, SPI0_SCLK, SPI0_D0, SPI0_D1), + (1, SPI1_SCLK, SPI1_D1, SPI1_D0), +) + +# ordered as uartId, txId, rxId +uartPorts = ( + (0, UART0_TXD, UART0_RXD), + (3, UART3_TXD, UART3_RXD), + (5, UART5_TXD, UART5_RXD), + (8, UART8_TXD, UART8_RXD), + (10, UART10_TXD, UART10_RXD), +) diff --git a/src/adafruit_blinka/microcontroller/mcp2221/i2c.py b/src/adafruit_blinka/microcontroller/mcp2221/i2c.py index cd8f60d..df2642f 100644 --- a/src/adafruit_blinka/microcontroller/mcp2221/i2c.py +++ b/src/adafruit_blinka/microcontroller/mcp2221/i2c.py @@ -7,7 +7,7 @@ class I2C: def __init__(self, *, frequency=100000): self._mcp2221 = mcp2221 - self._mcp2221.i2c_configure(frequency) + self._mcp2221._i2c_configure(frequency) def scan(self): """Perform an I2C Device Scan""" diff --git a/src/adafruit_blinka/microcontroller/mcp2221/mcp2221.py b/src/adafruit_blinka/microcontroller/mcp2221/mcp2221.py index e01eb7b..0e061e6 100644 --- a/src/adafruit_blinka/microcontroller/mcp2221/mcp2221.py +++ b/src/adafruit_blinka/microcontroller/mcp2221/mcp2221.py @@ -296,7 +296,7 @@ class MCP2221: # pylint: enable=too-many-arguments - def i2c_configure(self, baudrate=100000): + def _i2c_configure(self, baudrate=100000): """Configure I2C""" self._hid_xfer( bytes( diff --git a/src/adafruit_blinka/microcontroller/nxp_imx6ull/__init__.py b/src/adafruit_blinka/microcontroller/nxp_imx6ull/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/adafruit_blinka/microcontroller/nxp_imx6ull/pin.py b/src/adafruit_blinka/microcontroller/nxp_imx6ull/pin.py new file mode 100644 index 0000000..7ffa331 --- /dev/null +++ b/src/adafruit_blinka/microcontroller/nxp_imx6ull/pin.py @@ -0,0 +1,67 @@ +"""NXP IMX6ULL pin names""" +from adafruit_blinka.microcontroller.generic_linux.libgpiod_pin import Pin + +# GPIO num = reconment function = Pin((chip, line)) +GPIO31 = I2C2_SDA = Pin((0, 31)) # GPIO1_IO31 +GPIO30 = I2C2_SCL = Pin((0, 30)) # GPIO1_IO30 + +GPIO29 = I2C3_SDA = Pin((0, 29)) # GPIO1_IO29 +GPIO28 = I2C3_SCL = Pin((0, 28)) # GPIO1_IO28 + +GPIO24 = UART3_TXD = Pin((0, 24)) # GPIO1_IO24 +GPIO25 = UART3_RXD = Pin((0, 25)) # GPIO1_IO25 + +GPIO22 = ECSPI3_MOSI = Pin((0, 22)) # GPIO1_IO22 +GPIO23 = ECSPI3_MISO = Pin((0, 23)) # GPIO1_IO23 +GPIO21 = ECSPI3_SCLK = Pin((0, 21)) # GPIO1_IO21 +GPIO20 = ECSPI3_SS0 = Pin((0, 20)) # GPIO1_IO20 +GPIO18 = ECSPI3_SS1 = Pin((0, 18)) # GPIO1_IO18 + +GPIO0 = ADC_IN0 = Pin((0, 0)) # GPIO1_IO0 +GPIO1 = ADC_IN1 = Pin((0, 1)) # GPIO1_IO2 +GPIO2 = ADC_IN2 = Pin((0, 2)) # GPIO1_IO2 +GPIO3 = ADC_IN3 = Pin((0, 3)) # GPIO1_IO3 +GPIO4 = PWM_C3 = Pin((0, 4)) # GPIO1_IO4 +GPIO26 = Pin((0, 26)) # GPIO1_IO26 +GPIO27 = Pin((0, 27)) # GPIO1_IO27 + +GPIO113 = Pin((3, 17)) # GPIO4_IO17 +GPIO114 = Pin((3, 18)) # GPIO4_IO18 +GPIO115 = PWM_C7 = Pin((3, 19)) # GPIO4_IO19 +GPIO116 = PWM_C8 = Pin((3, 20)) # GPIO4_IO20 +GPIO117 = Pin((3, 21)) # GPIO4_IO21 +GPIO118 = Pin((3, 22)) # GPIO4_IO22 +GPIO119 = Pin((3, 23)) # GPIO4_IO23 +GPIO120 = Pin((3, 24)) # GPIO4_IO24 +GPIO121 = Pin((3, 25)) # GPIO4_IO25 +GPIO112 = Pin((3, 26)) # GPIO4_IO26 +GPIO123 = Pin((3, 27)) # GPIO4_IO27 +GPIO124 = Pin((3, 28)) # GPIO4_IO28 + +GPIO129 = Pin((4, 1)) # GPIO5_IO1 + +i2cPorts = ( + (1, I2C2_SCL, I2C2_SDA), + (2, I2C3_SCL, I2C3_SDA), +) + +# ordered as spiId, sckId, mosiId, misoId +spiPorts = ((2, ECSPI3_SCLK, ECSPI3_MOSI, ECSPI3_MISO),) + +# UART3_TXD/RXD on /dev/ttymxc2 +uartPorts = ((2, UART3_TXD, UART3_RXD),) + +# SysFS pwm outputs, pwm channel and pin in first tuple +pwmOuts = ( + ((2, 0), PWM_C3), + ((6, 0), PWM_C7), + ((7, 0), PWM_C8), +) + +# SysFS analog inputs, Ordered as analog analogInId, device, and channel +analogIns = ( + (ADC_IN0, 0, 0), + (ADC_IN1, 0, 1), + (ADC_IN2, 0, 2), + (ADC_IN3, 0, 3), +) diff --git a/src/adafruit_blinka/microcontroller/rockchip/rk3308/pin.py b/src/adafruit_blinka/microcontroller/rockchip/rk3308/pin.py index 80c5c76..818c9dd 100644 --- a/src/adafruit_blinka/microcontroller/rockchip/rk3308/pin.py +++ b/src/adafruit_blinka/microcontroller/rockchip/rk3308/pin.py @@ -134,10 +134,12 @@ ADC_IN0 = 1 # I2C +I2C0_SDA = GPIO1_D0 +I2C0_SCL = GPIO1_D1 I2C1_SDA = GPIO0_B3 I2C1_SCL = GPIO0_B4 -I2C2_SDA = GPIO1_D0 -I2C2_SCL = GPIO1_D1 +I2C2_SDA = GPIO2_A2 +I2C2_SCL = GPIO2_A3 I2C3_SDA = GPIO0_B7 I2C3_SCL = GPIO0_C0 @@ -161,6 +163,7 @@ PWM3 = GPIO0_C0 # ordered as i2cId, SCL, SDA i2cPorts = ( + (0, I2C0_SCL, I2C0_SDA), (1, I2C1_SCL, I2C1_SDA), (2, I2C2_SCL, I2C2_SDA), (3, I2C3_SCL, I2C3_SDA), diff --git a/src/analogio.py b/src/analogio.py index 97323e4..8ca58c1 100644 --- a/src/analogio.py +++ b/src/analogio.py @@ -21,6 +21,8 @@ elif detector.board.greatfet_one: from adafruit_blinka.microcontroller.nxp_lpc4330.analogio import AnalogOut elif detector.chip.RK3308: from adafruit_blinka.microcontroller.generic_linux.sysfs_analogin import AnalogIn +elif detector.chip.IMX6ULL: + from adafruit_blinka.microcontroller.generic_linux.sysfs_analogin import AnalogIn elif "sphinx" in sys.modules: pass else: diff --git a/src/board.py b/src/board.py index 4b66d8d..a305189 100755 --- a/src/board.py +++ b/src/board.py @@ -67,11 +67,16 @@ elif board_id == ap_board.BEAGLEBONE_BLACK_INDUSTRIAL: elif board_id == ap_board.BEAGLEBONE_GREEN_WIRELESS: from adafruit_blinka.board.beagleboard.beaglebone_black import * + elif board_id == ap_board.BEAGLEBONE_BLACK_WIRELESS: from adafruit_blinka.board.beagleboard.beaglebone_black import * + elif board_id == ap_board.BEAGLEBONE_POCKETBEAGLE: from adafruit_blinka.board.beagleboard.beaglebone_pocketbeagle import * +elif board_id == ap_board.BEAGLEBONE_AI: + from adafruit_blinka.board.beagleboard.beaglebone_ai import * + elif board_id == ap_board.ORANGE_PI_PC: from adafruit_blinka.board.orangepi.orangepipc import * @@ -186,6 +191,15 @@ 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.LUBANCAT_IMX6ULL: + from adafruit_blinka.board.lubancat.lubancat_imx6ull import * + +elif board_id == ap_board.NANOPI_NEO_AIR: + from adafruit_blinka.board.nanopi.neoair import * + +elif board_id == ap_board.NANOPI_DUO2: + from adafruit_blinka.board.nanopi.duo2 import * + elif "sphinx" in sys.modules: pass diff --git a/src/busio.py b/src/busio.py index 35e7c88..af1712d 100755 --- a/src/busio.py +++ b/src/busio.py @@ -27,7 +27,7 @@ class I2C(Lockable): for both MicroPython and Linux. """ - def __init__(self, scl, sda, frequency=400000): + def __init__(self, scl, sda, frequency=100000): self.init(scl, sda, frequency) def init(self, scl, sda, frequency): @@ -198,12 +198,18 @@ class SPI(Lockable): if detector.board.any_raspberry_pi or detector.board.any_raspberry_pi_40_pin: from adafruit_blinka.microcontroller.bcm283x.pin import Pin from adafruit_blinka.microcontroller.generic_linux.spi import SPI as _SPI + elif detector.board.BEAGLEBONE_AI: + from adafruit_blinka.microcontroller.dra74x.pin import Pin + from adafruit_blinka.microcontroller.generic_linux.spi import SPI as _SPI elif detector.board.any_beaglebone: from adafruit_blinka.microcontroller.am335x.pin import Pin from adafruit_blinka.microcontroller.generic_linux.spi import SPI as _SPI elif detector.board.any_orange_pi and detector.chip.id == ap_chip.SUN8I: from adafruit_blinka.microcontroller.allwinner.h3.pin import Pin from adafruit_blinka.microcontroller.generic_linux.spi import SPI as _SPI + elif detector.board.any_nanopi and detector.chip.id == ap_chip.SUN8I: + from adafruit_blinka.microcontroller.allwinner.h3.pin import Pin + from adafruit_blinka.microcontroller.generic_linux.spi import SPI as _SPI elif board_id == ap_board.GIANT_BOARD: from adafruit_blinka.microcontroller.sama5.pin import Pin from adafruit_blinka.microcontroller.generic_linux.spi import SPI as _SPI @@ -269,6 +275,9 @@ class SPI(Lockable): elif board_id == ap_board.ONION_OMEGA2: from adafruit_blinka.microcontroller.mips24kec.pin import Pin from adafruit_blinka.microcontroller.generic_linux.spi import SPI as _SPI + elif detector.board.any_lubancat and detector.chip.id == ap_chip.IMX6ULL: + from adafruit_blinka.microcontroller.nxp_imx6ull.pin import Pin + from adafruit_blinka.microcontroller.generic_linux.spi import SPI as _SPI else: from machine import SPI as _SPI from machine import Pin diff --git a/src/digitalio.py b/src/digitalio.py index 406e261..82e231c 100755 --- a/src/digitalio.py +++ b/src/digitalio.py @@ -15,6 +15,8 @@ if detector.chip.BCM2XXX: from adafruit_blinka.microcontroller.bcm283x.pin import Pin elif detector.chip.AM33XX: from adafruit_blinka.microcontroller.am335x.pin import Pin +elif detector.chip.DRA74X: + from adafruit_blinka.microcontroller.dra74x.pin import Pin elif detector.chip.SUN8I: from adafruit_blinka.microcontroller.allwinner.h3.pin import Pin elif detector.chip.SAMA5: @@ -37,6 +39,8 @@ elif detector.chip.APQ8016: from adafruit_blinka.microcontroller.snapdragon.apq8016.pin import Pin elif detector.chip.IMX8MX: from adafruit_blinka.microcontroller.nxp_imx8m.pin import Pin +elif detector.chip.IMX6ULL: + from adafruit_blinka.microcontroller.nxp_imx6ull.pin import Pin elif detector.chip.HFU540: from adafruit_blinka.microcontroller.hfu540.pin import Pin elif detector.chip.A64: diff --git a/src/microcontroller/__init__.py b/src/microcontroller/__init__.py index a10bab6..df91de4 100755 --- a/src/microcontroller/__init__.py +++ b/src/microcontroller/__init__.py @@ -38,6 +38,8 @@ elif chip_id == ap_chip.STM32F405: from adafruit_blinka.microcontroller.stm32.stm32f405 import * elif chip_id == ap_chip.BCM2XXX: from adafruit_blinka.microcontroller.bcm283x import * +elif chip_id == ap_chip.DRA74X: + from adafruit_blinka.microcontroller.dra74x.pin import * elif chip_id == ap_chip.AM33XX: from adafruit_blinka.microcontroller.am335x import * elif chip_id == ap_chip.SUN8I: @@ -70,6 +72,8 @@ elif chip_id == ap_chip.H5: from adafruit_blinka.microcontroller.allwinner.h5.pin import * elif chip_id == ap_chip.IMX8MX: from adafruit_blinka.microcontroller.nxp_imx8m import * +elif chip_id == ap_chip.IMX6ULL: + from adafruit_blinka.microcontroller.nxp_imx6ull import * elif chip_id == ap_chip.HFU540: from adafruit_blinka.microcontroller.hfu540.pin import * elif chip_id == ap_chip.BINHO: diff --git a/src/microcontroller/pin.py b/src/microcontroller/pin.py index 3e5a6e2..4ac63dd 100755 --- a/src/microcontroller/pin.py +++ b/src/microcontroller/pin.py @@ -12,6 +12,8 @@ elif chip_id == ap_chip.STM32F405: from adafruit_blinka.microcontroller.stm32.stm32f405.pin import * elif chip_id == ap_chip.BCM2XXX: from adafruit_blinka.microcontroller.bcm283x.pin import * +elif chip_id == ap_chip.DRA74X: + from adafruit_blinka.microcontroller.dra74x.pin import * elif chip_id == ap_chip.AM33XX: from adafruit_blinka.microcontroller.am335x.pin import * elif chip_id == ap_chip.SUN8I: @@ -36,6 +38,8 @@ elif chip_id == ap_chip.APQ8016: from adafruit_blinka.microcontroller.snapdragon.apq8016.pin import * elif chip_id == ap_chip.IMX8MX: from adafruit_blinka.microcontroller.nxp_imx8m.pin import * +elif chip_id == ap_chip.IMX6ULL: + from adafruit_blinka.microcontroller.nxp_imx6ull.pin import * elif chip_id == ap_chip.HFU540: from adafruit_blinka.microcontroller.hfu540.pin import * elif chip_id == ap_chip.FT232H: diff --git a/src/pulseio.py b/src/pulseio.py index 848ff14..dc20e3d 100644 --- a/src/pulseio.py +++ b/src/pulseio.py @@ -28,6 +28,8 @@ elif detector.board.binho_nova: from adafruit_blinka.microcontroller.nova.pwmout import PWMOut elif detector.board.greatfet_one: from adafruit_blinka.microcontroller.nxp_lpc4330.pwmout import PWMOut +elif detector.board.any_lubancat: + from adafruit_blinka.microcontroller.generic_linux.sysfs_pwmout import PWMOut elif "sphinx" in sys.modules: pass else: diff --git a/src/pwmio.py b/src/pwmio.py new file mode 100644 index 0000000..05263c2 --- /dev/null +++ b/src/pwmio.py @@ -0,0 +1,35 @@ +""" +`pwmio` - Support for PWM based protocols +=========================================================== +See `CircuitPython:pwmio` in CircuitPython for more details. +Not supported by all boards. + +* Author(s): Melissa LeBlanc-Williams +""" + +import sys + +from adafruit_blinka.agnostic import detector + +# pylint: disable=unused-import + +if detector.board.any_raspberry_pi: + from adafruit_blinka.microcontroller.bcm283x.pulseio.PWMOut import PWMOut +elif detector.board.any_coral_board: + from adafruit_blinka.microcontroller.generic_linux.sysfs_pwmout import PWMOut +elif detector.board.any_giant_board: + from adafruit_blinka.microcontroller.generic_linux.sysfs_pwmout import PWMOut +elif detector.board.any_beaglebone: + from adafruit_blinka.microcontroller.am335x.sysfs_pwmout import PWMOut +elif detector.board.any_rock_pi_board: + from adafruit_blinka.microcontroller.generic_linux.sysfs_pwmout import PWMOut +elif detector.board.binho_nova: + from adafruit_blinka.microcontroller.nova.pwmout import PWMOut +elif detector.board.greatfet_one: + from adafruit_blinka.microcontroller.nxp_lpc4330.pwmout import PWMOut +elif detector.board.any_lubancat: + from adafruit_blinka.microcontroller.generic_linux.sysfs_pwmout import PWMOut +elif "sphinx" in sys.modules: + pass +else: + raise NotImplementedError("pwmio not supported for this board.")