Drop-in replacement for RPi.GPIO supporting Orange Pi and other SBCs
Project description
OPi.GPIO EX
An experimental fork that use gpio readall
for mapping instead of map manually.
A drop-in replacement library for RPi.GPIO for the Orange Pi Zero and other SBCs. Only the basic GPIO functions are replicated, using sysfs: this allows the GPIO pins to be accessed from user space.
See the documentation for install instructions and detailed API usage. Note: this documentation is not specific to this fork.
Installation
You must have WiringPi (WiringOP etc.) installed in your system, and be able to use gpio readall
command.
In the virtual environment that you are using for your project, run:
pip3 install OPi.GPIO-ex
OPi.GPIO is now accessible like this:
import OPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
# or GPIO.setmode(GPIO.BCM)
# setup inputs, outputs, event detection etc as per the documentation linked above
Notes
Non-Root Access
OPi.GPIO generally needs root access, but this might be inconvenient in some cases. The official documentation has instructions for non-root access, but this solution did not work correctly for me, so your mileage may vary here.
Running a Python script with sudo
does not work correctly when a virtual environment is activated. However,
you can run sudo venv/bin/python3 myscript.py
which will work correctly. This is my (probably not best-practices)
solution for the time being. It does not, however, allow you to run it without root entirely.
Testing
Only tested with my Orange Pi Zero 2W and a e-Paper module (see Waveshare_e-Paper, not finished yet)
Changelog
Version | Description | Date |
---|---|---|
1.0.0 | Use WiringPi gpio readall to get pin mapping instead |
2023/12/26 |
0.5.5 | Add OrangePi Zero 2W pin mappings | 2023/12/25 |
0.5.4 | Add OrangePi Zero3 pin mappings | 2023/08/06 |
0.5.3 | Add Radxa Zero pin mappings | |
Add OrangePi Zero2 pin mappings | 2022/06/20 | |
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 |
0.5.0 | Add Hardware PWM Control | |
Add support for the NanoPi M4 family | ||
Add OrangePi 4 & 4B pin mappings | ||
Add rockpi/rockpi s packages added | ||
Fix OrangePi PC BCM Pin map | 2021/04/25 | |
0.4.0 | Add various new pin mappings for Orange Pi variants | 2019/10/21 |
0.3.6 | Expose pullup resistor constants to API users | |
Add OrangePi Prime pin mappings | 2019/01/14 | |
0.3.5 | Add OrangePi Lite & One pin mappings | 2018/11/10 |
0.3.4 | Add more OrangePi and NanoPi pin mappings | 2018/09/16 |
0.3.3 | Add waits for UDEV rules | 2018/09/15 |
0.3.2 | Add OrangePi PC pin mappings | 2018/03/04 |
0.3.1 | Add NanoPi DUO pin mappings | 2018/01/01 |
0.3.0 | Add alternate pin mappings | 2017/12/31 |
0.2.5 | sysfs: set output() value to 0 or 1 | 2017/07/15 |
0.2.4 | Add compatibility for pull up/down and bouncetime params | 2017/05/27 |
0.2.3 | Make worker threads daemonic (can't exit otherwise) | 2017/05/26 |
0.2.2 | GPIO.setup() catches IOError and re-exports |
2017/03/28 |
0.2.1 | Minor bug fixes | |
Additional tests | 2017/03/14 | |
0.2.0 | Add edge detection and eventing | 2017/03/14 |
0.1.0 | Initial version | 2017/03/11 |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file opi_gpio_ex-1.0.0.tar.gz
.
File metadata
- Download URL: opi_gpio_ex-1.0.0.tar.gz
- Upload date:
- Size: 27.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a94adc28a0fe824ed7ddb80449c87c621a455329d42a0d30c8bbc063418904a |
|
MD5 | ecc3d5925f4f08415e728fb51fda8402 |
|
BLAKE2b-256 | 54b40cfbbe02434525993298ebbf6328ca73be270e1b94a6b44fea6be447b064 |
File details
Details for the file opi_gpio_ex-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: opi_gpio_ex-1.0.0-py3-none-any.whl
- Upload date:
- Size: 38.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88e2daaf8d37e99b1be6b52af2a600c084ce59d6d27f1ca842baf923c791556d |
|
MD5 | ba6141c4cfdfae780a63a33d41c72912 |
|
BLAKE2b-256 | 4081ff05140210068d68f48420e385eb5343d86f9f850c06a373aa12211e09da |