]> Repositories - Adafruit_Blinka-hackapet.git/commitdiff
Update in line with latest Adafruit_Blinka repo
authorRyan L <ryestar101@gmail.com>
Sat, 2 Sep 2023 18:50:55 +0000 (19:50 +0100)
committerRyan L <ryestar101@gmail.com>
Sat, 2 Sep 2023 18:50:55 +0000 (19:50 +0100)
src/adafruit_blinka/board/lemaker/__init__.py [new file with mode: 0644]
src/adafruit_blinka/board/lemaker/bananapro.py [new file with mode: 0644]
src/adafruit_blinka/microcontroller/allwinner/a20/__init__.py
src/adafruit_blinka/microcontroller/allwinner/a20/pin.py
src/board.py
src/digitalio.py
src/microcontroller/__init__.py
src/microcontroller/pin.py
src/pwmio.py

diff --git a/src/adafruit_blinka/board/lemaker/__init__.py b/src/adafruit_blinka/board/lemaker/__init__.py
new file mode 100644 (file)
index 0000000..6fd4e4a
--- /dev/null
@@ -0,0 +1,4 @@
+# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
+#
+# SPDX-License-Identifier: MIT
+"""Boards definition from LeMaker"""
diff --git a/src/adafruit_blinka/board/lemaker/bananapro.py b/src/adafruit_blinka/board/lemaker/bananapro.py
new file mode 100644 (file)
index 0000000..70bf88e
--- /dev/null
@@ -0,0 +1,168 @@
+# SPDX-FileCopyrightText: 2023 Xenokrates
+#
+# SPDX-License-Identifier: MIT
+"""Pin definitions for the LeMaker Banana Pro."""
+
+# The LeMaker Banana Pro uses the AllWinner A20 SoC
+from adafruit_blinka.microcontroller.allwinner.a20 import pin
+
+
+# Pinout reference
+# https://linux-sunxi.org/LeMaker_Banana_Pro#Expansion_Port
+
+# +---------------------+Banana Pro+-----------------+
+# |        Name         | Physical |       Name      |
+# +---------------------+----++----+-----------------+
+# |                3.3v |  1 || 2  | 5v              |
+# |   PB21/TWI2_SDA/SDA |  3 || 4  | 5V              |
+# |   PB20/TWI2_SCL/SCL |  5 || 6  | 0v              |
+# |                 PH2 |  7 || 8  | PH4/UART4_TX/TX |
+# |                  0v |  9 || 10 | PH5/UART4/RX    |
+# |       PI19/UART2_RX | 11 || 12 | PI3/PWM1        |
+# |       PI18/UART2_TX | 13 || 14 | 0v              |
+# |                PI17 | 15 || 16 | PH20            |
+# |                3.3v | 17 || 18 | PH21            |
+# | PI12/SPI0_MOSI/MOSI | 19 || 20 | 0v              |
+# | PI13/SPI0_MISO/SCLK | 21 || 22 | PI16            |
+# |       PI11/SPI0_CLK | 23 || 24 | PI10/SPI0_CS0   |
+# |                  0v | 25 || 26 | PI14/SPI0_CS1   |
+# |         PI1/TW3_SDA | 27 || 28 | PI0/TWI3_SCL    |
+# |                 PB3 | 29 || 30 | 0v              |
+# |       PI21/UART7_RX | 31 || 32 | PI20/UART7_TX   |
+# |                PB13 | 33 || 34 | 0v              |
+# |                 PB7 | 35 || 36 | PB06            |
+# |                 PB5 | 37 || 38 | PB12            |
+# |                  0v | 39 || 40 | PB08            |
+# +---------------------+----++----+-----------------+
+# |        Name         | Physical |      Name       |
+# +---------------------+Banana Pro+-----------------+
+
+# 40 pin header (CON6) - Using physical pin numbering and CPU PIOs
+
+P3 = pin.PB21
+PB21 = pin.PB21
+TWI2_SDA = pin.PB21
+P5 = pin.PB20
+PB20 = pin.PB20
+TWI2_SCL = pin.PB20
+P7 = pin.PH2
+UART_TX = pin.PB22
+PB22 = pin.PB22
+UART_RX = pin.PB23
+PB23 = pin.PB23
+PH2 = pin.PH2
+PH21 = pin.PH21
+PH21 = pin.PH21
+P8 = pin.PH4
+PH4 = pin.PH4
+UART4_RX = pin.PH4
+P10 = pin.PH5
+PH5 = pin.PH5
+UART4_TX = pin.PH5
+P11 = pin.PI19
+PI19 = pin.PI19
+UART2_RX = pin.PI19
+P12 = pin.PI3
+PWM1 = pin.PI3
+PI3 = pin.PI3
+P13 = pin.PI18
+UART2_TX = pin.PI18
+PI18 = pin.PI18
+P15 = pin.PI17
+PI17 = pin.PI17
+P16 = pin.PH20
+PH20 = pin.PH20
+P18 = pin.PH21
+PH21 = pin.PH21
+P19 = pin.PI12
+PI12 = pin.PI12
+SPI0_MOSI = pin.PI12
+P21 = pin.PI11
+PI11 = pin.PI11
+SPI0_CLK = pin.PI11
+P22 = pin.PI16
+PI16 = pin.PI16
+P23 = pin.PI13
+PI13 = pin.PI13
+SPI0_MISO = pin.PI13
+P24 = pin.PI10
+PI10 = pin.PI10
+SPI0_CS0 = pin.PI10
+P26 = pin.PI14
+PI14 = pin.PI14
+SPI0_CS1 = pin.PI14
+P27 = pin.PI1
+PI1 = pin.PI1
+TWI3_SDA = pin.PI1
+P28 = pin.PI0
+PI0 = pin.PI0
+TWI3_SCL = pin.PI0
+P29 = pin.PB3
+PB3 = pin.PB3
+P31 = pin.PI21
+PI21 = pin.PI21
+UART7_RX = pin.PI21
+P32 = pin.PI20
+PI20 = pin.PI20
+UART7_TX = pin.PI20
+P33 = pin.PB13
+PB13 = pin.PB13
+P35 = pin.PB7
+PB7 = pin.PB7
+P36 = pin.PB6
+PB6 = pin.PB6
+P37 = pin.PB5
+PB5 = pin.PB5
+P38 = pin.PB12
+PB12 = pin.PB12
+P40 = pin.PB8
+PB8 = pin.PB8
+
+## Additional Hardware
+
+LED1 = pin.PH24
+LED_GREEN = pin.PH24
+LED2 = pin.PG2
+LED_BLUE = pin.PG2
+
+## For compatibility of 40-pin header to RasPi & others
+## With these definitions most examples run out of the box.
+
+D0 = pin.PI1
+D1 = pin.PI0
+D2 = pin.PB21
+D3 = pin.PB20
+D4 = pin.PH2
+D5 = pin.PB3
+D6 = pin.PI21
+D7 = pin.PI14
+D8 = pin.PI10
+D9 = pin.PI13
+D10 = pin.PI12
+D11 = pin.PI11
+D12 = pin.PI20
+D13 = pin.PB13
+D14 = pin.PH4
+D15 = pin.PH5
+D16 = pin.PB6
+D17 = pin.PI19
+D18 = pin.PI3
+D19 = pin.PB7
+D20 = pin.PB12
+D21 = pin.PB8
+D22 = pin.PI17
+D23 = pin.PH20
+D24 = pin.PH21
+D25 = pin.PI16
+D26 = pin.PB5
+D27 = pin.PI18
+
+RX = pin.PH4
+TX = pin.PH5
+
+SDA = pin.PB21
+SCL = pin.PB20
+
+SCLK = pin.PI11
+MOSI = pin.PI12
+MISO = pin.PI13
index 1d34a42e652e8eb58ec8b04576e62c9621fd6e2b..edd8fad9d54973e89fa82cecc12d6c20fee7d9c3 100644 (file)
@@ -1 +1,4 @@
+# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
+#
+# SPDX-License-Identifier: MIT
 """Definition for the AllWinner A20 chip"""
