Please enable javascript, or click here to visit my ecommerce web site powered by Shopify.
Jump to: navigation, search

Difference between revisions of "News/2014/10/pyRock-python-gpio-library"

(Created page with "{{News_topic | New wiki skin powered by bootstrapskin | Community Updates| Sep 15, 2014| hipboi }} {{News_begin}} {{News_pic| http://radxa.com/mw/images/e/e4/Python.png}}...")
 
 
Line 1: Line 1:
{{News_topic | New wiki skin powered by bootstrapskin | Community Updates| Sep 15, 2014| hipboi }}
+
{{News_topic | PyRock - python GPIO library | Community Updates| Oct 17, 2014| hipboi }}
  
 
{{News_begin}}
 
{{News_begin}}
Line 23: Line 23:
  
 
INSTALL
 
INSTALL
============
+
==========
 
     sudo apt-get install gcc python-dev
 
     sudo apt-get install gcc python-dev
 
     python setup.py install
 
     python setup.py install
  
 
UNINSTALL
 
UNINSTALL
============
+
==========
 
     rm -rf /usr/local/lib/python2.7/dist-packages/pyRock*
 
     rm -rf /usr/local/lib/python2.7/dist-packages/pyRock*
  
 
GPIO METHODS
 
GPIO METHODS
============
+
==========
  
 
     init()      -  Make initialization of the module. Always must be called first.
 
     init()      -  Make initialization of the module. Always must be called first.

Latest revision as of 10:36, 17 October 2014


PyRock - python GPIO library


Community Updates

Python.png

Hi, all

I am glad to announce that the pyRock - python gpio module for rock/pro/lite platform is released. This python module uses /dev/mem to access the low level register and configure them, same way as pyPi(https://pypi.python.org/pypi/RPi.GPIO). The advantage of implementing it this way is speed and full control, the dis-advantage is security problem.

https://github.com/radxa/pyRock

This package provide methods for controlling GPIO pins on rockchip platform. This is written for radxa rock/rock pro/rock lite, but it can be used with other rockchip boards. If you do this we cannot guarantee proper operation of the module. Before using this package we recommend reading the article at radxa wiki:

http://radxa.com/Rock/GPIO http://radxa.com/Rock/extension_header

When using GPIO make sure that the desired gpio is not used by another periphery.

INSTALL

==

   sudo apt-get install gcc python-dev
   python setup.py install

UNINSTALL

==

   rm -rf /usr/local/lib/python2.7/dist-packages/pyRock*

GPIO METHODS

==

   init()      -   Make initialization of the module. Always must be called first.
   input()     -   Return current value of gpio.
   output()    -   Set output value.
   getmux()    -   Read current configuration of gpio.
   setmux()    -   Write configuration to gpio.


The available constants are:

   NAME        -   EQUALS TO
   ====            =========
   HIGH        ->      1
   LOW         ->      0
   INPUT       ->      0
   OUPTUT      ->      1
   PULLUP      ->      1
   PULLDOWN    ->      2


The gpio are named in following way:

   By pin name in upper case or lower case:
   PIN0PA0, PIN1PB1, PIN3PD7, or
   pin0pa0, pin1pb1, pin3pd7 etc
   These can be imported from port module:
   >>> from pyRock.gpio import gpio
   >>> print gpio.PIN0PA0

Generally these constants are just an offset in the memory from the base GPIO address, so they can be assigned to a number type variable.

   >>> led = gpio.PIN0PB7
   >>> print led
   15

It's important that you run your python script as root!


Popular pages
  1. Home‏‎ (2,302,293 views)
  2. Rock‏‎ (873,341 views)
  3. Buy‏‎ (809,880 views)
  4. Rockpi4‏‎ (696,676 views)
  5. Rock/flash the image‏‎ (664,999 views)
  6. RockpiX‏‎ (410,561 views)
  7. Dual Quad SATA HAT‏‎ (392,776 views)
  8. Rock2‏‎ (381,700 views)
  9. RockpiS‏‎ (342,197 views)
  10. Rock/prebuilt images‏‎ (306,510 views)
More >>


Feed