PINE64
pine64 SDK/library - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: General (https://forum.pine64.org/forumdisplay.php?fid=1)
+--- Forum: Getting Started (https://forum.pine64.org/forumdisplay.php?fid=21)
+--- Thread: pine64 SDK/library (/showthread.php?tid=1190)



pine64 SDK/library - capnOfdShip - 05-27-2016

is there some library for pine64 like what Rpi has where you can read and write information to the io ports?  I believe there is I just couldn't find it.


RE: pine64 SDK/library - martinayotte - 05-28-2016

https://github.com/swkim01/RPi.GPIO-PineA64


RE: pine64 SDK/library - Keex - 05-29-2016

(05-28-2016, 07:38 AM)martinayotte Wrote: https://github.com/swkim01/RPi.GPIO-PineA64

Looks cool, could you maybe give a rough tutorial? Smile


RE: pine64 SDK/library - Luke - 05-29-2016

Excellent - many people asking about GPIO


RE: pine64 SDK/library - martinayotte - 05-29-2016

Here is a quick example of GPIO LED Blinker :


Code:
import RPi.GPIO as GPIO
LED_PIN = 26
GPIO.setmode(GPIO.BCM)
GPIO.setup(LED_PIN, GPIO.OUT)
while 1:
  GPIO.output(LED_PIN, GPIO.HIGH)
  time.sleep(0.25)
  GPIO.output(LED_PIN, GPIO.LOW)
  time.sleep(0.25)
GPIO.cleanup()



RE: pine64 SDK/library - adamw - 05-29-2016

Is modification of GPIO via /sys/class/gpio not supported?

I'm trying to setup GPIO 17 as an output.

I can successfully export 17 as a GPIO, but then when I go to that directory ("gpio17") and try to set its direction, I get "Unknown error 517".

I only have a couple GPIO that I need to use, so I'm wondering if the whole library is worth it, but if there's no other way...maybe I'll have to use it?


RE: pine64 SDK/library - martinayotte - 05-29-2016

You're right ! It seems that there is an issue there.
When I get chance, I will try to investigate ...
(In the mean time, you should probably use the Python library from https://github.com/swkim01/RPi.GPIO-PineA64)


RE: pine64 SDK/library - martinayotte - 05-30-2016

@adamw,
Doing some searches, I found out the cause of the issue : since awhile, the pin numbering scheme in /sys/class/gpio has changed !

See : http://linux-sunxi.org/GPIO#Accessing_the_GPIO_pins_through_sysfs_with_mainline_kernel
Also, here on the forum :
http://forum.pine64.org/showthread.php?tid=474&pid=4000#pid4000

On Pine64, the GPIO17 is attached to PC7, so, for the /sys/class/gpio, the numbering would be :

Code:
('C' - 'A') * 32 + 7
or
2 * 32 + 7 = 71

You can now give it a try with :


Code:
echo "71" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio71/direction
echo 1 > /sys/class/gpio/gpio71/value



RE: pine64 SDK/library - adamw - 05-30-2016

That's great news!
Thanks for sharing.