index a9041dd51859c24fe4b91393f624e34c1e6a21d4..3e4bf44c1a8b012c758aba0b1c66f3ddd5565372 100644 (file)
+# SPDX-FileCopyrightText: 2023 Xenokrates
+#
+# SPDX-License-Identifier: MIT
 """Allwinner A20 pin names"""
 from adafruit_blinka.microcontroller.generic_linux.libgpiod_pin import Pin
 
-PB2 = Pin(34)  # PB2/PWM0
-PWM0 = PB2
-PB20 = Pin(52)  # PB20/TWI2_SDL
-TWI2_SCL = PB20
-PB21 = Pin(53)  # PB20/TWI2_SDA
+# Pin descriptions at https://linux-sunxi.org/A20/PIO
+
+PA0 = Pin(0)
+PA1 = Pin(1)
+PA2 = Pin(2)
+UART2_TX = PA2
+PA3 = Pin(3)
+UART2_RX = PA3
+PA6 = Pin(6)
+PA7 = Pin(7)
+PA8 = Pin(8)
+PA9 = Pin(9)
+PA10 = Pin(10)
+UART1_TX = PA10
+PA11 = Pin(11)
+UART1_RX = PA11
+PA12 = Pin(12)
+PA13 = Pin(13)
+PA14 = Pin(14)
+PA15 = Pin(15)
+PA16 = Pin(16)
+PA17 = Pin(17)
+
+PB0 = Pin(32)
+TWI0_SCK = PB0
+PB1 = Pin(33)
+TWI0_SDA = PB1
+PB2 = Pin(34)
+PB3 = Pin(35)
+IR0_TX = PB3
+PB4 = Pin(36)
+IR0_RX = PB4
+PB5 = Pin(37)
+PB6 = Pin(38)
+PB7 = Pin(39)
+PB8 = Pin(40)
+PB12 = Pin(44)
+PB13 = Pin(45)
+PB18 = Pin(50)
+TWI1_SCK = PB18
+PB19 = Pin(51)
+TWI1_SDA = PB19
+PB20 = Pin(52)
+TWI2_SCK = PB20
+PB21 = Pin(53)
 TWI2_SDA = PB21
