diff --git a/src/adafruit_blinka/board/ameridroid/__init__.py b/src/adafruit_blinka/board/ameridroid/__init__.py new file mode 100644 index 00000000..18e0b413 --- /dev/null +++ b/src/adafruit_blinka/board/ameridroid/__init__.py @@ -0,0 +1,4 @@ +# SPDX-FileCopyrightText: 2024 Rippanda12 +# +# SPDX-License-Identifier: MIT +"""Boards definition from ameriDroid""" diff --git a/src/adafruit_blinka/board/ameridroid/indiedroid_nova.py b/src/adafruit_blinka/board/ameridroid/indiedroid_nova.py new file mode 100644 index 00000000..ff2501e3 --- /dev/null +++ b/src/adafruit_blinka/board/ameridroid/indiedroid_nova.py @@ -0,0 +1,134 @@ +# SPDX-FileCopyrightText: 2024 Rippanda12 +# +# SPDX-License-Identifier: MIT + +"""Pin definitions for the Indiedroid Nova""" + +from adafruit_blinka.microcontroller.rockchip.rk3588s import pin + + +# D1 = +3.3V +# D2 = +5V +D3 = pin.GPIO1_D7 +# D4 = +5V +D5 = pin.GPIO1_D6 +# D6 = GND +D7 = pin.GPIO1_A6 +D8 = pin.GPIO4_A3 +# D9 = GND +D10 = pin.GPIO4_A4 +D11 = pin.GPIO1_B4 +D12 = pin.GPIO0_D0 +D13 = pin.GPIO1_B5 +# D14 = GND +D15 = pin.GPIO3_C4 +D16 = pin.GPIO3_B0 +# D17 = +3.3V +D18 = pin.GPIO3_B1 +D19 = pin.GPIO3_B7 +# D20 = GND +D21 = pin.GPIO3_C0 +D22 = pin.GPIO3_C5 +D23 = pin.GPIO3_C1 +D24 = pin.GPIO0_D3 +# D25 = GND +D26 = pin.GPIO3_C3 +D27 = pin.GPIO1_A0 +D28 = pin.GPIO1_C1 +D29 = pin.GPIO1_A4 +# D30 = GND +D31 = pin.GPIO1_B1 +D32 = pin.GPIO4_A6 +D33 = pin.GPIO1_B2 +# D34 = GND +D35 = pin.GPIO4_A7 +D36 = pin.GPIO4_B5 +D37 = pin.GPIO4_A2 +D38 = pin.GPIO4_B4 +# D39 = GND +D40 = pin.GPIO4_B3 + + +# UART +# UART2_M0 +UART2_TX = pin.GPIO1_B5 +UART2_RX = pin.GPIO1_B6 +# UART0_M2 +UART0_TX = pin.GPIO4_A3 +UART0_RX = pin.GPIO4_A4 +# UART5_M1 +UART5_TX = pin.GPIO3_C4 +UART5_RX = pin.GPIO3_C5 +# UART7_M1 +UART7_TX = pin.GPIO3_C0 +UART7_RX = pin.GPIO3_C1 + +# Default UART -> UART2_M0 + +TX = UART2_TX +RX = UART2_RX +TXD = UART2_TX +RXD = UART2_RX + +# I2C + +# I2C3_M1 +I2C3_SCL = pin.GPIO3_B7 +I2C3_SDA = pin.GPIO3_C0 +# I2C5_M2 +I2C5_SCL = pin.GPIO4_A6 +I2C5_SDA = pin.GPIO4_A7 +# I2C7_M3 +I2C7_SCL = pin.GPIO4_B2 +I2C7_SDA = pin.GPIO4_B3 +# I2C8_M2 +I2C8_SCL = pin.GPIO1_D6 +I2C8_SDA = pin.GPIO1_D7 + +# Default I2C -> I2C8_M2 +SCL = I2C8_SCL +SDA = I2C8_SDA + +# SPI +# SPI0_M2 +SPI0_SCLK = pin.GPIO4_A2 +SPI0_MISO = pin.GPIO1_B1 +SPI0_MOSI = pin.GPIO1_B2 +SPI0_CS0 = pin.GPIO1_B4 +# SPI1_M1 +SPI1_CLK = pin.GPIO3_C1 +SPI1_MISO = pin.GPIO3_C0 +SPI1_MOSI = pin.GPIO3_B7 +SPI1_CS1 = pin.GPIO3_C3 +# SPI4_M2 +SPI4_SCLK = pin.GPIO1_D6 +SPI4_MISO = pin.GPIO1_D7 +SPI4_MOSI = pin.GPIO1_D6 +SPI4_CS0 = pin.GPIO1_D7 +# SPI5_M1 +SPI5_SCLK = pin.GPIO3_B1 +SPI5_MISO = pin.GPIO3_B0 +SPI5_MOSI = pin.GPIO3_B7 +SPI5_CS1 = pin.GPIO3_C3 + +# Default SPI -> SPI4_M2 +MOSI = SPI4_MOSI +MISO = SPI4_MISO +SCLK = SPI4_SCLK +CS = SPI4_CS0 + +# PWM +# PWM2_M1 +PWM2 = pin.GPIO3_B1 +# PWM7_M0 +PWM7 = pin.GPIO0_D0 +# PWM9_M0 +PWM9 = pin.GPIO3_B0 +# PWM11_M1 +PWM11 = pin.GPIO4_B4 +# PWM12_M1 +PWM12 = pin.GPIO4_B5 +# PWM14_M2 +PWM14 = pin.GPIO1_D6 +# PWM15_M0 +PWM15 = pin.GPIO3_C3 diff --git a/src/adafruit_blinka/board/bananapi/bpif3.py b/src/adafruit_blinka/board/bananapi/bpif3.py new file mode 100644 index 00000000..49d71583 --- /dev/null +++ b/src/adafruit_blinka/board/bananapi/bpif3.py @@ -0,0 +1,56 @@ +# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries +# +# SPDX-License-Identifier: MIT +"""Pin definitions for the Banana Pi F3.""" + +from adafruit_blinka.microcontroller.spacemit.k1 import pin + +# I2C +I2C4_SCL = pin.I2C4_SCL +I2C4_SDA = pin.I2C4_SDA + +# Default I2C +SCL = I2C4_SCL +SDA = I2C4_SDA + +# UART +UART0_TX = pin.UART0_TX +UART0_RX = pin.UART0_RX + +# Default UART +TX = UART0_TX +RX = UART0_RX +TXD = UART0_TX +RXD = UART0_RX + +# SPI +SPI3_MOSI = pin.SPI3_MOSI +SPI3_MISO = pin.SPI3_MISO +SPI3_SCLK = pin.SPI3_SCLK +SPI3_CS0 = pin.SPI3_CS0 + +# Default SPI +MOSI = SPI3_MOSI +MISO = SPI3_MISO +SCLK = SPI3_SCLK +CS = SPI3_CS0 + +# Pinout reference: +# https://wiki.banana-pi.org/Banana_Pi_BPI-M4_Berry#BPI-M4_Berry_40-pin_header +D3 = pin.GPIO_52 +D5 = pin.GPIO_51 +D7 = pin.GPIO_70 +D8 = pin.GPIO_47 +D10 = pin.GPIO_48 +D11 = pin.GPIO_71 +D12 = pin.GPIO_74 +D13 = pin.GPIO_72 +D15 = pin.GPIO_73 +D16 = pin.GPIO_91 +D18 = pin.GPIO_92 +D19 = pin.GPIO_77 +D21 = pin.GPIO_78 +D22 = pin.GPIO_49 +D23 = pin.GPIO_75 +D24 = pin.GPIO_76 +D26 = pin.GPIO_50 diff --git a/src/adafruit_blinka/board/bananapi/bpim4berry.py b/src/adafruit_blinka/board/bananapi/bpim4berry.py new file mode 100644 index 00000000..b220718a --- /dev/null +++ b/src/adafruit_blinka/board/bananapi/bpim4berry.py @@ -0,0 +1,71 @@ +# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries +# +# SPDX-License-Identifier: MIT +"""Pin definitions for the Banana Pi M4 Berry.""" + +from adafruit_blinka.microcontroller.allwinner.h618 import pin + +# I2C +I2C3_SCL = pin.TWI3_SCL +I2C3_SDA = pin.TWI3_SDA +I2C4_SCL = pin.TWI4_SCL +I2C4_SDA = pin.TWI4_SDA + +# Default I2C +SCL = I2C4_SCL +SDA = I2C4_SDA + +# UART +UART1_TX = pin.UART1_TX +UART1_RX = pin.UART1_RX +UART5_TX = pin.UART5_TX +UART5_RX = pin.UART5_RX + +# Default UART +TX = UART1_TX +RX = UART1_RX +TXD = UART1_TX +RXD = UART1_RX + +# SPI +SPI1_MOSI = pin.SPI1_MOSI +SPI1_MISO = pin.SPI1_MISO +SPI1_SCLK = pin.SPI1_SCLK +SPI1_CS0 = pin.SPI1_CS0 + +# Default SPI +MOSI = SPI1_MOSI +MISO = SPI1_MISO +SCLK = SPI1_SCLK +CS = SPI1_CS0 + +# Pinout reference: +# https://wiki.banana-pi.org/Banana_Pi_BPI-M4_Berry#BPI-M4_Berry_40-pin_header +D3 = pin.PG16 +D5 = pin.PG15 +D7 = pin.PG19 +D8 = pin.PG6 +D10 = pin.PG7 +D11 = pin.PH2 +D12 = pin.PG11 +D13 = pin.PH3 +D15 = pin.PG2 +D16 = pin.PG8 +D18 = pin.PG9 +D19 = pin.PH7 +D21 = pin.PH8 +D22 = pin.PG1 +D23 = pin.PH6 +D24 = pin.PH5 +D26 = pin.PH9 +D27 = pin.PG18 +D28 = pin.PG17 +D29 = pin.PG3 +D31 = pin.PG4 +D32 = pin.PG0 +D33 = pin.PG5 +D35 = pin.PG12 +D36 = pin.PH4 +D37 = pin.PG10 +D38 = pin.PG14 +D40 = pin.PG13 diff --git a/src/adafruit_blinka/board/bananapi/bpim4zero.py b/src/adafruit_blinka/board/bananapi/bpim4zero.py new file mode 100644 index 00000000..bd2e553c --- /dev/null +++ b/src/adafruit_blinka/board/bananapi/bpim4zero.py @@ -0,0 +1,71 @@ +# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries +# +# SPDX-License-Identifier: MIT +"""Pin definitions for the Banana Pi M4 Zero.""" + +from adafruit_blinka.microcontroller.allwinner.h618 import pin + +# I2C +I2C0_SCL = pin.TWI0_SCL +I2C0_SDA = pin.TWI0_SDA +I2C1_SCL = pin.TWI1_SCL +I2C1_SDA = pin.TWI1_SDA + +# Default I2C +SCL = I2C0_SCL +SDA = I2C0_SDA + +# UART +UART4_TX = pin.UART4_TX +UART4_RX = pin.UART4_RX +UART5_TX = pin.UART5_TX +UART5_RX = pin.UART5_RX + +# Default UART +TX = UART4_TX +RX = UART4_RX +TXD = UART4_TX +RXD = UART4_RX + +# SPI +SPI1_MOSI = pin.SPI1_MOSI +SPI1_MISO = pin.SPI1_MISO +SPI1_SCLK = pin.SPI1_SCLK +SPI1_CS0 = pin.SPI1_CS0 + +# Default SPI +MOSI = SPI1_MOSI +MISO = SPI1_MISO +SCLK = SPI1_SCLK +CS = SPI1_CS0 + +# Pinout reference: +# https://wiki.banana-pi.org/Banana_Pi_BPI-M4_Zero#BPI-M4_Zero_40-pin_header +D3 = pin.PI6 +D5 = pin.PI5 +D7 = pin.PI12 +D8 = pin.PI13 +D10 = pin.PI14 +D11 = pin.PH2 +D12 = pin.PI1 +D13 = pin.PH3 +D15 = pin.PI11 +D16 = pin.PI15 +D18 = pin.PI16 +D19 = pin.PH7 +D21 = pin.PH8 +D22 = pin.PC2 +D23 = pin.PH6 +D24 = pin.PH5 +D26 = pin.PH9 +D27 = pin.PI8 +D28 = pin.PI7 +D29 = pin.PI10 +D31 = pin.PI9 +D32 = pin.PH4 +D33 = pin.PH10 +D35 = pin.PI2 +D36 = pin.PC7 +D37 = pin.PI0 +D38 = pin.PI4 +D40 = pin.PI3 diff --git a/src/adafruit_blinka/board/orangepi/orangepi3b.py b/src/adafruit_blinka/board/orangepi/orangepi3b.py new file mode 100644 index 00000000..ff4eee04 --- /dev/null +++ b/src/adafruit_blinka/board/orangepi/orangepi3b.py @@ -0,0 +1,84 @@ +# SPDX-FileCopyrightText: 2024 cst_zf +# +# SPDX-License-Identifier: MIT +"""Pin definitions for the Orangepi 3B.""" + +from adafruit_blinka.microcontroller.rockchip.rk3566 import pin + +# D pin number is ordered by physical pin sequence +# Reference: https://service.robots.org.nz/wiki/Wiki.jsp?page=OrangePi + +# D2 = VCC5V0_SYS +D3 = pin.I2C2_SDA_M1 +# D4 = VCC5V0_SYS +D5 = pin.I2C2_SCL_M1 +# D6 = GND +D7 = pin.GPIO4_C3 # GPIO4_C3/PWM15 +D8 = pin.GPIO0_D1 +# D9 = GND +D10 = pin.GPIO0_D0 +D11 = pin.GPIO3_C6 +D12 = pin.GPIO3_C7 +D13 = pin.GPIO4_A0 +# D14 = GND +D15 = pin.GPIO4_A2 +D16 = pin.GPIO4_A3 +# D17 = Vcc3V3_SYS +D18 = pin.GPIO4_A1 +D19 = pin.SPI3_MOSI_M0 +# D20 = GND +D21 = pin.SPI3_MISO_M0 +D22 = pin.GPIO4_A4 +D23 = pin.SPI3_CLK_M0 +D24 = pin.SPI3_CS0_M0 +# D25 = GND +D26 = pin.GPIO4_A7 +D27 = pin.I2C3_SDA_M0 +D28 = pin.I2C3_SCL_M0 +D29 = pin.GPIO4_A5 +# D30 = GND +D31 = pin.GPIO3_D4 +D32 = pin.GPIO4_C0 +D33 = pin.GPIO3_D7 +# D34 = GND +D35 = pin.GPIO3_D0 +D36 = pin.GPIO3_D5 +D37 = pin.GPIO3_D3 +D38 = pin.GPIO3_D2 +# D39 = GND +D40 = pin.GPIO3_D1 + +# UART +UART2_TX_M0 = pin.GPIO0_D1 +UART2_RX_M0 = pin.GPIO0_D0 + +UART7_TX_M2 = pin.GPIO4_A2 +UART7_RX_M2 = pin.GPIO4_A3 + +UART3_TX_M0 = pin.GPIO1_A1 +UART3_RX_M0 = pin.GPIO1_A0 + +UART9_TX_M2 = pin.GPIO4_A4 +UART9_RX_M2 = pin.GPIO4_A5 + +# I2C +I2C2_SCL_M1 = pin.I2C2_SCL_M1 +I2C2_SDA_M1 = pin.I2C2_SDA_M1 +I2C3_SCL_M0 = pin.I2C3_SCL_M0 +I2C3_SDA_M0 = pin.I2C3_SDA_M0 + +# Default I2C +SCL = I2C2_SCL_M1 +SDA = I2C2_SDA_M1 + +# SPI +SPI3_MISO = pin.SPI3_MISO_M0 +SPI3_MOSI = pin.SPI3_MOSI_M0 +SPI3_CLK = pin.SPI3_CLK_M0 +SPI3_CS0 = pin.SPI3_CS0_M0 + +# Default SPI +MOSI = SPI3_MOSI +MISO = SPI3_MISO +SCLK = SPI3_CLK +CS = SPI3_CS0 diff --git a/src/adafruit_blinka/microcontroller/allwinner/h618/__init__.py b/src/adafruit_blinka/microcontroller/allwinner/h618/__init__.py new file mode 100644 index 00000000..bb4a91e0 --- /dev/null +++ b/src/adafruit_blinka/microcontroller/allwinner/h618/__init__.py @@ -0,0 +1,4 @@ +# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries +# +# SPDX-License-Identifier: MIT +"""Definition for the AllWinner H618 chip""" diff --git a/src/adafruit_blinka/microcontroller/allwinner/h618/pin.py b/src/adafruit_blinka/microcontroller/allwinner/h618/pin.py new file mode 100644 index 00000000..1019b598 --- /dev/null +++ b/src/adafruit_blinka/microcontroller/allwinner/h618/pin.py @@ -0,0 +1,163 @@ +# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries +# +# SPDX-License-Identifier: MIT +"""Allwinner H618 Pin Names""" +import re +from adafruit_blinka.microcontroller.generic_linux.libgpiod_pin import Pin + + +def find_gpiochip_number(target_label): + """Get correct gpiochip number, legacy kernel and mainline kernel are different""" + try: + with open("/sys/kernel/debug/gpio", "r") as f: + lines = f.readlines() + except FileNotFoundError: + print("The file /sys/kernel/debug/gpio does not exist.") + return None + + gpiochip_number = None + for line in lines: + if target_label in line: + match = re.search(r"gpiochip(\d+)", line) + if match: + gpiochip_number = match.group(1) + break + + return gpiochip_number + + +if find_gpiochip_number("300b000.pinctrl"): + __chip_num = 1 +else: + __chip_num = 0 + +PC0 = Pin((__chip_num, 64)) +SPI0_SCLK = PC0 +PC1 = Pin((__chip_num, 65)) +PC2 = Pin((__chip_num, 66)) +SPI0_MOSI = PC2 +PC3 = Pin((__chip_num, 67)) +SPI0_CS0 = PC3 +PC4 = Pin((__chip_num, 68)) +SPI0_MISO = PC4 +PC5 = Pin((__chip_num, 69)) +PC6 = Pin((__chip_num, 70)) +PC7 = Pin((__chip_num, 71)) +PC8 = Pin((__chip_num, 72)) +PC9 = Pin((__chip_num, 73)) +PC10 = Pin((__chip_num, 74)) +PC11 = Pin((__chip_num, 75)) +PC12 = Pin((__chip_num, 76)) +PC13 = Pin((__chip_num, 77)) +PC14 = Pin((__chip_num, 78)) +PC15 = Pin((__chip_num, 79)) + +PF0 = Pin((__chip_num, 160)) +PF1 = Pin((__chip_num, 161)) +PF2 = Pin((__chip_num, 162)) +PF3 = Pin((__chip_num, 163)) +PF4 = Pin((__chip_num, 164)) +PF5 = Pin((__chip_num, 165)) +PF6 = Pin((__chip_num, 166)) + +PG0 = Pin((__chip_num, 192)) +PG1 = Pin((__chip_num, 193)) +PG2 = Pin((__chip_num, 194)) +PG3 = Pin((__chip_num, 195)) +PG4 = Pin((__chip_num, 196)) +PG5 = Pin((__chip_num, 197)) +PG6 = Pin((__chip_num, 198)) +UART1_TX = PG6 +PG7 = Pin((__chip_num, 199)) +UART1_RX = PG7 +PG8 = Pin((__chip_num, 200)) +PG9 = Pin((__chip_num, 201)) +PG10 = Pin((__chip_num, 202)) +PG11 = Pin((__chip_num, 203)) +PG12 = Pin((__chip_num, 204)) +PG13 = Pin((__chip_num, 205)) +PG14 = Pin((__chip_num, 206)) +PG15 = Pin((__chip_num, 207)) +TWI4_SCL = PG15 +PG16 = Pin((__chip_num, 208)) +TWI4_SDA = PG16 +PG17 = Pin((__chip_num, 209)) +TWI3_SCL = PG17 +PG18 = Pin((__chip_num, 210)) +TWI3_SDA = PG18 +PG19 = Pin((__chip_num, 211)) +PWM1 = PG19 + +PH0 = Pin((__chip_num, 224)) +PH1 = Pin((__chip_num, 225)) +PH2 = Pin((__chip_num, 226)) +UART5_TX = PH2 +PH3 = Pin((__chip_num, 227)) +UART5_RX = PH3 +PH4 = Pin((__chip_num, 228)) +PH5 = Pin((__chip_num, 229)) +UART2_TX = PH5 +SPI1_CS0 = PH5 +PH6 = Pin((__chip_num, 230)) +UART2_RX = PH6 +SPI1_SCLK = PH6 +PH7 = Pin((__chip_num, 231)) +SPI1_MOSI = PH7 +PH8 = Pin((__chip_num, 232)) +SPI1_MISO = PH8 +PH9 = Pin((__chip_num, 233)) +SPI1_CS1 = PH9 +PH10 = Pin((__chip_num, 234)) + +PI0 = Pin((__chip_num, 256)) +PI1 = Pin((__chip_num, 257)) +PI2 = Pin((__chip_num, 258)) +PI3 = Pin((__chip_num, 259)) +PI4 = Pin((__chip_num, 260)) +PI5 = Pin((__chip_num, 261)) +TWI0_SCL = PI5 +PI6 = Pin((__chip_num, 262)) +TWI0_SDA = PI6 +PI7 = Pin((__chip_num, 263)) +TWI1_SCL = PI7 +PI8 = Pin((__chip_num, 264)) +TWI1_SDA = PI8 +PI9 = Pin((__chip_num, 265)) +UART3_TX = PI9 +PI10 = Pin((__chip_num, 266)) +UART3_RX = PI10 +PI11 = Pin((__chip_num, 267)) +PI12 = Pin((__chip_num, 268)) +PWM2 = PI12 +PI13 = Pin((__chip_num, 269)) +UART4_TX = PI13 +PI14 = Pin((__chip_num, 270)) +UART4_RX = PI14 +PI15 = Pin((__chip_num, 271)) +PI16 = Pin((__chip_num, 272)) + +i2cPorts = ( + (0, TWI0_SCL, TWI0_SDA), + (1, TWI1_SCL, TWI1_SDA), + (3, TWI3_SCL, TWI3_SDA), + (4, TWI4_SCL, TWI4_SDA), +) +# ordered as spiId, sckId, mosiId, misoId +spiPorts = ( + (0, SPI0_SCLK, SPI0_MOSI, SPI0_MISO), + (1, SPI1_SCLK, SPI1_MOSI, SPI1_MISO), +) +# ordered as uartId, txId, rxId +uartPorts = ( + (1, UART1_TX, UART1_RX), + (2, UART2_TX, UART2_RX), + (3, UART3_TX, UART3_RX), + (4, UART4_TX, UART4_RX), + (5, UART5_TX, UART5_RX), +) + +# SysFS pwm outputs, pwm channel and pin in first tuple +pwmOuts = [ + ((0, 1), PWM1), + ((0, 2), PWM2), +] diff --git a/src/adafruit_blinka/microcontroller/rockchip/rk3566/pin.py b/src/adafruit_blinka/microcontroller/rockchip/rk3566/pin.py index 1a8952b8..bfb30138 100644 --- a/src/adafruit_blinka/microcontroller/rockchip/rk3566/pin.py +++ b/src/adafruit_blinka/microcontroller/rockchip/rk3566/pin.py @@ -93,6 +93,15 @@ GPIO3_D3 = Pin((3, 27)) GPIO3_D4 = Pin((3, 28)) GPIO3_D5 = Pin((3, 29)) +GPIO3_D6 = Pin((3, 30)) +GPIO3_D7 = Pin((3, 31)) + +# GPIO4 +GPIO4_A0 = Pin((4, 0)) +GPIO4_A1 = Pin((4, 1)) +GPIO4_A2 = Pin((4, 2)) +GPIO4_A3 = Pin((4, 3)) + GPIO4_A4 = Pin((4, 4)) GPIO4_A5 = Pin((4, 5)) GPIO4_A6 = Pin((4, 6)) @@ -170,6 +179,7 @@ i2cPorts = [ (1, I2C1_SCL, I2C1_SDA), (2, I2C2_SCL_M0, I2C2_SDA_M0), + (2, I2C2_SCL_M1, I2C2_SDA_M1), (3, I2C3_SCL_M0, I2C3_SDA_M0), (4, I2C4_SCL_M0, I2C4_SDA_M0), (5, I2C5_SCL_M0, I2C5_SDA_M0), diff --git a/src/adafruit_blinka/microcontroller/rockchip/rk3588/pin.py b/src/adafruit_blinka/microcontroller/rockchip/rk3588/pin.py index 81c9b162..3abb3b80 100644 --- a/src/adafruit_blinka/microcontroller/rockchip/rk3588/pin.py +++ b/src/adafruit_blinka/microcontroller/rockchip/rk3588/pin.py @@ -241,6 +241,7 @@ (3, I2C3_SCL_M1, I2C3_SDA_M1), (4, I2C4_SCL_M3, I2C4_SDA_M3), (5, I2C5_SCL_M3, I2C5_SDA_M3), + (6, I2C6_SCL_M3, I2C6_SDA_M3), (7, I2C7_SCL_M3, I2C7_SDA_M3), (8, I2C8_SCL_M2, I2C8_SDA_M2), (8, I2C8_SCL_M4, I2C8_SDA_M4), diff --git a/src/adafruit_blinka/microcontroller/spacemit/__init__.py b/src/adafruit_blinka/microcontroller/spacemit/__init__.py new file mode 100644 index 00000000..f0ee20ae --- /dev/null +++ b/src/adafruit_blinka/microcontroller/spacemit/__init__.py @@ -0,0 +1,4 @@ +# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries +# +# SPDX-License-Identifier: MIT +"""Definition of all Spacemit chips""" diff --git a/src/adafruit_blinka/microcontroller/spacemit/k1/__init__.py b/src/adafruit_blinka/microcontroller/spacemit/k1/__init__.py new file mode 100644 index 00000000..79c338c2 --- /dev/null +++ b/src/adafruit_blinka/microcontroller/spacemit/k1/__init__.py @@ -0,0 +1,4 @@ +# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries +# +# SPDX-License-Identifier: MIT +"""Definition for the Spacemit K1 chip""" diff --git a/src/adafruit_blinka/microcontroller/spacemit/k1/pin.py b/src/adafruit_blinka/microcontroller/spacemit/k1/pin.py new file mode 100644 index 00000000..997db4a9 --- /dev/null +++ b/src/adafruit_blinka/microcontroller/spacemit/k1/pin.py @@ -0,0 +1,174 @@ +# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries +# +# SPDX-License-Identifier: MIT +"""Spacemit K1 Pin Names""" +from adafruit_blinka.agnostic import detector +from adafruit_blinka.microcontroller.alias import get_pwm_chipid +from adafruit_blinka.microcontroller.generic_linux.libgpiod_pin import Pin + +__chip_num = 0 + +GPIO_0 = Pin((__chip_num, 0)) +GPIO_1 = Pin((__chip_num, 1)) +GPIO_2 = Pin((__chip_num, 2)) +GPIO_3 = Pin((__chip_num, 3)) +GPIO_4 = Pin((__chip_num, 4)) +GPIO_5 = Pin((__chip_num, 5)) +GPIO_6 = Pin((__chip_num, 6)) +GPIO_7 = Pin((__chip_num, 7)) +GPIO_8 = Pin((__chip_num, 8)) +GPIO_9 = Pin((__chip_num, 9)) +GPIO_10 = Pin((__chip_num, 10)) +GPIO_11 = Pin((__chip_num, 11)) +GPIO_12 = Pin((__chip_num, 12)) +GPIO_13 = Pin((__chip_num, 13)) +GPIO_14 = Pin((__chip_num, 14)) +GPIO_15 = Pin((__chip_num, 15)) +GPIO_16 = Pin((__chip_num, 16)) +GPIO_17 = Pin((__chip_num, 17)) +GPIO_18 = Pin((__chip_num, 18)) +GPIO_19 = Pin((__chip_num, 19)) +GPIO_20 = Pin((__chip_num, 20)) +GPIO_21 = Pin((__chip_num, 21)) +GPIO_22 = Pin((__chip_num, 22)) +GPIO_23 = Pin((__chip_num, 23)) +GPIO_24 = Pin((__chip_num, 24)) +GPIO_25 = Pin((__chip_num, 25)) +GPIO_26 = Pin((__chip_num, 26)) +GPIO_27 = Pin((__chip_num, 27)) +GPIO_28 = Pin((__chip_num, 28)) +GPIO_29 = Pin((__chip_num, 29)) +GPIO_30 = Pin((__chip_num, 30)) +GPIO_31 = Pin((__chip_num, 31)) +GPIO_32 = Pin((__chip_num, 32)) +GPIO_33 = Pin((__chip_num, 33)) +GPIO_34 = Pin((__chip_num, 34)) +GPIO_35 = Pin((__chip_num, 35)) +GPIO_36 = Pin((__chip_num, 36)) +GPIO_37 = Pin((__chip_num, 37)) +GPIO_38 = Pin((__chip_num, 38)) +GPIO_39 = Pin((__chip_num, 39)) +GPIO_40 = Pin((__chip_num, 40)) +GPIO_41 = Pin((__chip_num, 41)) +GPIO_42 = Pin((__chip_num, 42)) +GPIO_43 = Pin((__chip_num, 43)) +GPIO_44 = Pin((__chip_num, 44)) +GPIO_45 = Pin((__chip_num, 45)) +GPIO_46 = Pin((__chip_num, 46)) +GPIO_47 = Pin((__chip_num, 47)) +GPIO_48 = Pin((__chip_num, 48)) +GPIO_49 = Pin((__chip_num, 49)) +GPIO_50 = Pin((__chip_num, 50)) +GPIO_51 = Pin((__chip_num, 51)) +GPIO_52 = Pin((__chip_num, 52)) +GPIO_53 = Pin((__chip_num, 53)) +GPIO_54 = Pin((__chip_num, 54)) +GPIO_55 = Pin((__chip_num, 55)) +GPIO_56 = Pin((__chip_num, 56)) +GPIO_57 = Pin((__chip_num, 57)) +GPIO_58 = Pin((__chip_num, 58)) +GPIO_59 = Pin((__chip_num, 59)) +GPIO_60 = Pin((__chip_num, 60)) +GPIO_61 = Pin((__chip_num, 61)) +GPIO_62 = Pin((__chip_num, 62)) +GPIO_63 = Pin((__chip_num, 63)) +GPIO_64 = Pin((__chip_num, 64)) +GPIO_65 = Pin((__chip_num, 65)) +GPIO_66 = Pin((__chip_num, 66)) +GPIO_67 = Pin((__chip_num, 67)) +GPIO_68 = Pin((__chip_num, 68)) +GPIO_69 = Pin((__chip_num, 69)) +GPIO_70 = Pin((__chip_num, 70)) +GPIO_71 = Pin((__chip_num, 71)) +GPIO_72 = Pin((__chip_num, 72)) +GPIO_73 = Pin((__chip_num, 73)) +GPIO_74 = Pin((__chip_num, 74)) +GPIO_75 = Pin((__chip_num, 75)) +GPIO_76 = Pin((__chip_num, 76)) +GPIO_77 = Pin((__chip_num, 77)) +GPIO_78 = Pin((__chip_num, 78)) +GPIO_79 = Pin((__chip_num, 79)) +GPIO_80 = Pin((__chip_num, 80)) +GPIO_81 = Pin((__chip_num, 81)) +GPIO_82 = Pin((__chip_num, 82)) +GPIO_83 = Pin((__chip_num, 83)) +GPIO_84 = Pin((__chip_num, 84)) +GPIO_85 = Pin((__chip_num, 85)) +GPIO_86 = Pin((__chip_num, 86)) +GPIO_87 = Pin((__chip_num, 87)) +GPIO_88 = Pin((__chip_num, 88)) +GPIO_89 = Pin((__chip_num, 89)) +GPIO_90 = Pin((__chip_num, 90)) +GPIO_91 = Pin((__chip_num, 91)) +GPIO_92 = Pin((__chip_num, 92)) +GPIO_93 = Pin((__chip_num, 93)) +GPIO_94 = Pin((__chip_num, 94)) +GPIO_95 = Pin((__chip_num, 95)) +GPIO_96 = Pin((__chip_num, 96)) +GPIO_97 = Pin((__chip_num, 97)) +GPIO_98 = Pin((__chip_num, 98)) +GPIO_99 = Pin((__chip_num, 99)) +GPIO_100 = Pin((__chip_num, 100)) +GPIO_101 = Pin((__chip_num, 101)) +GPIO_102 = Pin((__chip_num, 102)) +GPIO_103 = Pin((__chip_num, 103)) +GPIO_104 = Pin((__chip_num, 104)) +GPIO_105 = Pin((__chip_num, 105)) +GPIO_106 = Pin((__chip_num, 106)) +GPIO_107 = Pin((__chip_num, 107)) +GPIO_108 = Pin((__chip_num, 108)) +GPIO_109 = Pin((__chip_num, 109)) +GPIO_110 = Pin((__chip_num, 110)) +GPIO_111 = Pin((__chip_num, 111)) +GPIO_112 = Pin((__chip_num, 112)) +GPIO_113 = Pin((__chip_num, 113)) +GPIO_114 = Pin((__chip_num, 114)) +GPIO_115 = Pin((__chip_num, 115)) +GPIO_116 = Pin((__chip_num, 116)) +GPIO_117 = Pin((__chip_num, 117)) +GPIO_118 = Pin((__chip_num, 118)) +GPIO_119 = Pin((__chip_num, 119)) +GPIO_120 = Pin((__chip_num, 120)) +GPIO_121 = Pin((__chip_num, 121)) +GPIO_122 = Pin((__chip_num, 122)) +GPIO_123 = Pin((__chip_num, 123)) +GPIO_124 = Pin((__chip_num, 124)) +GPIO_125 = Pin((__chip_num, 125)) +GPIO_126 = Pin((__chip_num, 126)) +GPIO_127 = Pin((__chip_num, 127)) + +# I2C +I2C4_SCL = GPIO_51 +I2C4_SDA = GPIO_52 + +i2cPorts = ((4, I2C4_SCL, I2C4_SDA),) + +# SPI +SPI3_MISO = GPIO_78 +SPI3_MOSI = GPIO_77 +SPI3_SCLK = GPIO_75 +SPI3_CS0 = GPIO_76 + +# ordered as spiId, sckId, mosiId, misoId +spiPorts = ((3, SPI3_SCLK, SPI3_MOSI, SPI3_MISO),) + +# UART +UART0_TX = GPIO_47 +UART0_RX = GPIO_48 + +# ordered as uartId, txId, rxId +uartPorts = ((0, UART0_TX, UART0_RX),) + +# SysFS pwm outputs, pwm channel and pin in first tuple +pwmOuts = [] + +board = detector.board.id +if board in ("BANANA_PI_F3"): + alias = get_pwm_chipid("d401bc00.pwm") + if alias is not None: + globals()["PWM" + alias] = GPIO_92 + pwmOuts.append(((int(alias[-1]), 0), GPIO_92)) + alias = get_pwm_chipid("d4020400.pwm") + if alias is not None: + globals()["PWM" + alias] = GPIO_74 + pwmOuts.append(((int(alias[-1]), 0), GPIO_74)) diff --git a/src/board.py b/src/board.py index 8105fd41..c0d141e9 100644 --- a/src/board.py +++ b/src/board.py @@ -134,6 +134,9 @@ elif board_id == ap_board.ORANGE_PI_3: from adafruit_blinka.board.orangepi.orangepi3 import * +elif board_id == ap_board.ORANGE_PI_3B: + from adafruit_blinka.board.orangepi.orangepi3b import * + elif board_id == ap_board.ORANGE_PI_4: from adafruit_blinka.board.orangepi.orangepi4 import * @@ -152,9 +155,18 @@ elif board_id == ap_board.BANANA_PI_M2_PLUS: from adafruit_blinka.board.bananapi.bpim2plus import * +elif board_id == ap_board.BANANA_PI_M4_BERRY: + from adafruit_blinka.board.bananapi.bpim4berry import * + +elif board_id == ap_board.BANANA_PI_M4_ZERO: + from adafruit_blinka.board.bananapi.bpim4zero import * + elif board_id == ap_board.BANANA_PI_M5: from adafruit_blinka.board.bananapi.bpim5 import * +elif board_id == ap_board.BANANA_PI_F3: + from adafruit_blinka.board.bananapi.bpif3 import * + elif board_id == ap_board.LEMAKER_BANANA_PRO: from adafruit_blinka.board.lemaker.bananapro import * @@ -425,6 +437,9 @@ elif board_id == ap_board.VIVID_UNIT: from adafruit_blinka.board.vivid_unit import * +elif board_id == ap_board.INDIEDROID_NOVA: + from adafruit_blinka.board.ameridroid.indiedroid_nova import * + elif "sphinx" in sys.modules: pass diff --git a/src/digitalio.py b/src/digitalio.py index 46f23a64..6f04984c 100644 --- a/src/digitalio.py +++ b/src/digitalio.py @@ -111,12 +111,16 @@ from adafruit_blinka.microcontroller.allwinner.h5.pin import Pin elif detector.chip.H6: from adafruit_blinka.microcontroller.allwinner.h6.pin import Pin +elif detector.chip.H618: + from adafruit_blinka.microcontroller.allwinner.h618.pin import Pin elif detector.chip.H616: from adafruit_blinka.microcontroller.allwinner.h616.pin import Pin elif detector.chip.D1_RISCV: from adafruit_blinka.microcontroller.allwinner.D1.pin import Pin elif detector.chip.TH1520: from adafruit_blinka.microcontroller.thead.th1520.pin import Pin +elif detector.chip.K1: + from adafruit_blinka.microcontroller.spacemit.k1.pin import Pin # Special Case Boards elif detector.board.ftdi_ft232h: from adafruit_blinka.microcontroller.ftdi_mpsse.ft232h.pin import Pin diff --git a/src/microcontroller/__init__.py b/src/microcontroller/__init__.py index 036fbc9e..2792e7bd 100644 --- a/src/microcontroller/__init__.py +++ b/src/microcontroller/__init__.py @@ -61,6 +61,8 @@ def delay_us(delay): from adafruit_blinka.microcontroller.allwinner.h5 import * elif chip_id == ap_chip.H6: from adafruit_blinka.microcontroller.allwinner.h6 import * +elif chip_id == ap_chip.H618: + from adafruit_blinka.microcontroller.allwinner.h618 import * elif chip_id == ap_chip.H616: from adafruit_blinka.microcontroller.allwinner.h616 import * elif chip_id == ap_chip.SAMA5: @@ -155,6 +157,8 @@ def delay_us(delay): from adafruit_blinka.microcontroller.rockchip.rv1106 import * elif chip_id == ap_chip.TH1520: from adafruit_blinka.microcontroller.thead.th1520 import * +elif chip_id == ap_chip.K1: + from adafruit_blinka.microcontroller.spacemit.k1 import * elif chip_id == ap_chip.GENERIC_X86: print("WARNING: GENERIC_X86 is not fully supported. Some features may not work.") elif chip_id == ap_chip.OS_AGNOSTIC: diff --git a/src/microcontroller/pin.py b/src/microcontroller/pin.py index 5872271f..3d4a560d 100644 --- a/src/microcontroller/pin.py +++ b/src/microcontroller/pin.py @@ -51,6 +51,8 @@ from adafruit_blinka.microcontroller.allwinner.h5.pin import * elif chip_id == ap_chip.H6: from adafruit_blinka.microcontroller.allwinner.h6.pin import * +elif chip_id == ap_chip.H618: + from adafruit_blinka.microcontroller.allwinner.h618.pin import * elif chip_id == ap_chip.H616: if board_id == ap_boards.REPKA_PI_4_H6: from adafruit_blinka.board.repkapi.repka_pi_4 import * @@ -145,6 +147,8 @@ from adafruit_blinka.microcontroller.cv1800b.pin import * elif chip_id == ap_chip.TH1520: from adafruit_blinka.microcontroller.thead.th1520.pin import * +elif chip_id == ap_chip.K1: + from adafruit_blinka.microcontroller.spacemit.k1.pin import * elif chip_id == ap_chip.RV1103: from adafruit_blinka.microcontroller.rockchip.rv1103.pin import * elif chip_id == ap_chip.RV1106: diff --git a/src/pwmio.py b/src/pwmio.py index 6935ac1a..72ce0d89 100644 --- a/src/pwmio.py +++ b/src/pwmio.py @@ -18,6 +18,8 @@ if detector.board.any_raspberry_pi: from adafruit_blinka.microcontroller.bcm283x.pwmio.PWMOut import PWMOut +elif detector.board.any_bananapi: + from adafruit_blinka.microcontroller.generic_linux.sysfs_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: