Skip to content

Commit

Permalink
Adding OrangePi Zero2 pin mappings (#64)
Browse files Browse the repository at this point in the history
* Add pin mappings for Orange Pi Zero2

# Test code
for pin in BOARD.keys():
    print(f'Testing pin {pin}.')
    GPIO.output(pin, GPIO.HIGH)
    input("Continue.")
    GPIO.output(pin, GPIO.LOW)

* Version upgrade 0.5.2 -> 0.5.3

* Change log entry
  • Loading branch information
sillo01 authored Jun 21, 2022
1 parent 0c0d6fe commit c373a44
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ ChangeLog
+------------+---------------------------------------------------------------------+------------+
| Version | Description | Date |
+============+=====================================================================+============+
| **0.5.3** | * Added OrangePi Zero2 pin mappings | 2021/10/22 |
+------------+---------------------------------------------------------------------+------------+
| **0.5.2** | * Add full 40-pin header for Orange Pi 4(B) | 2021/10/22 |
+------------+---------------------------------------------------------------------+------------+
| **0.5.1** | * Updated orange pi 4B mappings | 2021/08/19 |
Expand Down
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.2
0.5.3
40 changes: 40 additions & 0 deletions orangepi/zero2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2022 sillo01
# See LICENSE.md for details.

"""
Alternative pin mappings for Orange PI Zero2
(see https://linux-sunxi.org/File:Orange_Pi_Zero2_H616_Schematic_v1.3.pdf)
Usage:
.. code:: python
import orangepi.zero2
from OPi import GPIO
GPIO.setmode(orangepi.zero2.BOARD)
"""

# pin number = (position of letter in alphabet - 1) * 32 + pin number
# So, PD14 will be (4 - 1) * 32 + 14 = 110

# Orange Pi Zero 2 physical board pin to GPIO pin
BOARD = {
3: 229, # PH5/I2C3_SDA
5: 228, # PH4/I2C3_SCK
7: 73, # PC9
8: 226, # PH2/UART5_TX
10: 227, # PH3/UART5_RX
11: 70, # PC6
12: 75, # PC11
13: 69, # PC5
15: 72, # PC8
16: 79, # PC15
18: 78, # PC14
19: 231, # PH7,SPI1_MOSI
21: 232, # PH8,SPI1_MISO
22: 71, # PC7
23: 230, # PH6,SPI1_CLK
24: 233, # PH9,SPI1_CS
26: 74, # PC10
}

# BCM mapping not identified yet, keeping it for compatibility
BCM = BOARD

0 comments on commit c373a44

Please sign in to comment.