+PB22 = Pin(54)
+UART0_TX = PB22
+PB23 = Pin(55)
+UART0_RX = PB23
 
-PC19 = Pin(83)  # PC19/SPI2_CS
-SPI2_CS = PC19
-PC20 = Pin(84)  # PC20/SPI2_SCLK
-SPI2_SCLK = PC20
-PC21 = Pin(85)  # PC21/SPI2_MOSI
-SPI2_MOSI = PC21
-PC22 = Pin(86)  # PC22/SPI2_MISO
-SPI2_MISO = PC22
+PG2 = Pin(194)
 
+PH2 = Pin(226)
+PH4 = Pin(228)
+UART4_TX = PH4
 PH5 = Pin(229)
-PH6 = Pin(230)  # PH6/UART5_TX
-UART5_TX = PH6
-PH7 = Pin(231)  # PH7/UART5_RX
-UART5_RX = PH7
-PH8 = Pin(232)
-PH9 = Pin(233)
-PH10 = Pin(234)
-PH11 = Pin(235)
-PH12 = Pin(236)
-PH13 = Pin(237)
-PH14 = Pin(238)
-PH15 = Pin(239)
-PH16 = Pin(240)
-PH17 = Pin(241)
-PH18 = Pin(242)
-PH19 = Pin(243)
+UART4_RX = PH5
+PH20 = Pin(244)
+CAN_TX = PH20
+PH21 = Pin(245)
+CAN_RX = PH21
+PH24 = Pin(248)
 
-PI3 = Pin(259)  # PI3/PWM1
+PI0 = Pin(256)
+TWI3_SCK = PI0
+PI1 = Pin(257)
+TWI3_SDA = PI1
+PI3 = Pin(259)
 PWM1 = PI3
-PI10 = Pin(266)  # PI10/SPI0_CS/UART5_TX
-SPI0_CS = PI10
-PI11 = Pin(267)  # PI11/SPI0_SCLK/UART5_RX
+PI10 = Pin(266)
+SPI0_CS0 = PI10
+PI11 = Pin(267)
 SPI0_SCLK = PI11
 PI12 = Pin(268)
 SPI0_MOSI = PI12
-UART6_TX = PI12
 PI13 = Pin(269)
 SPI0_MISO = PI13
-UART6_RX = PI13
-PI18 = Pin(274)  # PI18/UART2_TX
+PI14 = Pin(270)
+SPI0_CS1 = PI14
+PI16 = Pin(272)
+UART2_RTS = PI16
+PI17 = Pin(273)
+UART2_CTS = PI17
+PI18 = Pin(274)
 UART2_TX = PI18
-PI19 = Pin(275)  # PI19/UART2_RX
+PI19 = Pin(275)
 UART2_RX = PI19
+PI20 = Pin(276)
+UART7_TX = PI20
+PI21 = Pin(277)
+UART7_RX = PI21
 
