]> Repositories - Adafruit_Blinka-hackapet.git/commitdiff
Add board & microcontroller.
authorXenokrates <Xenokrates@users.noreply.github.com>
Thu, 27 Jul 2023 15:42:52 +0000 (17:42 +0200)
committerXenokrates <Xenokrates@users.noreply.github.com>
Thu, 27 Jul 2023 15:42:52 +0000 (17:42 +0200)
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 [new file with mode: 0644]
src/adafruit_blinka/microcontroller/allwinner/a20/pin.py [new file with mode: 0644]

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..8e33372
--- /dev/null
@@ -0,0 +1,144 @@
+# 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
+P5 = pin.PB20
+PB20 = pin.PB20
+P7 = pin.PH2
+PH2 = pin.PH2
+PH21 = pin.PH21
+PH21 = pin.PH21
+P8 = pin.PH4
+PH4 = pin.PH4
+P10 = pin.PH5
+PH5 = pin.PH5
+P11 = pin.PI19
+PI19 = pin.PI19
+P12 = pin.PI3
+PI3 = pin.PI3
+P13 = 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
+P21 = pin.PI11
+PI11 = pin.PI11
+P22 = pin.PI16
+PI16 = pin.PI16
+P23 = pin.PI13
+PI13 = pin.PI13
+P24 = pin.PI10
+PI10 = pin.PI10
+P26 = pin.PI14
+PI14 = pin.PI14
+P27 = pin.PI1
+PI1 = pin.PI1
+P28 = pin.PI0
+PI0 = pin.PI0
+P29 = pin.PB3
+PB3 = pin.PB3
+P31 = pin.PI21
+PI21 = pin.PI21
+P32 = pin.PI20
+PI20 = 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
+
+
+UART_TX = pin.PB22
+UART_RX = pin.PB23
+
+UART2_RX = P11
+UART2_TX = P13
+
+UART4_RX = P10
+UART4_TX = P8
+
+UART7_RX = P31
+UART7_TX = P32
+
+TWI3_SDA = P27
+TWI3_SCL = P28
+
+TWI2_SDA = P3
+TWI2_SCL = P5
+
+SPI0_CLK = P23
+SPI0_MOSI = P19
+SPI0_MISO = P21
+SPI0_CS0 = P24
+SPI0_CS1 = P26
+
+## For compatibility to RasPi & others
+
+RX = UART4_RX
+TX = UART4_TX
+
+SDA = TWI2_SDA
+SCL = TWI2_SCL
+
+SCLK = SPI0_CLK
+MOSI = SPI0_MOSI
+MISO = SPI0_MISO
+
+## Additional Hardware
+
+PWM1 = P12
+LED1 = pin.PH24
+LED_GREEN = LED1
+LED2 = pin.PG2
+LED_BLUE = LED2
diff --git a/src/adafruit_blinka/microcontroller/allwinner/a20/__init__.py b/src/adafruit_blinka/microcontroller/allwinner/a20/__init__.py
new file mode 100644 (file)
index 0000000..edd8fad
--- /dev/null
@@ -0,0 +1,4 @@
+# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
+#
+# SPDX-License-Identifier: MIT
+"""Definition for the AllWinner A20 chip"""
diff --git a/src/adafruit_blinka/microcontroller/allwinner/a20/pin.py b/src/adafruit_blinka/microcontroller/allwinner/a20/pin.py
new file mode 100644 (file)
index 0000000..8bd4230
--- /dev/null
@@ -0,0 +1,117 @@
+# SPDX-FileCopyrightText: 2023 Xenokrates
+#
+# SPDX-License-Identifier: MIT
+"""Allwinner A20 pin names"""
+from adafruit_blinka.microcontroller.generic_linux.libgpiod_pin import Pin
+
+# 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)
+PWM0 = PB2
+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
+
+PG2 = Pin(194)
+
+PH2 = Pin(226)
+PH4 = Pin(228)
+UART4_TX = PH4
+PH5 = Pin(229)
+UART4_RX = PH5
+PH20 = Pin(244)
+CAN_TX = PH20
+PH21 = Pin(245)
+CAN_RX = PH21
+PH24 = Pin(248)
+
+PI0 = Pin(256)
+TWI3_SCK = PI0
+PI1 = Pin(257)
+TWI3_SDA = PI1
+PI3 = Pin(259)
+PI10 = Pin(266)
+SPI0_CS0 = PI10
+PI11 = Pin(267)
+SPI0_CLK = PI11
+PI12 = Pin(268)
+SPI0_MOSI = PI12
+PI13 = Pin(269)
+SPI0_MISO = PI13
+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)
+UART2_RX = PI19
+PI20 = Pin(276)
+UART7_TX = PI20
+PI21 = Pin(277)
+UART7_RX = PI21
+
+
+# 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_CLK, SPI0_MOSI, SPI0_MISO),
+)
+# ordered as uartId, txId, rxId
+uartPorts = (
+    (0, UART0_TX, UART0_RX),
+    (2, UART2_TX, UART2_RX),
+    (4, UART4_TX, UART4_RX),
+    (7, UART7_TX, UART7_RX),
+)