View: 11840|Reply: 3

GPIO library - RPi.GPIO_OPI

[Copy link]

1

threads

7

posts

237

credits

Intermediate member

Rank: 3Rank: 3

credits
237
Published in 2015-10-16 18:06:04 | Show all floors |Read mode
Edited by mark2@opi at 2015-10-17 18:39

Hi,

I tried to adapt RPi.GIPO to OrangePi H3 boards. It is based on de Banana Pi RPi.GPIO_BP of LeMaker so all credits to them.

But after 20 years my C needs brushing up and am by no means a linux expert, got only the basics working:
GPIO.setmode(GPIO.BCM/BOARD/RAW)
GPIO.setup(PIN, GPIO.OUT/IN)
And the soft-PWM is working too.

This basic functions use memory mapped access to GPIO Pins. I’m stuck at the event handling.
It uses GPIO Sysfs Userspace-Interface for handling events, so build a customkernel with GPIO sysfs enabled. /sys/class/gpio/export and unexport show up and RPi.GPIO.add_event_detect(PIN, GPIO.FALLING/RISING , callback=my_callback) doesn’t give runtime errors any more.
But no event handling.
Compiling the libary gives errors about the “write” statements used to interface with GPIO Sysfs. (missing or wrong  unistd.h ???)



EDIT 2015-10-17:

Made some progress, i forgot to edit the mapping of  (fex) gpio_pin_numbers to connector pins..
But am in doubt now:

alter the mapping in RPi.GPIO_OPI  

OR

edit the fex file to get an raspberry-BCM-compatible-as-possible header??


(Have not updated zip)


I hope someone who actual knows what he is doing can take over.


BTW: ALL GPIO pins connected to the he header (CON3) are mapped.  Some of them have fixed functions and can not be used as regular in/out

@ steven the user manual states CON3-13 and CON3-P22 are connected to PA2; CON3-P13 is connected to PA0

This thread contains more resources

You need to Log in to download or view,No account?    Register

x

18

threads

303

posts

9939

credits

Moderator

Rank: 7Rank: 7Rank: 7

credits
9939
Published in 2015-10-17 19:54:11 | Show all floors

1

threads

7

posts

237

credits

Intermediate member

Rank: 3Rank: 3

credits
237
 Author| Published in 2015-10-17 22:53:37 | Show all floors
jacer replied at 2015-10-17 19:54
PYHON GPIO check it out.

http://www.orangepi.org/orangepibbsen/forum.php?mod=viewthread&tid=523&pid ...

Nice, Thanx

Go trough your examples;
connector.gpio3pxx are used, in the mapping header gpio1 is defined



1

threads

9

posts

105

credits

Registered member

Rank: 2

credits
105
Published in 2016-9-7 07:37:42 | Show all floors
jacer replied at 2015-10-17 19:54
PYHON GPIO check it out.

http://www.orangepi.org/orangepibbsen/forum.php?mod=viewthread&tid=523&pid ...

interrupt driven gpi not working
You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list