-XP_TP = 1  # Allwinner touch panel controller which can be configured to operate
-XN_TP = 2  # as four seperate adc chanels, providing 12-bit resolution.
-YP_TP = 3
-YN_TP = 4
-
-# Ordered as i2cId, SCL, SDA
-i2cPorts = ((2, TWI2_SCL, TWI2_SDA),)
-
-# Ordered as spiId, clkId, mosiId, misoId
-spiPorts = (
-    (0, SPI0_SCLK, SPI0_MOSI, SPI0_MISO),
-    (2, SPI2_SCLK, SPI2_MOSI, SPI2_MISO),
+# SysFS pwm outputs, pwm channel and pin in first tuple
+pwmOuts = (((0, 1), PWM1),)
+# ordered as i2cId, sclId, sdaId
+i2cPorts = (
+    (0, TWI0_SCK, TWI0_SDA),
+    (1, TWI1_SCK, TWI1_SDA),
+    (2, TWI2_SCK, TWI2_SDA),
 )
-
+# ordered as spiId, sckId, mosiId, misoId
+spiPorts = ((0, SPI0_SCLK, SPI0_MOSI, SPI0_MISO),)
 # ordered as uartId, txId, rxId
 uartPorts = (
+    (0, UART0_TX, UART0_RX),
     (2, UART2_TX, UART2_RX),
-    (5, UART5_TX, UART5_RX),
-    (6, UART6_TX, UART6_RX),
-)
-# sysFs pwm outputs, pwm channel and pin first tuple
-pwmOuts = (
-    ((0, 0), PWM0),
-    ((0, 1), PWM1),
-)
-
-# sysFs analog inputs, Ordered as analogInId, device, and channel
-analogIns = (
-    (XP_TP, 0, 0),
-    (XN_TP, 0, 1),
-    (YP_TP, 0, 2),
-    (YN_TP, 0, 3),
+    (4, UART4_TX, UART4_RX),
+    (7, UART7_TX, UART7_RX),
 )
index 9b80fb0a6581f17d582f2419f521e13c6e820a5b..cfaad6cecab5bf664aa0b979cbbc5885be69f77d 100644 (file)
@@ -142,6 +142,9 @@ elif board_id == ap_board.BANANA_PI_M2_PLUS:
 elif board_id == ap_board.BANANA_PI_M5:
     from adafruit_blinka.board.bananapi.bpim5 import *
 
+elif board_id == ap_board.LEMAKER_BANANA_PRO:
+    from adafruit_blinka.board.lemaker.bananapro import *
+
 elif board_id == ap_board.GIANT_BOARD:
     from adafruit_blinka.board.giantboard import *
 
index e7fe0475f51fd7ae8154a7a6b2ff1b2865df5ab5..2c0b5f3e1dea2001893228db7b6dda09e3f73167 100644 (file)
@@ -71,6 +71,8 @@ elif detector.chip.A64:
     from adafruit_blinka.microcontroller.allwinner.a64.pin import Pin
 elif detector.chip.A33:
     from adafruit_blinka.microcontroller.allwinner.a33.pin import Pin
+elif detector.chip.A20:
+    from adafruit_blinka.microcontroller.allwinner.a20.pin import Pin
 elif detector.chip.MIPS24KEC:
     from adafruit_blinka.microcontroller.mips24kec.pin import Pin
 elif detector.chip.RK3308:
index d04d2ee15c28d4de535b2da61acd7537cd6a1113..e8d85cd456d768355643bc9f77ef7fabeecddd51 100644 (file)
@@ -94,6 +94,8 @@ elif chip_id == ap_chip.A64:
     from adafruit_blinka.microcontroller.allwinner.a64 import *
 elif chip_id == ap_chip.A33:
     from adafruit_blinka.microcontroller.allwinner.a33 import *
+elif chip_id == ap_chip.A20:
+    from adafruit_blinka.microcontroller.allwinner.a20 import *
 elif chip_id == ap_chip.RK3308:
     from adafruit_blinka.microcontroller.rockchip.rk3308 import *
 elif chip_id == ap_chip.RK3399:
index fdd77ddef20d159f3baa6862a2c00affbf6d0282..abb665da199b36aad3d4b1bf40d361de90bf3249 100644 (file)
@@ -97,6 +97,8 @@ elif chip_id == ap_chip.A64:
     from adafruit_blinka.microcontroller.allwinner.a64.pin import *
 elif chip_id == ap_chip.A33:
     from adafruit_blinka.microcontroller.allwinner.a33.pin import *
+elif chip_id == ap_chip.A20:
+    from adafruit_blinka.microcontroller.allwinner.a20.pin import *
 elif chip_id == ap_chip.RK3308:
     from adafruit_blinka.microcontroller.rockchip.rk3308.pin import *
 elif chip_id == ap_chip.RK3399:
index b4819daf07365108902b04dd8f7bb62a25e5ecfb..9ded9fd43faa956a746ae395037b8f6648d0a443 100644 (file)
@@ -26,6 +26,8 @@ elif detector.board.any_pcduino_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_lemaker:
+    from adafruit_blinka.microcontroller.generic_linux.sysfs_pwmout import PWMOut
 elif detector.board.any_siemens_simatic_iot2000:
     from adafruit_blinka.microcontroller.am65xx.pwmout import PWMOut
 elif detector.board.any_rock_pi_board: