Open nopnop2002 opened 7 years ago
Hi
It is easy to add these to the file /pyA20/gpio/mapping.h
.
Simply go to around line number 100 and add the entry you need.
The other lines give you the format which is basically:
{ <quoted text port name, e.g. PA15>, SUNXI_GPA(15), <number of the header pin or just 0 if not on header>
\
Here are the lines for PA15, PA16 :
{ "PA15", SUNXI_GPA(15), 19 },
{ "PA16", SUNXI_GPA(16), 21 },
Also incorrect is the onboard RED and GREEN LEDs for the OrangePi Zero, as per this link: http://linux-sunxi.org/Xunlong_Orange_Pi_Zero#LEDs.
Once again just add these lines to solve that problem:
{ "RED_LED", SUNXI_GPA(17), 0 },
{ "GREEN_LED", SUNXI_GPL(10), 0 },
I hope this helps.
Best regards P
Perfect! i was able to add PA15 and PA16 but how to add PL0 and PL1: i did this on /pyA20/gpio/mapping.h / { "PA1", SUNXI_GPA(1), 11 }, { "PA0", SUNXI_GPA(0), 13 },/ { "PL0", SUNXI_GPL(0), 11 }, { "PL1", SUNXI_GPL(1), 13 }, but no success :( i also try 352 instea of SUNXI_GPL(0) but still fail :(
@lamerjack
Unlike other ports, PL0 and PL1 are not consecutive addresses.
Therefore, it is not easy to use with software that uses mmap function.
Please try this. Both PL0 and PL1 can be used.
https://github.com/vsergeev/python-periphery.git
#!/usr/bin/python
#-*- encoding: utf-8 -*-
from periphery import GPIO
import time
import signal
import sys
def handler(signal, frame):
global flag
flag = False
flag = True
signal.signal(signal.SIGINT, handler)
pin1 = 352
pin2 = 353
gpio1_out = GPIO(pin1, "out")
gpio2_out = GPIO(pin2, "out")
while flag:
gpio1_out.write(False)
gpio2_out.write(True)
time.sleep(1.0)
gpio1_out.write(True)
gpio2_out.write(False)
time.sleep(1.0)
gpio1_out.write(False)
gpio2_out.write(False)
gpio1_out.close()
gpio2_out.close()
https://github.com/rm-hull/OPi.GPIO
#!/bin/python
#-*- encoding: utf-8 -*-
import orangepi.zeroplus2
from OPi import GPIO
import time
import signal
import sys
flag = True
def handler(signal, frame):
global flag
flag = False
signal.signal(signal.SIGINT, handler)
pin1 = 11
pin2 = 13
GPIO.setmode(orangepi.zeroplus2.BOARD)
GPIO.setup(pin1, GPIO.OUT)
GPIO.setup(pin2, GPIO.OUT)
GPIO.output(pin2, GPIO.HIGH)
while flag:
GPIO.output(pin1, not GPIO.input(pin1))
GPIO.output(pin2, not GPIO.input(pin2))
time.sleep(1.0)
GPIO.output(pin1, GPIO.LOW)
GPIO.output(pin2, GPIO.LOW)
GPIO.cleanup()
unfortunately i need to use pya20 is gpio controller not made by me... anyway i found this post from you: https://github.com/Jeremie-C/OrangePi.GPIO/issues/3 so tomorrow i will try it!
Orange Pi ZERO have port.PA15 & port.PA16. But not define in this library,