Skip to content

Commit

Permalink
Merge pull request #894 from landall/main
Browse files Browse the repository at this point in the history
add support for orangepi 3b
  • Loading branch information
FoamyGuy authored Oct 24, 2024
2 parents 9441d12 + 38fa646 commit b91d3fc
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 0 deletions.
84 changes: 84 additions & 0 deletions src/adafruit_blinka/board/orangepi/orangepi3b.py
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions src/adafruit_blinka/microcontroller/rockchip/rk3566/pin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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),
Expand Down
3 changes: 3 additions & 0 deletions src/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 *

Expand Down

0 comments on commit b91d3fc

Please sign in to comment.