Please select To the mobile version | Continue to access the desktop computer version

OrangePi

 Login            
 Register            
Search
Hot search: orangepi
View: 6861|Reply: 3

GPIO library - RPi.GPIO_OPI

[Copy link]

1

Threads

7

Posts

163

Credits

Registered member

Rank: 2

Credits
163
Post time 2015-10-16 18:06:04 | Show all posts |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 post contains more resources

You have to Login for download or view attachment(s). No Account? Register

x

18

Threads

303

Posts

7739

Credits

Moderator

Rank: 7Rank: 7Rank: 7

Credits
7739
Post time 2015-10-17 19:54:11 | Show all posts

1

Threads

7

Posts

163

Credits

Registered member

Rank: 2

Credits
163
 Author| Post time 2015-10-17 22:53:37 | Show all posts
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
Post time 2016-9-7 07:37:42 | Show all posts
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 have to log in before you can reply Login | Register

Points Rules

Archiver|Mobile edition|Darkroom|OrangePi En ( 粤ICP备14086627号-2

2019-11-22 23:06 GMT+8 , Processed in 0.030774 second(s), 23 queries .

Powered by Discuz! X3.2

© 2014-2015 orangepibbs en.

Quick Reply To Top Return to the list