From: Melissa LeBlanc-Williams Date: Mon, 12 Sep 2022 18:37:56 +0000 (-0700) Subject: Merge pull request #613 from alsprogrammer/main X-Git-Tag: 8.4.0 X-Git-Url: https://git.ayoreis.com/Adafruit_Blinka-hackapet.git/commitdiff_plain/62839356738befffaacd88001e52553051df8bc2?hp=d7fae4ffed01e353eb5945eba56c78de96085a08 Merge pull request #613 from alsprogrammer/main Add Lichee RV (plus Dock) support --- diff --git a/src/adafruit_blinka/board/lichee_rv.py b/src/adafruit_blinka/board/lichee_rv.py new file mode 100644 index 0000000..c3a57b7 --- /dev/null +++ b/src/adafruit_blinka/board/lichee_rv.py @@ -0,0 +1,48 @@ +# SPDX-FileCopyrightText: 2022 Aleksandr Saiapin for Adafruit Industries +# +# SPDX-License-Identifier: MIT +"""Pin definitions for the Lichee RV Dock.""" + +from adafruit_blinka.microcontroller.allwinner.D1 import pin + +D3 = pin.PB1 +D5 = pin.PB0 +D7 = pin.PG14 +D8 = pin.PB8 +D9 = pin.PD14 +D10 = pin.PB9 +D11 = pin.PG13 +D12 = pin.PG15 +D13 = pin.PD17 +D15 = pin.PD15 +D16 = pin.PD16 +D17 = pin.PD13 +D18 = pin.PD22 +D19 = pin.PD12 +D21 = pin.PD10 +D22 = pin.PD11 +D23 = pin.PD19 +D24 = pin.PD21 +D25 = pin.PD18 +D26 = pin.PD20 +D27 = pin.PD8 +D28 = pin.PD9 +D29 = pin.PD6 +D30 = pin.PD7 +D31 = pin.PD4 +D32 = pin.PD5 +D33 = pin.PD2 +D34 = pin.PD3 +D35 = pin.PD0 +D36 = pin.PD1 +D37 = pin.PE15 +D38 = pin.PE12 +D40 = pin.PE16 + +SDA2 = D3 +SCL2 = D5 +SDA = SDA2 +SCL = SCL2 + +UART0_TX = D8 +UART0_RX = D10 diff --git a/src/adafruit_blinka/microcontroller/allwinner/D1/__init__.py b/src/adafruit_blinka/microcontroller/allwinner/D1/__init__.py new file mode 100644 index 0000000..78ab2b7 --- /dev/null +++ b/src/adafruit_blinka/microcontroller/allwinner/D1/__init__.py @@ -0,0 +1,4 @@ +# SPDX-FileCopyrightText: 2022 Aleksandr Saiapin for Adafruit Industries +# +# SPDX-License-Identifier: MIT +"""Definition for the AllWinner D1 chip""" diff --git a/src/adafruit_blinka/microcontroller/allwinner/D1/pin.py b/src/adafruit_blinka/microcontroller/allwinner/D1/pin.py new file mode 100644 index 0000000..f545ca6 --- /dev/null +++ b/src/adafruit_blinka/microcontroller/allwinner/D1/pin.py @@ -0,0 +1,112 @@ +# SPDX-FileCopyrightText: 2022 Aleksandr Saiapin for Adafruit Industries +# +# SPDX-License-Identifier: MIT +"""Allwinner D1 pin names""" +from adafruit_blinka.microcontroller.generic_linux.libgpiod_pin import Pin + +PB0 = Pin(32) +TWI2_SCL = PB0 +PB1 = Pin(33) +TWI2_SDA = PB1 +PB2 = Pin(34) +PB3 = Pin(35) +PB4 = Pin(36) +PB5 = Pin(37) +PB6 = Pin(38) +PB7 = Pin(39) +PB8 = Pin(40) +UART0_TX = PB8 +PB9 = Pin(41) +UART0_RX = PB9 +PB10 = Pin(42) +PB11 = Pin(43) +PB12 = Pin(44) +PC0 = Pin(64) +UART2_TX = PC0 +PC1 = Pin(65) +UART2_RX = PC1 +PC2 = Pin(66) +SPI0_SCLK = PC2 +PC3 = Pin(67) +SPI0_CS = PC3 +PC4 = Pin(68) +SPI0_MOSI = PC4 +PC5 = Pin(69) +SPI0_MISO = PC5 +PC6 = Pin(70) +SPI0_WP = PC6 +PC7 = Pin(71) +SPI0_HOLD = PC7 +PD0 = Pin(96) +PD1 = Pin(97) +PD2 = Pin(98) +PD3 = Pin(99) +PD4 = Pin(100) +PD5 = Pin(101) +PD6 = Pin(102) +PD7 = Pin(103) +PD8 = Pin(104) +PD9 = Pin(105) +PD10 = Pin(106) +PD11 = Pin(107) +PD12 = Pin(108) +PD13 = Pin(109) +PD14 = Pin(110) +PD15 = Pin(111) +PD16 = Pin(112) +PD17 = Pin(113) +PD18 = Pin(114) +PD19 = Pin(115) +PD20 = Pin(116) +PD21 = Pin(117) +PD22 = Pin(118) +PE0 = Pin(128) +PE1 = Pin(129) +PE2 = Pin(130) +PE3 = Pin(131) +PE4 = Pin(132) +PE5 = Pin(133) +PE6 = Pin(134) +PE7 = Pin(135) +PE8 = Pin(136) +PE9 = Pin(137) +PE10 = Pin(138) +PE11 = Pin(139) +PE12 = Pin(140) +PE13 = Pin(141) +PE14 = Pin(142) +TWI1_SCL = PE14 +PE15 = Pin(143) +TWI1_SDA = PE15 +PE16 = Pin(144) +TWI3_SCL = PE16 +PE17 = Pin(145) +TWI3_SDA = PE17 +PG6 = Pin(198) +UART1_TX = PG6 +PG7 = Pin(199) +UART1_RX = PG7 +PG8 = Pin(200) +UART1_RTS = PG8 +PG9 = Pin(201) +UART1_CTS = PG9 +PG10 = Pin(202) +PG11 = Pin(203) +PG12 = Pin(204) +PG13 = Pin(205) +PG14 = Pin(206) +PG15 = Pin(207) +PG16 = Pin(208) +PG17 = Pin(209) +PG18 = Pin(210) + +i2cPorts = ( + (2, TWI2_SCL, TWI2_SDA), + (3, TWI3_SCL, TWI3_SDA), +) +uartPorts = ( + (0, UART0_TX, UART0_RX), + (1, UART1_TX, UART1_RX), + (2, UART2_TX, UART2_RX), +) +spiPorts = ((0, SPI0_SCLK, SPI0_MOSI, SPI0_MISO),) diff --git a/src/board.py b/src/board.py index bc81d7c..f50fe03 100644 --- a/src/board.py +++ b/src/board.py @@ -274,6 +274,9 @@ elif board_id == ap_board.MACROPAD_U2IF: elif board_id == ap_board.QT2040_TRINKEY_U2IF: from adafruit_blinka.board.qt2040_trinkey_u2if import * +elif board_id == ap_board.LICHEE_RV: + from adafruit_blinka.board.lichee_rv import * + elif "sphinx" in sys.modules: pass diff --git a/src/digitalio.py b/src/digitalio.py index 84471a7..0969f35 100644 --- a/src/digitalio.py +++ b/src/digitalio.py @@ -96,6 +96,8 @@ elif detector.chip.H616: from adafruit_blinka.microcontroller.allwinner.h616.pin import Pin elif detector.board.pico_u2if: from adafruit_blinka.microcontroller.rp2040_u2if.pin import Pin +elif detector.board.LICHEE_RV: + from adafruit_blinka.microcontroller.allwinner.D1.pin import Pin elif ( detector.board.feather_u2if or detector.board.qtpy_u2if diff --git a/src/microcontroller/__init__.py b/src/microcontroller/__init__.py index 8739826..9bd7d09 100644 --- a/src/microcontroller/__init__.py +++ b/src/microcontroller/__init__.py @@ -120,6 +120,8 @@ elif chip_id == ap_chip.MT8167: from adafruit_blinka.microcontroller.mt8167 import * elif chip_id == ap_chip.RP2040_U2IF: from adafruit_blinka.microcontroller.rp2040_u2if import * +elif chip_id == ap_chip.D1_RISCV: + from adafruit_blinka.microcontroller.allwinner.D1 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: diff --git a/src/microcontroller/pin.py b/src/microcontroller/pin.py index 031c5c2..196aa03 100644 --- a/src/microcontroller/pin.py +++ b/src/microcontroller/pin.py @@ -103,6 +103,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.D1_RISCV: + from adafruit_blinka.microcontroller.allwinner.D1.pin import * elif "sphinx" in sys.modules: # pylint: disable=unused-import from adafruit_blinka.microcontroller.generic_micropython import Pin