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

< News
Revision as of 10:34, 17 October 2014 by Hipboi (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

New wiki skin powered by bootstrapskin

Community Updates


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( The advantage of implementing it this way is speed and full control, the dis-advantage is security problem.

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:

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


   sudo apt-get install gcc python-dev
   python install


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


   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

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

Popular pages
  1. Home‏‎ (1,091,987 views)
  2. Rock‏‎ (696,808 views)
  3. Rock/flash the image‏‎ (493,602 views)
  4. Buy‏‎ (339,344 views)
  5. Rock2‏‎ (336,794 views)
  6. Rockpi4‏‎ (283,166 views)
  7. Rock/prebuilt images‏‎ (230,105 views)
  8. Rock/Booting Linux‏‎ (152,459 views)
  9. Rock/Android Build‏‎ (145,067 views)
  10. Rock/download‏‎ (138,237 views)
More >>